aboutsummaryrefslogtreecommitdiffstats
path: root/queries/python
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-04-29 17:35:35 +0900
committerGitHub <noreply@github.com>2023-04-29 10:35:35 +0200
commit1ca9b938c1c3d8b2c64a168f6a5419b8f3870410 (patch)
tree708625a300dca93d3fcac5935c8e2be094c914bd /queries/python
parentUpdate parsers: erlang, haskell (diff)
downloadnvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.tar
nvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.tar.gz
nvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.tar.bz2
nvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.tar.lz
nvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.tar.xz
nvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.tar.zst
nvim-treesitter-1ca9b938c1c3d8b2c64a168f6a5419b8f3870410.zip
Add Python else elif dedent (#4618)
* feat(python): add interactive else/elif dedent * fixup * add test
Diffstat (limited to 'queries/python')
-rw-r--r--queries/python/indents.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/queries/python/indents.scm b/queries/python/indents.scm
index efcdba6b2..338473f00 100644
--- a/queries/python/indents.scm
+++ b/queries/python/indents.scm
@@ -83,6 +83,14 @@
(continue_statement)
] @indent.dedent
+(ERROR
+ (_) @indent.branch ":" .
+ (#lua-match? @indent.branch "^else"))
+
+(ERROR
+ (_) @indent.branch @indent.dedent ":" .
+ (#lua-match? @indent.branch "^elif"))
+
(parenthesized_expression ")" @indent.end)
(generator_expression ")" @indent.end)
(list_comprehension "]" @indent.end)