Reputation: 173
I'm writing a VScode extensions to support a script language I'm developing. I try to enable brackets definition to support pair bracket colorization but when the bracket is inside a string it's not ignored :
How can I tell vscode to skip the string ?
The language-configuration.json
file:
{
"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": [
["{", "}"],
["[", "]"],
["(", ")"],
["'", "'"],
["\"", "\""],
["`", "`"]
],
}
Upvotes: 0
Views: 120
Reputation: 173
I found out that even if the LSP adds semantics, I have to provide a grammar file to help vscode to identify strings.
{
"scopeName": "source.X",
"patterns": [{ "include": "#string" }],
"repository": {
"string": {
"begin": "\\\"",
"end": "\\\"",
"name": "string"
}
}
}
Upvotes: 1