Skip to content

Commit 5895973

Browse files
committed
Only add an indentation level for colons at end of line
Closes codemirror#6634
1 parent ee150b8 commit 5895973

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

mode/python/python.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
state.dedent += 1;
319319

320320
if (current == "lambda") state.lambda = true;
321-
if (current == ":" && !state.lambda && top(state).type == "py")
321+
if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
322322
pushPyScope(state);
323323

324324
if (current.length == 1 && !/string|comment/.test(style)) {

mode/python/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@
4141
MT("bracesInFString", "[string f']{[variable x] [operator +] {}}[string !']")
4242

4343
MT("nestedFString", "[string f']{[variable b][[ [string f\"c\"] ]]}[string f'] [comment # oops]")
44+
45+
MT("dontIndentTypeDecl",
46+
"[variable i]: [builtin int] [operator =] [number 32]",
47+
"[builtin print]([variable i])")
4448
})();

0 commit comments

Comments
 (0)