Unnamed repository; edit this file 'description' to name the repository.
fix: golang indent issues when auto-pairs = false (#15511)
When auto-pairs is disabled, typing an opening delimiter without a matching closing one causes tree-sitter to produce an ERROR node. Add patterns to match ERROR nodes containing '{', '(', and '[' so that indentation works correctly in these cases. Fixes #7910 Signed-off-by: majiayu000 <[email protected]>
lif 3 months ago
parent 2b0784a · commit a1cb573
-rw-r--r--runtime/queries/go/indents.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/queries/go/indents.scm b/runtime/queries/go/indents.scm
index b2befab0..a6b962e2 100644
--- a/runtime/queries/go/indents.scm
+++ b/runtime/queries/go/indents.scm
@@ -38,3 +38,9 @@
(default_case)
(type_case)
] @extend
+
+; Handle ERROR nodes for when auto-pairs is disabled.
+; Typing an opening delimiter without a closing one produces an ERROR node.
+(ERROR "{") @indent @extend
+(ERROR "(") @indent
+(ERROR "[") @indent