mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
![Russell Davis](/assets/img/avatar_default.png)
Fixes #201424 It wasn't matching closing parens, which resulted in these issues: * Pressing enter with just a closing paren to the right of the caret wouldn't result in a dedent on the next line * With the caret at the start of the line below a line containing only a closing paren, pressing tab would result in an extra level of indentation
203 lines
3.2 KiB
JSON
203 lines
3.2 KiB
JSON
{
|
|
// Note that this file should stay in sync with 'typescript-language-basics/language-configuration.json'
|
|
"comments": {
|
|
"lineComment": "//",
|
|
"blockComment": [
|
|
"/*",
|
|
"*/"
|
|
]
|
|
},
|
|
"brackets": [
|
|
[
|
|
"${",
|
|
"}"
|
|
],
|
|
[
|
|
"{",
|
|
"}"
|
|
],
|
|
[
|
|
"[",
|
|
"]"
|
|
],
|
|
[
|
|
"(",
|
|
")"
|
|
]
|
|
],
|
|
"autoClosingPairs": [
|
|
{
|
|
"open": "{",
|
|
"close": "}"
|
|
},
|
|
{
|
|
"open": "[",
|
|
"close": "]"
|
|
},
|
|
{
|
|
"open": "(",
|
|
"close": ")"
|
|
},
|
|
{
|
|
"open": "'",
|
|
"close": "'",
|
|
"notIn": [
|
|
"string",
|
|
"comment"
|
|
]
|
|
},
|
|
{
|
|
"open": "\"",
|
|
"close": "\"",
|
|
"notIn": [
|
|
"string"
|
|
]
|
|
},
|
|
{
|
|
"open": "`",
|
|
"close": "`",
|
|
"notIn": [
|
|
"string",
|
|
"comment"
|
|
]
|
|
},
|
|
{
|
|
"open": "/**",
|
|
"close": " */",
|
|
"notIn": [
|
|
"string"
|
|
]
|
|
}
|
|
],
|
|
"surroundingPairs": [
|
|
[
|
|
"{",
|
|
"}"
|
|
],
|
|
[
|
|
"[",
|
|
"]"
|
|
],
|
|
[
|
|
"(",
|
|
")"
|
|
],
|
|
[
|
|
"'",
|
|
"'"
|
|
],
|
|
[
|
|
"\"",
|
|
"\""
|
|
],
|
|
[
|
|
"`",
|
|
"`"
|
|
],
|
|
[
|
|
"<",
|
|
">"
|
|
]
|
|
],
|
|
"autoCloseBefore": ";:.,=}])>` \n\t",
|
|
"folding": {
|
|
"markers": {
|
|
"start": "^\\s*//\\s*#?region\\b",
|
|
"end": "^\\s*//\\s*#?endregion\\b"
|
|
}
|
|
},
|
|
"wordPattern": {
|
|
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\@\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)",
|
|
},
|
|
"indentationRules": {
|
|
"decreaseIndentPattern": {
|
|
"pattern": "^((?!.*?/\\*).*\\*\/)?\\s*[\\}\\]\\)].*$"
|
|
},
|
|
"increaseIndentPattern": {
|
|
"pattern": "^((?!//).)*(\\{([^}\"'`/]*|(\\t|[ ])*//.*)|\\([^)\"'`/]*|\\[[^\\]\"'`/]*)$"
|
|
},
|
|
// e.g. * ...| or */| or *-----*/|
|
|
"unIndentedLinePattern": {
|
|
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
|
}
|
|
},
|
|
"onEnterRules": [
|
|
{
|
|
// e.g. /** | */
|
|
"beforeText": {
|
|
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
|
|
},
|
|
"afterText": {
|
|
"pattern": "^\\s*\\*/$"
|
|
},
|
|
"action": {
|
|
"indent": "indentOutdent",
|
|
"appendText": " * "
|
|
}
|
|
},
|
|
{
|
|
// e.g. /** ...|
|
|
"beforeText": {
|
|
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
|
|
},
|
|
"action": {
|
|
"indent": "none",
|
|
"appendText": " * "
|
|
}
|
|
},
|
|
{
|
|
// e.g. * ...|
|
|
"beforeText": {
|
|
"pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
|
},
|
|
"previousLineText": {
|
|
"pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))"
|
|
},
|
|
"action": {
|
|
"indent": "none",
|
|
"appendText": "* "
|
|
}
|
|
},
|
|
{
|
|
// e.g. */|
|
|
"beforeText": {
|
|
"pattern": "^(\\t|[ ])*[ ]\\*/\\s*$"
|
|
},
|
|
"action": {
|
|
"indent": "none",
|
|
"removeText": 1
|
|
},
|
|
},
|
|
{
|
|
// e.g. *-----*/|
|
|
"beforeText": {
|
|
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$"
|
|
},
|
|
"action": {
|
|
"indent": "none",
|
|
"removeText": 1
|
|
},
|
|
},
|
|
{
|
|
"beforeText": {
|
|
"pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$"
|
|
},
|
|
"afterText": {
|
|
"pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))"
|
|
},
|
|
"action": {
|
|
"indent": "indent"
|
|
}
|
|
},
|
|
{
|
|
// Decrease indentation after single line if/else if/else, for, or while
|
|
"previousLineText": "^\\s*(((else ?)?if|for|while)\\s*\\(.*\\)\\s*|else\\s*)$",
|
|
// But make sure line doesn't have braces or is not another if statement
|
|
"beforeText": "^\\s+([^{i\\s]|i(?!f\\b))",
|
|
"action": {
|
|
"indent": "outdent"
|
|
}
|
|
}
|
|
]
|
|
}
|