on master help sign in
Improve indent queries for python in specific cases (#5332)

where the tree-sitter completely fails to parse incomplete code.

commit873434b9270829139076027b45c36eb21dd4b1cc authorTriton171 <daniel.ebert@protonmail.com> dateSat 7 Jan 2023, 06:39 (4 years ago) parent9f0d939
1 file changed+13
runtime/queries/python/indents.scm+13
runtime/queries/python/indents.scm+13
@@ -29,6 +29,19 @@
2929 (class_definition)
3030] @indent
3131
32+; Workaround for the tree-sitter grammar creating large errors when a
33+; try_statement is missing the except/finally clause
34+(ERROR
35+ "try"
36+ .
37+ ":" @indent @extend)
38+(ERROR
39+ .
40+ "def") @indent @extend
41+(ERROR
42+ (block) @indent @extend
43+ (#set! "scope" "all"))
44+
3245[
3346 (if_statement)
3447 (for_statement)