diff options
author | Triton171 | 2023-01-07 05:39:31 +0000 |
---|---|---|
committer | GitHub | 2023-01-07 05:39:31 +0000 |
commit | 873434b9270829139076027b45c36eb21dd4b1cc (patch) | |
tree | 6917b19748a2ccd7c779fa1c8db735804e880f7c | |
parent | 9f0d939f2535187157c0aae324c6614872684354 (diff) |
Improve indent queries for python in specific cases (#5332)
where the tree-sitter completely fails to parse incomplete code.
-rw-r--r-- | runtime/queries/python/indents.scm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/queries/python/indents.scm b/runtime/queries/python/indents.scm index 743971ad..835b40d3 100644 --- a/runtime/queries/python/indents.scm +++ b/runtime/queries/python/indents.scm @@ -29,6 +29,19 @@ (class_definition) ] @indent +; Workaround for the tree-sitter grammar creating large errors when a +; try_statement is missing the except/finally clause +(ERROR + "try" + . + ":" @indent @extend) +(ERROR + . + "def") @indent @extend +(ERROR + (block) @indent @extend + (#set! "scope" "all")) + [ (if_statement) (for_statement) |