aboutsummaryrefslogtreecommitdiffstats
path: root/queries/c
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-03-20 15:58:06 +0900
committerStephan Seitz <stephan.seitz@fau.de>2023-04-08 09:59:21 -0700
commit9161093fc7e13b12aa5bc86c641768c049d43a26 (patch)
tree2ef3c3bb5f5b3c4ef821fbebc6cba46e4352fef6 /queries/c
parentadd test (diff)
downloadnvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.tar
nvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.tar.gz
nvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.tar.bz2
nvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.tar.lz
nvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.tar.xz
nvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.tar.zst
nvim-treesitter-9161093fc7e13b12aa5bc86c641768c049d43a26.zip
fix(c_indents): fix expression leaking indents
Diffstat (limited to 'queries/c')
-rw-r--r--queries/c/indents.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/queries/c/indents.scm b/queries/c/indents.scm
index 71f47ced1..4d1ba3940 100644
--- a/queries/c/indents.scm
+++ b/queries/c/indents.scm
@@ -6,9 +6,15 @@
(compound_literal_expression)
(initializer_list)
(init_declarator)
- (expression_statement)
] @indent.begin
+; With current indent logic, if we capture expression_statement with @indent.begin
+; It will be affected by _parent_ node with error subnodes deep down the tree
+; So narrow indent capture to check for error inside expression statement only,
+(expression_statement
+ (_) @indent.begin
+ ";" @indent.end)
+
(
ERROR
"for" "(" @indent.begin ";" ";" ")" @indent.end)