Skip to content

Error in language-configuration.json #5

@willw-git

Description

@willw-git

VS Code has a facility called 'folding marker', where a programmer can add a non-executable tag to a line of script indicating that this section should be the beginning of a folding region. It also enables a neat feature where special comments to appear in the preview/navigation pane of editor, as described in this tweet.

The tokens used to achieve this are specified in the file language-configuration.json. Here is the relevant section:

"folding": {
	"markers": {
		"start": "^\\s*#pragma\\s+region\\b",
		"end": "^\\s*#pragma\\s+endregion\\b"
	}
}

Unfortunately, this uses the default C++ syntax for the region
#pragma region comment
and
#pragma endregion
which works to show the comments in preview but causes a syntax error in CONTROL.

A simple fix is to change the regex to the JavaScript setting

"folding": {
	"markers": {
		"start": "^\\s*//\\s*#?region\\b",
		"end": "^\\s*//\\s*#?endregion\\b"		
	}
}

which enables the syntax
// #region comment
and
// #endregion

which works beautifully:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions