Add new line comment when pressing Enter from within line comment for languages that use double slash for line comment (#235407)

* add decrease and increase indent patterns for cpp

* adding new line with line comment on next line from within languages that use double slash for line comment
This commit is contained in:
Aiday Marlen Kyzy
2024-12-06 11:51:50 +01:00
committed by GitHub
parent 2443bffc6c
commit 359ec5270a
11 changed files with 941 additions and 169 deletions

View File

@@ -1,25 +1,67 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
"blockComment": [
"/*",
"*/"
]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
{ "open": "\"", "close": "\"", "notIn": ["string"] }
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
{
"open": "\"",
"close": "\"",
"notIn": [
"string"
]
}
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["<", ">"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"\"",
"\""
],
[
"<",
">"
]
],
"indentationRules": {
"increaseIndentPattern": "^.*\\{[^}\"']*$|^.*\\([^\\)\"']*$",
@@ -30,5 +72,20 @@
"start": "^\\s*//\\s*#?region\\b",
"end": "^\\s*//\\s*#?endregion\\b"
}
}
},
"onEnterRules": [
// Add // when pressing enter from inside line comment
{
"beforeText": {
"pattern": "\/\/.*"
},
"afterText": {
"pattern": "^(?!\\s*$).+"
},
"action": {
"indent": "none",
"appendText": "// "
}
},
]
}