mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Add go locals.scm
This commit is contained in:
parent
04040c61c7
commit
452447694a
1 changed files with 43 additions and 0 deletions
43
queries/go/locals.scm
Normal file
43
queries/go/locals.scm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
(
|
||||
(comment)* @definition.doc
|
||||
(function_declaration
|
||||
name: (identifier) @definition.function) ;@function
|
||||
(#strip! @definition.doc "^//\\s*") ; <- does nothing at the moment
|
||||
)
|
||||
|
||||
(
|
||||
(comment)* @definition.doc
|
||||
(method_declaration
|
||||
name: (field_identifier) @definition.method); @method
|
||||
(#strip! @definition.doc "^//\\s*") ; <- does nothing at the moment
|
||||
)
|
||||
|
||||
|
||||
(short_var_declaration
|
||||
left: (expression_list
|
||||
(identifier) @definition.var))
|
||||
|
||||
(var_spec
|
||||
name: (identifier) @definition.var)
|
||||
|
||||
(parameter_declaration (identifier) @definition.var)
|
||||
(variadic_parameter_declaration (identifier) @definition.var)
|
||||
|
||||
(type_declaration
|
||||
(type_spec
|
||||
name: (type_identifier) @definition.type))
|
||||
|
||||
;; reference
|
||||
(identifier) @reference
|
||||
(type_identifier) @reference
|
||||
(field_identifier) @reference
|
||||
|
||||
;; Scopes
|
||||
|
||||
(source_file) @scope
|
||||
(function_declaration) @scope
|
||||
(if_statement) @scope
|
||||
(block) @scope
|
||||
(expression_switch_statement) @scope
|
||||
(for_statement) @scope
|
||||
(method_declaration) @scope
|
||||
Loading…
Add table
Add a link
Reference in a new issue