Migrate JS/TS to language-configuration

This commit is contained in:
Martin Aeschlimann 2016-07-21 20:06:20 +02:00
parent 354a014029
commit e929d1d8f0
6 changed files with 66 additions and 39 deletions

View file

@ -1,11 +0,0 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
]
}

View file

@ -0,0 +1,28 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["'", "'"],
["\"", "\""],
["`", "`"]
]
}

View file

@ -27,7 +27,7 @@
"extensions": [
".jsx"
],
"configuration": "./javascript.configuration.json"
"configuration": "./language-configuration.json"
},
{
"id": "javascript",
@ -46,7 +46,8 @@
"firstLine": "^#!.*\\bnode",
"mimetypes": [
"text/javascript"
]
],
"configuration": "./language-configuration.json"
}
],
"grammars": [

View file

@ -0,0 +1,30 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"],
["'", "'"],
["\"", "\""],
["`", "`"]
]
}

View file

@ -37,7 +37,8 @@
],
"extensions": [
".ts"
]
],
"configuration": "./language-configuration.json"
},
{
"id": "typescriptreact",
@ -47,7 +48,8 @@
],
"extensions": [
".tsx"
]
],
"configuration": "./language-configuration.json"
}
],
"grammars": [

View file

@ -168,15 +168,6 @@ class LanguageProvider {
increaseIndentPattern: /^.*\{[^}"']*$/
},
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: '//',
blockComment: ['/*', '*/']
},
brackets: [
['{', '}'],
['[', ']'],
['(', ')'],
],
onEnterRules: [
{
// e.g. /** | */
@ -204,21 +195,7 @@ class LanguageProvider {
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
action: { indentAction: IndentAction.None, removeText: 1 }
}
],
__characterPairSupport: {
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"', notIn: ['string'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] },
{ open: '`', close: '`', notIn: ['string', 'comment'] },
{ open: '/**', close: ' */', notIn: ['string'] }
]
}
]
});
});
}