Skip to content

Commit a99fb2c

Browse files
committed
Add to C/C++
1 parent e3cab63 commit a99fb2c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

extensions/cpp/language-configuration.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,16 @@
3030
"start": "^\\s*#pragma\\s+region\\b",
3131
"end": "^\\s*#pragma\\s+endregion\\b"
3232
}
33-
}
33+
},
34+
"onEnterRules": [
35+
{
36+
// Decrease indentation after single line if/else if/else, for, or while
37+
"previousLineText": "^\\s*(((else ?)?if|for|while)\\s*\\(.*\\)\\s*|else\\s*)$",
38+
// But make sure line doesn't have braces or is not another if statement
39+
"beforeText": "^\\s+([^{i\\s]|i(?!f\\b))",
40+
"action": {
41+
"indent": "outdent"
42+
}
43+
}
44+
]
3445
}

0 commit comments

Comments
 (0)