Skip to content

Commit

Permalink
Improve indent queries for python in specific cases (helix-editor#5332)
Browse files Browse the repository at this point in the history
where the tree-sitter completely fails to parse incomplete code.
  • Loading branch information
Triton171 authored and Shafkath Shuhan committed Jan 24, 2023
1 parent 96fb081 commit f9b1965
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions runtime/queries/python/indents.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f9b1965

Please sign in to comment.