diff --git a/packages/language-python/grammars/ts/indents.scm b/packages/language-python/grammars/ts/indents.scm index 670948ed1..975389307 100644 --- a/packages/language-python/grammars/ts/indents.scm +++ b/packages/language-python/grammars/ts/indents.scm @@ -1,10 +1,16 @@ +; Excluding dictionary key/value separators… (dictionary (pair ":" @_IGNORE_ - (#set! capture.final true))) + (#set! capture.final))) +; …lambda functions… ((lambda ":" @_IGNORE_) - (#set! capture.final true)) + (#set! capture.final)) +; …and type annotations on function parameters/class members… +(":" @_IGNORE_ . (type) (#set! capture.final)) + +; …all other colons we encounter hint at upcoming indents. ":" @indent ; When typing out "else" after an "if" statement, tree-sitter-python won't