Unnamed repository; edit this file 'description' to name the repository.
queries/go: Fix doc comment highlights (#15377)
Jonas Köhnen 4 months ago
parent 23448a7 · commit fdd624e
-rw-r--r--runtime/queries/go/highlights.scm41
-rw-r--r--runtime/queries/go/injections.scm6
2 files changed, 21 insertions, 26 deletions
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm
index be9efeac..0be296cf 100644
--- a/runtime/queries/go/highlights.scm
+++ b/runtime/queries/go/highlights.scm
@@ -207,30 +207,25 @@
] @constant.builtin
; Comments
-
(comment) @comment
; Doc Comments
(source_file
- .
- (comment)+ @comment.block.documentation)
-
-(source_file
- (comment)+ @comment.block.documentation
- .
- (const_declaration))
-
-(source_file
- (comment)+ @comment.block.documentation
- .
- (function_declaration))
-
-(source_file
- (comment)+ @comment.block.documentation
- .
- (type_declaration))
-
-(source_file
- (comment)+ @comment.block.documentation
- .
- (var_declaration))
+ (comment) @comment.block.documentation . (comment)* . [
+ (package_clause) ; `package`
+ (type_declaration) ; `type`
+ (function_declaration) ; `func`
+ (method_declaration) ; `func`
+ (var_declaration) ; `var`
+ (const_declaration) ; `const`
+ ; var (
+ ; A = 1
+ ; B = 2
+ ; )
+ (var_spec)
+ ; const (
+ ; A = 1
+ ; B = 2
+ ; )
+ (const_spec)
+ ])
diff --git a/runtime/queries/go/injections.scm b/runtime/queries/go/injections.scm
index c97d62ae..ce0e1604 100644
--- a/runtime/queries/go/injections.scm
+++ b/runtime/queries/go/injections.scm
@@ -9,7 +9,7 @@
; This is only a partial implementation, which covers only
; block comments. For line comments (which are more common),
; upstream changes to the grammar are required.
-(
+(source_file
(comment) @injection.content . (comment)* . [
(package_clause) ; `package`
(type_declaration) ; `type`
@@ -21,12 +21,12 @@
; A = 1
; B = 2
; )
- (const_spec)
+ (var_spec)
; const (
; A = 1
; B = 2
; )
- (var_spec)
+ (const_spec)
]
(#set! injection.language "markdown"))