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,28 +1,96 @@
{
"comments": {
"lineComment": "//", // "#"
"blockComment": [ "/*", "*/" ]
"blockComment": [
"/*",
"*/"
]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
]
],
"autoClosingPairs": [
{ "open": "{", "close": "}", "notIn": ["string"] },
{ "open": "[", "close": "]", "notIn": ["string"] },
{ "open": "(", "close": ")", "notIn": ["string"] },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
{
"open": "{",
"close": "}",
"notIn": [
"string"
]
},
{
"open": "[",
"close": "]",
"notIn": [
"string"
]
},
{
"open": "(",
"close": ")",
"notIn": [
"string"
]
},
{
"open": "'",
"close": "'",
"notIn": [
"string",
"comment"
]
},
{
"open": "\"",
"close": "\"",
"notIn": [
"string",
"comment"
]
},
{
"open": "/**",
"close": " */",
"notIn": [
"string"
]
}
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["'", "'"],
["\"", "\""],
["`", "`"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"'",
"'"
],
[
"\"",
"\""
],
[
"`",
"`"
]
],
"indentationRules": {
"increaseIndentPattern": "({(?!.*}).*|\\(|\\[|((else(\\s)?)?if|else|for(each)?|while|switch|case).*:)\\s*((/[/*].*|)?$|\\?>)",
@@ -85,6 +153,19 @@
"action": {
"indent": "outdent"
}
}
},
// Add // when pressing enter from inside line comment
{
"beforeText": {
"pattern": "\/\/.*"
},
"afterText": {
"pattern": "^(?!\\s*$).+"
},
"action": {
"indent": "none",
"appendText": "// "
}
},
]
}