Skip to content

Commit fb99423

Browse files
author
Mikhail Arkhipov
authored
Fix auto-indent regex rules (#562)
* Basic tokenizer * Fixed property names * Tests, round I * Tests, round II * tokenizer test * Remove temorary change * Fix merge issue * Merge conflict * Merge conflict * Completion test * Fix last line * Fix javascript math * Make test await for results * Add license headers * Rename definitions to types * License headers * Fix typo in completion details (typo) * Fix hover test * Russian translations * Update to better translation * Fix typo * #70 How to get all parameter info when filling in a function param list * Fix #70 How to get all parameter info when filling in a function param list * Clean up * Clean imports * CR feedback * Trim whitespace for test stability * More tests * Better handle no-parameters documentation * Better handle ellipsis and Python3 * #385 Auto-Indentation doesn't work after comment * #141 Auto indentation broken when return keyword involved * Undo changes
1 parent d421dd3 commit fb99423

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/client/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,17 @@ export async function activate(context: vscode.ExtensionContext) {
121121
vscode.languages.setLanguageConfiguration(PYTHON.language!, {
122122
onEnterRules: [
123123
{
124-
beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,
124+
beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async)\b.*/,
125125
action: { indentAction: vscode.IndentAction.Indent }
126126
},
127127
{
128-
beforeText: /^ *#.*$/,
128+
beforeText: /^\s*#.*/,
129129
afterText: /.+$/,
130130
action: { indentAction: vscode.IndentAction.None, appendText: '# ' }
131131
},
132132
{
133-
beforeText: /^\s+(continue|break|return)\b.*$/,
133+
beforeText: /^\s+(continue|break|return)\b.*/,
134+
afterText: /\s+$/,
134135
action: { indentAction: vscode.IndentAction.Outdent }
135136
}
136137
]

0 commit comments

Comments
 (0)