aboutsummaryrefslogtreecommitdiffstats
path: root/queries/go
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-03-02 08:06:35 -0500
committerAmaan Qureshi <amaanq12@gmail.com>2023-03-05 17:15:32 -0500
commit5a87bc98dabd0d38152a6fa774005f7ecbd40f1b (patch)
tree941f6fdcddf4468c10212dd170bae3ff361f867c /queries/go
parentdocs: add `@comment.documentation` (diff)
downloadnvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.tar
nvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.tar.gz
nvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.tar.bz2
nvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.tar.lz
nvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.tar.xz
nvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.tar.zst
nvim-treesitter-5a87bc98dabd0d38152a6fa774005f7ecbd40f1b.zip
feat: add `@comment.documentation` where applicable
Diffstat (limited to 'queries/go')
-rw-r--r--queries/go/highlights.scm38
1 files changed, 32 insertions, 6 deletions
diff --git a/queries/go/highlights.scm b/queries/go/highlights.scm
index be72804b6..ce4ae89b6 100644
--- a/queries/go/highlights.scm
+++ b/queries/go/highlights.scm
@@ -196,20 +196,46 @@
(float_literal) @float
(imaginary_literal) @number
-(true) @boolean
-(false) @boolean
+[
+ (true)
+ (false)
+] @boolean
+
(nil) @constant.builtin
(keyed_element
. (literal_element (identifier) @field))
(field_declaration name: (field_identifier) @field)
+; Comments
+
(comment) @comment @spell
+;; Doc Comments
+
+(source_file . (comment)+ @comment.documentation)
+
+(source_file
+ (comment)+ @comment.documentation
+ . (const_declaration))
+
+(source_file
+ (comment)+ @comment.documentation
+ . (function_declaration))
+
+(source_file
+ (comment)+ @comment.documentation
+ . (type_declaration))
+
+(source_file
+ (comment)+ @comment.documentation
+ . (var_declaration))
+
+; Errors
+
(ERROR) @error
+; Spell
+
((interpreted_string_literal) @spell
- (#not-has-parent? @spell
- import_spec
- )
-)
+ (#not-has-parent? @spell import_spec))