tree-sitter / tree-sitter-go

Go grammar for tree-sitter
MIT License
317 stars 63 forks source link

Query: invalid structure at position 1288 for language go #125

Closed sergii4 closed 1 year ago

sergii4 commented 1 year ago

Start getting error after update nvim, nvim-treesitter and go parser:

query: invalid structure at position 1288 for language go stack traceback: [C]: in function '_ts_parse_query' ...-d0d132f/share/nvim/runtime/lua/vim/treesitter/query.lua:277: in function 'parse_query' ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:104: in function 'normalise_query' ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:161: in function 'parse_positions_from_string' ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:207: in function 'discover_positions' ...acker/start/neotest-go/lua/spec/neotest-go/init_spec.lua:45: in function <...acker/start/neotest-go/lua/spec/neotest-go/init_spec.lua:43>

Tree-sitter Checkhealth Info nvim-treesitter: require("nvim-treesitter.health").check() Installation ~ - OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar) - OK `node` found v16.20.1 (only needed for :TSInstallFromGrammar) - OK `git` executable found. - OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: Apple clang version 14.0.3 (clang-1403.0.22.14.1) - OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI. OS Info: { machine = "arm64", release = "22.5.0", sysname = "Darwin", version = "Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000" } ~ Parser/Features H L F I J - c ✓ ✓ ✓ ✓ ✓ - cpp ✓ ✓ ✓ ✓ ✓ - fish ✓ ✓ ✓ ✓ ✓ - go ✓ ✓ ✓ ✓ ✓ - lua ✓ ✓ ✓ ✓ ✓ - python ✓ ✓ ✓ ✓ ✓ - query ✓ ✓ ✓ ✓ ✓ - rust ✓ ✓ ✓ ✓ ✓ - typescript ✓ ✓ ✓ ✓ ✓ - vim ✓ ✓ ✓ . ✓ - vimdoc ✓ . . . ✓ Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections +) multiple parsers found, only one will be used x) eQurrors found in the query, try to run :TSUpdate {lang} ~
Query [Link](https://github.com/nvim-neotest/neotest-go/blob/main/lua/neotest-go/init.lua#L52C1-L133C60) ``` ;;query ((function_declaration name: (identifier) @test.name) (#match? @test.name "^(Test|Example)")) @test.definition (method_declaration name: (field_identifier) @test.name (#match? @test.name "^(Test|Example)")) @test.definition (call_expression function: (selector_expression field: (field_identifier) @test.method) (#match? @test.method "^Run$") arguments: (argument_list . (interpreted_string_literal) @test.name)) @test.definition ;; query for list table tests (block (short_var_declaration left: (expression_list (identifier) @test.cases) right: (expression_list (composite_literal (literal_value (literal_element (literal_value (keyed_element (literal_element (identifier) @test.field.name) (literal_element (interpreted_string_literal) @test.name)))) @test.definition)))) (for_statement (range_clause left: (expression_list (identifier) @test.case) right: (identifier) @test.cases1 (#eq? @test.cases @test.cases1)) body: (block (call_expression function: (selector_expression field: (field_identifier) @test.method) (#match? @test.method "^Run$") arguments: (argument_list (selector_expression operand: (identifier) @test.case1 (#eq? @test.case @test.case1) field: (field_identifier) @test.field.name1 (#eq? @test.field.name @test.field.name1))))))) ;; query for map table tests (block (short_var_declaration left: (expression_list (identifier) @test.cases) right: (expression_list (composite_literal (literal_value (keyed_element (literal_element (interpreted_string_literal) @test.name) (literal_element (literal_value) @test.definition)))))) (for_statement (range_clause left: (expression_list ((identifier) @test.key.name) ((identifier) @test.case)) right: (identifier) @test.cases1 (#eq? @test.cases @test.cases1)) body: (block (call_expression function: (selector_expression field: (field_identifier) @test.method) (#match? @test.method "^Run$") arguments: (argument_list ((identifier) @test.key.name1 (#eq? @test.key.name @test.key.name1))))))) ```

Steps to reproduce:

amaanq commented 1 year ago

belongs in nvim-treesitter