10000 Restore removed code · codemirror/lang-python@1fe52ea · GitHub
[go: up one dir, main page]

Skip to content

Commit 1fe52ea

Browse files
committed
Restore removed code
Seems it did more than I thought
1 parent 1f8d660 commit 1fe52ea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/python.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ export {globalCompletion, localCompletionSource}
77

88
function indentBody(context: TreeIndentContext, node: SyntaxNode) {
99
let base = context.lineIndent(node.from)
10+
let line = context.lineAt(context.pos, -1), to = line.from + line.text.length
11+
// Don't consider blank, deindented lines at the end of the
12+
// block part of the block
13+
if (/^\s*($|#)/.test(line.text) &&
14+
context.node.to < to + 100 &&
15+
!/\S/.test(context.state.sliceDoc(to, context.node.to)) &&
16+
context.lineIndent(context.pos, -1) <= base)
17+
return null
1018
// A normally deindenting keyword that appears at a higher
1119
// indentation than the block should probably be handled by the next
1220
// level

0 commit comments

Comments
 (0)
0