nvim-treesitter / nvim-treesitter-textobjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with .go files and treesitter

TheLazyLemur opened this issue · comments

Describe the bug

Running TSInstall go results in this error:

Failed to execute the following command:                                                   
{                                                                                          
  cmd = <function 1>                                                                       
}                                                                                          
"...-linux64/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid structure 
at position 2022 for language go"   

To Reproduce

  1. Install Treesitter
  2. Open a .go file
  3. run TSInstall go
  4. The error should be there

Expected behavior

Tree sitter should not have this issue

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- WARNING `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.2.6-76060206-generic",
  sysname = "Linux",
  version = "#202303130630~1683753207~22.04~77c1465 SMP PREEMPT_DYNAMIC Wed M"
} ~

Parser/Features         H L F I J
  - astro               ✓ ✓ ✓ ✓ ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - kotlin              ✓ ✓ ✓ . ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - svelte              ✓ . ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - zig                 ✓ . ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~


### Output of `nvim --version`

```text
NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Additional context

No response

That doesn't look like an nvim-treesitter error. Please try to reproduce it with the minimal init.lua.

That doesn't look like an nvim-treesitter error. Please try to reproduce it with the minimal init.lua.

Thank you for getting back to me.

You may be right, my config is based on kickstart.nvim
Rolling back to treesitter commit 23dfae4 seemed to have fixed the issue for me for now

I will try with a minimal init.lu and revert back

Check your config for other plugins using treesitter (and shipping queries for Go).

All nvim-treesitter modules seem to load correctly (see ticks in checkhealth). Check whether there are third party plugins/queries active on your system (e.g. nvim-treesitter-textobject)

I came here looking for the same error. I can confirm that removing nvim-treesitter-textobject makes the error go away, so it looks like that's the culprit. Thank you! :-)

I can confirm that updating all plugins brings this error, however with older versions it was fine

Already have a fix.