Unnamed repository; edit this file 'description' to name the repository.
feat: update go grammar and queries (#14167)
| -rw-r--r-- | languages.toml | 4 | ||||
| -rw-r--r-- | runtime/queries/go/highlights.scm | 15 | ||||
| -rw-r--r-- | runtime/queries/go/textobjects.scm | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/languages.toml b/languages.toml index f0038a29..fd758738 100644 --- a/languages.toml +++ b/languages.toml @@ -779,7 +779,7 @@ args = { mode = "core", program = "{0}", coreFilePath = "{1}" } [[grammar]] name = "go" -source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "64457ea6b73ef5422ed1687178d4545c3e91334a" } +source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "12fe553fdaaa7449f764bc876fd777704d4fb752" } [[language]] name = "gomod" @@ -3744,7 +3744,7 @@ language-servers = [ "templ" ] [[grammar]] name = "templ" -source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "db662414ccd6f7c78b1e834e7abe11c224b04759" } +source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "47594c5cbef941e6a3ccf4ddb934a68cf4c68075" } [[language]] name = "dbml" diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index 0d65eb16..be9efeac 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -10,7 +10,7 @@ (const_spec name: (identifier) @constant) -(type_spec +(type_spec name: (type_identifier) @constructor) (keyed_element . (literal_element (identifier) @variable.other.member)) @@ -36,14 +36,14 @@ (call_expression function: (identifier) @function.builtin - (#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$")) + (#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover|min|max|clear)$")) ; Types (type_identifier) @type (type_parameter_list - (parameter_declaration + (type_parameter_declaration name: (identifier) @type.parameter)) ((type_identifier) @type.builtin @@ -57,9 +57,8 @@ (method_declaration name: (field_identifier) @function.method) -(method_spec - name: (field_identifier) @function.method) - +(method_elem + name: (field_identifier) @function.method) ; Operators @@ -100,6 +99,8 @@ "|" "|=" "||" + "&^" + "&^=" "~" ] @operator @@ -117,7 +118,7 @@ ] @keyword.control [ - "if" + "if" "else" "switch" "select" diff --git a/runtime/queries/go/textobjects.scm b/runtime/queries/go/textobjects.scm index df1b0866..06c412ee 100644 --- a/runtime/queries/go/textobjects.scm +++ b/runtime/queries/go/textobjects.scm @@ -12,7 +12,7 @@ (type_spec (type_identifier) (struct_type (field_declaration_list (_)?) @class.inside))) @class.around (type_declaration - (type_spec (type_identifier) (interface_type (method_spec)+ @class.inside))) @class.around + (type_spec (type_identifier) (interface_type (method_elem)+ @class.inside))) @class.around (type_parameter_list ((_) @parameter.inside . ","? @parameter.around) @parameter.around) |