Skip to content

Commit 590ecfc

Browse files
adimascioDonJayamanne
authored andcommitted
outdent line following continue / break / return statements (#1050)
* outdent line following continue / break / return statements Automatically outdenting lines following "continue", "break" or "return" statements seems natural and consistent with other editors (e.g. emacs or vim) behaviour. * add word separator in regexp after keywords This will avoid matching strings such as "returning". The word should be matched as a word not as prefix.
1 parent e2ca933 commit 590ecfc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/client/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ export function activate(context: vscode.ExtensionContext) {
8585
{
8686
beforeText: /^ *#.*$/,
8787
afterText: /.+$/,
88-
action: { indentAction: vscode.IndentAction.None, appendText: '# ' }
88+
action: { indentAction: vscode.IndentAction.None, appendText: '# ' },
89+
},
90+
{
91+
beforeText: /^\s+(continue|break|return)\b.*$/,
92+
action: {indentAction: vscode.IndentAction.Outdent},
8993
}
9094
]
9195
});

0 commit comments

Comments
 (0)