-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move js/ts language configs to json file
Fixes #125748
- Loading branch information
Showing
6 changed files
with
494 additions
and
173 deletions.
There are no files selected for viewing
196 changes: 176 additions & 20 deletions
196
extensions/javascript/javascript-language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,193 @@ | ||
{ | ||
// Note that this file should stay in sync with 'typescript-language-basics/language-configuration.json' | ||
"comments": { | ||
"lineComment": "//", | ||
"blockComment": [ "/*", "*/" ] | ||
"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"] } | ||
{ | ||
"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" | ||
} | ||
} | ||
] | ||
} |
164 changes: 142 additions & 22 deletions
164
extensions/javascript/tags-language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,152 @@ | ||
{ | ||
"comments": { | ||
"blockComment": [ "{/*", "*/}" ] | ||
"blockComment": [ | ||
"{/*", | ||
"*/}" | ||
] | ||
}, | ||
"brackets": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["<", ">"] | ||
[ | ||
"{", | ||
"}" | ||
], | ||
[ | ||
"[", | ||
"]" | ||
], | ||
[ | ||
"(", | ||
")" | ||
], | ||
[ | ||
"<", | ||
">" | ||
] | ||
], | ||
"colorizedBracketPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"] | ||
[ | ||
"{", | ||
"}" | ||
], | ||
[ | ||
"[", | ||
"]" | ||
], | ||
[ | ||
"(", | ||
")" | ||
] | ||
], | ||
"autoClosingPairs": [ | ||
{ "open": "{", "close": "}" }, | ||
{ "open": "[", "close": "]" }, | ||
{ "open": "(", "close": ")" }, | ||
{ "open": "'", "close": "'", "notIn": ["string", "comment"] }, | ||
{ "open": "\"", "close": "\"", "notIn": ["string"] }, | ||
{ "open": "/**", "close": " */", "notIn": ["string"] } | ||
{ | ||
"open": "{", | ||
"close": "}" | ||
}, | ||
{ | ||
"open": "[", | ||
"close": "]" | ||
}, | ||
{ | ||
"open": "(", | ||
"close": ")" | ||
}, | ||
{ | ||
"open": "'", | ||
"close": "'", | ||
"notIn": [ | ||
"string", | ||
"comment" | ||
] | ||
}, | ||
{ | ||
"open": "\"", | ||
"close": "\"", | ||
"notIn": [ | ||
"string" | ||
] | ||
}, | ||
{ | ||
"open": "/**", | ||
"close": " */", | ||
"notIn": [ | ||
"string" | ||
] | ||
} | ||
], | ||
"surroundingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["<", ">"], | ||
["'", "'"], | ||
["\"", "\""] | ||
] | ||
} | ||
[ | ||
"{", | ||
"}" | ||
], | ||
[ | ||
"[", | ||
"]" | ||
], | ||
[ | ||
"(", | ||
")" | ||
], | ||
[ | ||
"<", | ||
">" | ||
], | ||
[ | ||
"'", | ||
"'" | ||
], | ||
[ | ||
"\"", | ||
"\"" | ||
] | ||
], | ||
"wordPattern": { | ||
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:'\"\\,\\.\\<\\>\\/\\s]+)" | ||
}, | ||
"onEnterRules": [ | ||
{ | ||
"beforeText": { | ||
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!/)>)[^<]*$", | ||
"flags": "i" | ||
}, | ||
"afterText": { | ||
"pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>$", | ||
"flags": "i" | ||
}, | ||
"action": { | ||
"indent": "indentOutdent" | ||
} | ||
}, | ||
{ | ||
"beforeText": { | ||
"pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w\\-.\\d]*)([^/>]*(?!/)>)[^<]*$", | ||
"flags": "i" | ||
}, | ||
"action": { | ||
"indent": "indent" | ||
} | ||
}, | ||
{ | ||
// `beforeText` only applies to tokens of a given language. Since we are dealing with jsx-tags, | ||
// make sure we apply to the closing `>` of a tag so that mixed language spans | ||
// such as `<div onclick={1}>` are handled properly. | ||
"beforeText": { | ||
"pattern": "^>$" | ||
}, | ||
"afterText": { | ||
"pattern": "/^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>$", | ||
"flags": "i" | ||
}, | ||
"action": { | ||
"indent": "indentOutdent" | ||
} | ||
}, | ||
{ | ||
"beforeText": { | ||
"pattern": "^>$" | ||
}, | ||
"action": { | ||
"indent": "indent" | ||
} | ||
} | ||
], | ||
} |
Oops, something went wrong.