Fix single line if/else and loop indentation

This commit is contained in:
Stephen Sigwart
2021-11-06 12:02:54 -04:00
parent 2260d7cca3
commit 16f501ee33
2 changed files with 18 additions and 0 deletions

View File

@@ -188,6 +188,15 @@
"action": {
"indent": "indent"
}
},
{
// Decrease indentation after single line if/else if/else, for, or while
"previousLineText": "/^\\s*(((else )?if|for|while)\\s*\\(.*\\)\\s*|else\\s*)$/",
// But make sure line doesn't have braces or is not another if statement
"beforeText": "/^\\s+([^{i\\s]|i(?!f\\b))/",
"action": {
"indent": "indentOutdent"
}
}
]
}