Update generated neovim config
This commit is contained in:
123
config/neovim/store/treesitter-parsers/queries/go/highlights.scm
Normal file
123
config/neovim/store/treesitter-parsers/queries/go/highlights.scm
Normal file
@ -0,0 +1,123 @@
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin
|
||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
||||
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(method_declaration
|
||||
name: (field_identifier) @function.method)
|
||||
|
||||
; Identifiers
|
||||
|
||||
(type_identifier) @type
|
||||
(field_identifier) @property
|
||||
(identifier) @variable
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"--"
|
||||
"-"
|
||||
"-="
|
||||
":="
|
||||
"!"
|
||||
"!="
|
||||
"..."
|
||||
"*"
|
||||
"*"
|
||||
"*="
|
||||
"/"
|
||||
"/="
|
||||
"&"
|
||||
"&&"
|
||||
"&="
|
||||
"%"
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"+"
|
||||
"++"
|
||||
"+="
|
||||
"<-"
|
||||
"<"
|
||||
"<<"
|
||||
"<<="
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"~"
|
||||
] @operator
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"break"
|
||||
"case"
|
||||
"chan"
|
||||
"const"
|
||||
"continue"
|
||||
"default"
|
||||
"defer"
|
||||
"else"
|
||||
"fallthrough"
|
||||
"for"
|
||||
"func"
|
||||
"go"
|
||||
"goto"
|
||||
"if"
|
||||
"import"
|
||||
"interface"
|
||||
"map"
|
||||
"package"
|
||||
"range"
|
||||
"return"
|
||||
"select"
|
||||
"struct"
|
||||
"switch"
|
||||
"type"
|
||||
"var"
|
||||
] @keyword
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(interpreted_string_literal)
|
||||
(raw_string_literal)
|
||||
(rune_literal)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @escape
|
||||
|
||||
[
|
||||
(int_literal)
|
||||
(float_literal)
|
||||
(imaginary_literal)
|
||||
] @number
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
(nil)
|
||||
(iota)
|
||||
] @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
175
config/neovim/store/treesitter-parsers/queries/go/structure.scm
Normal file
175
config/neovim/store/treesitter-parsers/queries/go/structure.scm
Normal file
@ -0,0 +1,175 @@
|
||||
(import_declaration
|
||||
"import" @structure.anchor
|
||||
(import_spec_list
|
||||
"(" @structure.open
|
||||
")" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(function_declaration
|
||||
"func" @structure.anchor
|
||||
body: (block
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(function_declaration
|
||||
(identifier) @structure.anchor
|
||||
(parameter_list
|
||||
"(" @structure.open
|
||||
("," @structure.separator (_))*
|
||||
")" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(method_declaration
|
||||
"func" @structure.anchor
|
||||
body: (block
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(call_expression
|
||||
function: (_) @structure.anchor
|
||||
(argument_list
|
||||
"(" @structure.open
|
||||
("," @structure.separator (_))*
|
||||
","? @structure.separator
|
||||
")" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(composite_literal
|
||||
type: (_) @structure.anchor
|
||||
body: (literal_value
|
||||
"{" @structure.open
|
||||
("," @structure.separator (_)?)*
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(literal_value
|
||||
"{" @structure.anchor
|
||||
("," @structure.separator (_)?)*
|
||||
"}" @structure.close
|
||||
)
|
||||
|
||||
(if_statement
|
||||
["if" "else"] @structure.anchor
|
||||
(block
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(if_statement
|
||||
"else" @structure.anchor
|
||||
(if_statement
|
||||
"if"
|
||||
(block
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(expression_switch_statement
|
||||
"switch" @structure.anchor
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
|
||||
(expression_switch_statement
|
||||
(expression_case
|
||||
"case" @structure.anchor
|
||||
":" @structure.open
|
||||
)
|
||||
.
|
||||
[
|
||||
(expression_case "case" @structure.limit)
|
||||
(default_case "default" @structure.limit)
|
||||
]
|
||||
)
|
||||
|
||||
(expression_switch_statement
|
||||
(default_case "default" @structure.anchor)
|
||||
"}" @structure.limit
|
||||
)
|
||||
|
||||
(type_switch_statement
|
||||
"switch" @structure.anchor
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
|
||||
(type_switch_statement
|
||||
(type_case
|
||||
"case" @structure.anchor
|
||||
":" @structure.open
|
||||
)
|
||||
.
|
||||
[
|
||||
(type_case "case" @structure.limit)
|
||||
(default_case "default" @structure.limit)
|
||||
]
|
||||
)
|
||||
|
||||
(select_statement
|
||||
"select" @structure.anchor
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
|
||||
(func_literal
|
||||
"func" @structure.anchor
|
||||
(block
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(for_statement
|
||||
"for" @structure.anchor
|
||||
(block
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(type_declaration
|
||||
"type" @structure.anchor
|
||||
(type_spec
|
||||
(struct_type
|
||||
(field_declaration_list
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(struct_type
|
||||
"struct" @structure.anchor
|
||||
(field_declaration_list
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
|
||||
(type_declaration
|
||||
"type" @structure.anchor
|
||||
(type_spec
|
||||
(interface_type
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(interface_type
|
||||
"interface" @structure.anchor
|
||||
"{" @structure.open
|
||||
"}" @structure.close
|
||||
)
|
||||
30
config/neovim/store/treesitter-parsers/queries/go/tags.scm
Normal file
30
config/neovim/store/treesitter-parsers/queries/go/tags.scm
Normal file
@ -0,0 +1,30 @@
|
||||
(
|
||||
(comment)* @doc
|
||||
.
|
||||
(function_declaration
|
||||
name: (identifier) @name) @definition.function
|
||||
(#strip! @doc "^//\\s*")
|
||||
(#set-adjacent! @doc @definition.function)
|
||||
)
|
||||
|
||||
(
|
||||
(comment)* @doc
|
||||
.
|
||||
(method_declaration
|
||||
name: (field_identifier) @name) @definition.method
|
||||
(#strip! @doc "^//\\s*")
|
||||
(#set-adjacent! @doc @definition.method)
|
||||
)
|
||||
|
||||
(call_expression
|
||||
function: [
|
||||
(identifier) @name
|
||||
(parenthesized_expression (identifier) @name)
|
||||
(selector_expression field: (field_identifier) @name)
|
||||
(parenthesized_expression (selector_expression field: (field_identifier) @name))
|
||||
]) @reference.call
|
||||
|
||||
(type_spec
|
||||
name: (type_identifier) @name) @definition.type
|
||||
|
||||
(type_identifier) @name @reference.type
|
||||
Reference in New Issue
Block a user