nvim-treesitter / nvim-treesitter-textobjects

Apache License 2.0
2.16k stars 194 forks source link

Issue with .go files and treesitter #460

Closed TheLazyLemur closed 1 year ago

TheLazyLemur commented 1 year ago

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

clason commented 1 year ago

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

TheLazyLemur commented 1 year ago

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

clason commented 1 year ago

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

theHamsta commented 1 year ago

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)

alexaandru commented 1 year ago

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! :-)

theHamsta commented 1 year ago

@kiyoon

kiyoon commented 1 year ago

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

theHamsta commented 1 year ago

Already have a fix.