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,26 +1,88 @@
{
"comments": {
"blockComment": ["/*", "*/"],
"blockComment": [
"/*",
"*/"
],
"lineComment": "//"
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
]
],
"autoClosingPairs": [
{ "open": "{", "close": "}", "notIn": ["string", "comment"] },
{ "open": "[", "close": "]", "notIn": ["string", "comment"] },
{ "open": "(", "close": ")", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] }
{
"open": "{",
"close": "}",
"notIn": [
"string",
"comment"
]
},
{
"open": "[",
"close": "]",
"notIn": [
"string",
"comment"
]
},
{
"open": "(",
"close": ")",
"notIn": [
"string",
"comment"
]
},
{
"open": "\"",
"close": "\"",
"notIn": [
"string",
"comment"
]
},
{
"open": "'",
"close": "'",
"notIn": [
"string",
"comment"
]
}
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"\"",
"\""
],
[
"'",
"'"
]
],
"folding": {
"markers": {
@@ -32,5 +94,20 @@
"increaseIndentPattern": "(^.*\\{[^}]*$)",
"decreaseIndentPattern": "^\\s*\\}"
},
"wordPattern": "(#?-?\\d*\\.\\d\\w*%?)|(::?[\\w-]+(?=[^,{;]*[,{]))|(([@#.!])?[\\w-?]+%?|[@#!.])"
"wordPattern": "(#?-?\\d*\\.\\d\\w*%?)|(::?[\\w-]+(?=[^,{;]*[,{]))|(([@#.!])?[\\w-?]+%?|[@#!.])",
"onEnterRules": [
// Add // when pressing enter from inside line comment
{
"beforeText": {
"pattern": "\/\/.*"
},
"afterText": {
"pattern": "^(?!\\s*$).+"
},
"action": {
"indent": "none",
"appendText": "// "
}
},
]
}