6840: Add a language configuration file for VS Code r=matklad a=dustypomerleau

There has been recent discussion in #6451 and #6682 about the need to include angle brackets in auto-close and auto-surround functionality. This PR will accomplish that, but only for users of VS Code, as it uses the VS Code-specific `language-configuration.json` to get the job done. Since there are a large number of VS Code users in the Rust Analyzer cohort, it may be reasonable to fix the issue for them, while waiting on a more comprehensive solution in the language server. In addition to the usual brackets, I've added auto-closing of block comments. I avoided autoclosing single quotes, given that lifetimes are more common than chars.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
This commit is contained in:
bors[bot] 2020-12-13 14:20:11 +00:00 committed by GitHub
commit 917d56273d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,38 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "/*", "close": " */" }
],
"autoCloseBefore": ";:.,=}])> \n\t",
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"],
["\"", "\""],
["'", "'"]
],
"indentationRules": {
"increaseIndentPattern": "^.*\\{[^}\"']*$|^.*\\([^\\)\"']*$",
"decreaseIndentPattern": "^\\s*(\\s*\\/[*].*[*]\\/\\s*)*[})]"
},
"folding": {
"markers": {
"start": "^\\s*//\\s*#?region\\b",
"end": "^\\s*//\\s*#?endregion\\b"
}
}
}

View file

@ -734,6 +734,17 @@
"extensions": [
".rast"
]
},
{
"id": "rust",
"extensions": [
".rs"
],
"aliases": [
"Rust",
"rs"
],
"configuration": "language-configuration.json"
}
],
"grammars": [