go.nvim icon indicating copy to clipboard operation
go.nvim copied to clipboard

Incompatibility with nvim-treesitter@main

Open ryancragun opened this issue 6 months ago • 1 comments

nvim-treesitter@main is scheduled to become the default branch of nvim-treesitter soon. As it's a full rewrite the import of nvim-treesitter.configs no longer works.

 Error executing vim.schedule lua callback: ....local/share/nvim/lazy/go.nvim/lua/go/ts/textobjects.lua:12: module 'nvim-treesitter.configs' not found:
	no field package.preload['nvim-treesitter.configs']
	cache_loader: module 'nvim-treesitter.configs' not found

ryancragun avatar May 27 '25 16:05 ryancragun

Thanks for raising this. I have a quick check of main branch, seems it missing lots of config, setup and functions in main branch. It might require lots of work, esp considering that the main branch is still evolving.

ray-x avatar May 28 '25 00:05 ray-x

Until the rename has been performed, there should probably be a check which version is in use. I imagine two versions of the same plugin might be hard to track for plugin managers.

mpldr avatar Sep 01 '25 08:09 mpldr

Hi, Maybe I got the same issues. After upgraded LazyVim 15.0 which change nvim-treesitter to main branch, I got this error. Please check it out. Thank you

Image

hungrybirder avatar Sep 17 '25 15:09 hungrybirder

Seeing issues with the module's healthcheck still:

==============================================================================
go:                                                                14 ⚠️  1 ❌

Binaries ~
- go installed.
- ⚠️ WARNING Missing tool: richgo
- ⚠️ WARNING Missing tool: ginkgo
- ⚠️ WARNING Missing tool: gonew
- ⚠️ WARNING Missing tool: go-enum
- ⚠️ WARNING Missing tool: json-to-struct
- ⚠️ WARNING Missing tool: govulncheck
- ⚠️ WARNING Missing tool: gomvp
- Tool installed: iferr
- Tool installed: dlv
- Tool installed: gotests
- Tool installed: callgraph
- Tool installed: golangci-lint
- ⚠️ WARNING Missing tool: gotestsum
- Tool installed: gopls
- Tool installed: gofumpt
- Tool installed: goimports
- Tool installed: impl
- Tool installed: gomodifytags
- ⚠️ WARNING Missing tool: fillswitch
- Tool installed: golines
- ⚠️ WARNING Missing tool: mockgen
- ⚠️ WARNING Missing tool: gojsonstruct
- sed installed.
- curl installed.
- golangci-lint version: 2.4
- treesitter parser go found
- treesitter parser gowork found
- treesitter parser gomod found
- treesitter parser gosum found
- treesitter parser sql found
- treesitter parser gotmpl found
- treesitter parser json found
- treesitter parser comment found
- ⚠️ WARNING Some binaries are not installed, please check if your $HOME/go/bin or $GOBIN $exists and in your $PATH
- ⚠️ WARNING gopls not started and lsp_cfg not enabled

Go Plugin Check ~
- ✅ OK lspconfig: plugin is installed
- ✅ OK nvim-treesitter: plugin is installed
- ✅ OK guihua: plugin is installed
- ✅ OK nvim-dap-virtual-text: plugin is installed
- ⚠️ WARNING telescope: not installed/loaded
- ❌ ERROR Failed to run healthcheck for "go" plugin. Exception:
  .../wgreen/.local/share/nvim/lazy/go.nvim/lua/go/health.lua:151: module 'nvim-treesitter.info' not found:
  	no field package.preload['nvim-treesitter.info']
  	cache_loader: module 'nvim-treesitter.info' not found
  	cache_loader_lib: module 'nvim-treesitter.info' not found
  	no file './nvim-treesitter/info.lua'
  	no file '/opt/homebrew/share/luajit-2.1/nvim-treesitter/info.lua'
  	no file '/usr/local/share/lua/5.1/nvim-treesitter/info.lua'
  	no file '/usr/local/share/lua/5.1/nvim-treesitter/info/init.lua'
  	no file '/opt/homebrew/share/lua/5.1/nvim-treesitter/info.lua'
  	no file '/opt/homebrew/share/lua/5.1/nvim-treesitter/info/init.lua'
  	no file '/Users/wgreen/.local/share/nvim/lazy-rocks/nvim-dap-python/share/lua/5.1/nvim-treesitter/info.lua'
  	no file '/Users/wgreen/.local/share/nvim/lazy-rocks/nvim-dap-python/share/lua/5.1/nvim-treesitter/info/init.lua'
  	no file './nvim-treesitter/info.so'
  	no file '/usr/local/lib/lua/5.1/nvim-treesitter/info.so'
  	no file '/opt/homebrew/lib/lua/5.1/nvim-treesitter/info.so'
  	no file '/usr/local/lib/lua/5.1/loadall.so'
  	no file '/Users/wgreen/.local/share/nvim/lazy-rocks/nvim-dap-python/lib/lua/5.1/nvim-treesitter/info.so'
  	no file '/Users/wgreen/.local/share/nvim/lazy-rocks/nvim-dap-python/lib64/lua/5.1/nvim-treesitter/info.so'
  	no file '/Users/wgreen/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/libnvim-treesitter/info.dylib'
  	no file '/Users/wgreen/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/nvim-treesitter/info.dylib'
  	no file './nvim-treesitter.so'
  	no file '/usr/local/lib/lua/5.1/nvim-treesitter.so'
  	no file '/opt/homebrew/lib/lua/5.1/nvim-treesitter.so'
  	no file '/usr/local/lib/lua/5.1/loadall.so'
  	no file '/Users/wgreen/.local/share/nvim/lazy-rocks/nvim-dap-python/lib/lua/5.1/nvim-treesitter.so'
  	no file '/Users/wgreen/.local/share/nvim/lazy-rocks/nvim-dap-python/lib64/lua/5.1/nvim-treesitter.so'
  	no file '/Users/wgreen/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/libnvim-treesitter.dylib'
  	no file '/Users/wgreen/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/nvim-treesitter.dylib'

hotgazpacho avatar Sep 19 '25 11:09 hotgazpacho

Still working on it. One issue is that the two versions of the Treesitter APIs are incompatible (not just the configuration).

ray-x avatar Sep 20 '25 03:09 ray-x

I pushed some changes to https://github.com/ray-x/go.nvim/pull/592 and also guihua.lua

Feel free to switch to treesitter-main branch of go.nvim to testing.

ray-x avatar Sep 25 '25 00:09 ray-x

Uncertain if this is related, I switched branch to treesitter-main and :checkhealth still gives me the same error:

Go Plugin Check ~

  • ✅ OK lspconfig: plugin is installed
  • ✅ OK nvim-treesitter: plugin is installed
  • ✅ OK guihua: plugin is installed
  • ✅ OK nvim-dap-virtual-text: plugin is installed
  • ⚠️ WARNING telescope: not installed/loaded
  • ❌ ERROR Failed to run healthcheck for "go" plugin. Exception: ...bastian/.local/share/nvim/lazy/go.nvim/lua/go/health.lua:151: module 'nvim-treesitter.info' not found: no field package.preload['nvim-treesitter.info'] cache_loader: module 'nvim-treesitter.info' not found cache_loader_lib: module 'nvim-treesitter.info' not found no file './nvim-treesitter/info.lua' no file '/usr/share/luajit-2.1/nvim-treesitter/info.lua' no file '/usr/local/share/lua/5.1/nvim-treesitter/info.lua' no file '/usr/local/share/lua/5.1/nvim-treesitter/info/init.lua' no file '/usr/share/lua/5.1/nvim-treesitter/info.lua' no file '/usr/share/lua/5.1/nvim-treesitter/info/init.lua' no file './nvim-treesitter/info.so' no file '/usr/local/lib/lua/5.1/nvim-treesitter/info.so' no file '/usr/lib/lua/5.1/nvim-treesitter/info.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/home/sebastian/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/libnvim-treesitter/info.so' no file '/home/sebastian/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/nvim-treesitter/info.so' no file './nvim-treesitter.so' no file '/usr/local/lib/lua/5.1/nvim-treesitter.so' no file '/usr/lib/lua/5.1/nvim-treesitter.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/home/sebastian/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/libnvim-treesitter.so' no file '/home/sebastian/.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/nvim-treesitter.so'

What I did, changed the branch in my LazyVim config to this:

........ { "ray-x/go.nvim", branch = "treesitter-main", dependencies = { -- optional packages "ray-x/guihua.lua", "neovim/nvim-lspconfig", "nvim-treesitter/nvim-treesitter", }, ..........

Cleaned, updated and synced. I can see my lazy-lock is updated w:

"go.nvim": { "branch": "treesitter-main", "commit": "db79d7e3fefbd5ad1ac42d3d6f32612eb5897961" },

sebastianbring avatar Sep 25 '25 07:09 sebastianbring

Looks like that branch still depends on modules that don't exist:

module 'nvim-treesitter.ts_utils' not found: no field package.preload['nvim-treesitter.ts_utils']

https://github.com/ray-x/go.nvim/blob/treesitter-main/lua/go/snips.lua#L4

ryancragun avatar Sep 25 '25 16:09 ryancragun

Error when GoAddTag:

GoAddTag Error executing Lua callback: .../.local/share/nvim-lazy/lazy/go.nvim/lua/go/ts/nodes.lua:2: module 'nvim-treesitter.ts_utils' not found:
	no field package.preload['nvim-treesitter.ts_utils']
	cache_loader: module 'nvim-treesitter.ts_utils' not found
	cache_loader_lib: module 'nvim-treesitter.ts_utils' not found
	no file './nvim-treesitter/ts_utils.lua'
	no file '/opt/homebrew/share/luajit-2.1/nvim-treesitter/ts_utils.lua'
.......

s-bespalov avatar Sep 26 '25 23:09 s-bespalov

Error when GoAddTag:

GoAddTag Error executing Lua callback: .../.local/share/nvim-lazy/lazy/go.nvim/lua/go/ts/nodes.lua:2: module 'nvim-treesitter.ts_utils' not found:
	no field package.preload['nvim-treesitter.ts_utils']
	cache_loader: module 'nvim-treesitter.ts_utils' not found
	cache_loader_lib: module 'nvim-treesitter.ts_utils' not found
	no file './nvim-treesitter/ts_utils.lua'
	no file '/opt/homebrew/share/luajit-2.1/nvim-treesitter/ts_utils.lua'
.......

yeah im getting this error aswell for GoAddTag, and for alomost every Go... command i run even tests.

any ideas thanks (need to run my test scripts.)

alikazai avatar Sep 26 '25 23:09 alikazai

so digging into the treesitter-mian branch in the go.lua file on line 13 there is local utils = require "nvim-treesitter.utils"

which is probably whats causing this issue.

alikazai avatar Sep 27 '25 00:09 alikazai

https://github.com/ray-x/go.nvim/pull/593

Not sure if i should raise a PR or what the process is but, since i had so much problems trying to get go running with go.nvim because of the changes to treesitter.

I have worked on gettting issues fixed and i am able to successfully run the GoTestFunc and GoFillStruct etc.

if this doesnt get acceptd at least it highlights some of the fixes etc that can be used in the future .

thanks

alikazai avatar Sep 27 '25 02:09 alikazai

@alikazai A PR would be welcome. I’m currently trying to migrate my config to the Treesitter main branch, but I’m running into a lot of issues, e.g. I can’t even get some simple things working, like Python highlighting.

ray-x avatar Sep 28 '25 22:09 ray-x

Yeah my branch isn't perfect im noticing a few issues as im working so wouldn't recommend merge just yet, i mean best thing i got is that some of the GO commands are working for me an i am able to run some tests which is perfect.

Feel free to review the code so i can update it.

Is your treesitter-main branch the one your working on? Would my changes best be suited for that branch rather than main?

alikazai avatar Sep 29 '25 00:09 alikazai

Yes, I am working on treesitter-main branch ATM. I have a feeling that the treesitter/master branch will stay as the default treesitter branch for a few months

ray-x avatar Sep 29 '25 00:09 ray-x

LazyVim had migrated to treesitter-main 😢 .

s-bespalov avatar Sep 30 '25 10:09 s-bespalov

ray-x wrote in E5108 when running goRun, or GoBuild #596:

Assuming you're on the treesitter-main branch, I've pushed a fix to guihua.lua. Please pull the changes and let me know if this > resolves the issue. We can track any remaining issues related to the treesitter-main branch here: #576.

Check fix in guihua.lua on Windows host installed fresh Neovim with LazyVim from folke. Issue reproduced, see logs of checkhealth go plugin and GoRun / GoBuild bellow:

Lazy.nvim version 11.17.2
- version: Windows 10 Pro
- machine: x86_64
- sysname: Windows_NT
- release: 10.0.19045

nvim-treesitter:

- ✅ OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13).
- ✅ OK tree-sitter-cli 0.25.10 (C:\Users\*********\AppData\Local\nvim-tools\tree-siiter\tree-sitter.EXE)
- ✅ OK node 22.20.0 (C:\Program Files\nodejs\node.EXE)
- ✅ OK tar 3.5.2 (C:\WINDOWS\system32\tar.EXE)
- ✅ OK curl 8.9.1 (C:\WINDOWS\system32\curl.EXE)
  curl 8.9.1 (Windows) libcurl/8.9.1 Schannel zlib/1.3 WinIDN
  Release-Date: 2024-07-31
  Protocols: dict file ftp ftps http https imap imaps ipfs ipns mqtt pop3 pop3s smb smbs smtp smtps telnet tftp
  Features: alt-svc AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets

Install directory for parsers and queries ~
- C:/Users/*********/AppData/Local/nvim-data/site/
- ✅ OK is writable.
- ✅ OK is in runtimepath.

Installed languages     H L F I J ~
- bash                  ✓ ✓ ✓ . ✓
- c                     ✓ ✓ ✓ ✓ ✓
- cmake                 ✓ . ✓ ✓ ✓
- comment               ✓ . . . .
- cpp                   ✓ ✓ ✓ ✓ ✓
- diff                  ✓ . ✓ . ✓
- dockerfile            ✓ . . . ✓
- dot                   ✓ . ✓ ✓ ✓
- dtd                   ✓ ✓ ✓ . ✓
- ecma
- elm                   ✓ . ✓ . ✓
- git_config            ✓ . ✓ . ✓
- git_rebase            ✓ . . . ✓
- gitattributes         ✓ ✓ . . ✓
- gitignore             ✓ . . . ✓
- go                    ✓ ✓ ✓ ✓ ✓
- goctl                 ✓ . ✓ ✓ ✓
- gomod                 ✓ . . . ✓
- gosum                 ✓ . . . .
- gotmpl                ✓ ✓ ✓ . ✓
- gowork                ✓ . . . ✓
- html                  ✓ ✓ ✓ ✓ ✓
- html_tags
- http                  ✓ . ✓ . ✓
- javascript            ✓ ✓ ✓ ✓ ✓
- jsdoc                 ✓ . . . .
- json                  ✓ ✓ ✓ ✓ .
- json5                 ✓ . . . ✓
- jsonc                 ✓ ✓ ✓ ✓ ✓
- jsx
- llvm                  ✓ . . . ✓
- lua                   ✓ ✓ ✓ ✓ ✓
- luadoc                ✓ . . . .
- luap                  ✓ . . . .
- markdown              ✓ . ✓ ✓ ✓
- markdown_inline       ✓ . . . ✓
- printf                ✓ . . . .
- python                ✓ ✓ ✓ ✓ ✓
- query                 ✓ ✓ ✓ ✓ ✓
- regex                 ✓ . . . .
- rst                   ✓ ✓ . . ✓
- sql                   ✓ . ✓ ✓ ✓
- toml                  ✓ ✓ ✓ ✓ ✓
- tsx                   ✓ ✓ ✓ ✓ ✓
- typescript            ✓ ✓ ✓ ✓ ✓
- vim                   ✓ ✓ ✓ . ✓
- vimdoc                ✓ . . . ✓
- xml                   ✓ ✓ ✓ ✓ ✓
- yaml                  ✓ ✓ ✓ ✓ ✓
  Legend: H[ighlights], L[ocals], F[olds], I[ndents], In[J]ections ~

Go Plugin Check

- ✅ OK lspconfig: plugin is installed
- ✅ OK nvim-treesitter: plugin is installed
- ✅ OK guihua: plugin is installed
- ⚠️ WARNING nvim-dap-virtual-text: not installed/loaded
- ⚠️ WARNING telescope: not installed/loaded
- ❌ ERROR Failed to run healthcheck for "go" plugin. Exception:
  ...G/AppData/Local/nvim-data/lazy/go.nvim/lua/go/health.lua:151: module 'nvim-treesitter.info' not found:
  	no field package.preload['nvim-treesitter.info']
  	cache_loader: module 'nvim-treesitter.info' not found
  	cache_loader_lib: module 'nvim-treesitter.info' not found
  	no file 'C:\Program Files (x86)\LuaRocks\lua\nvim-treesitter\info.lua'
  	no file 'C:\Program Files (x86)\LuaRocks\lua\nvim-treesitter\info\init.lua'
  	no file 'C:\Program Files (x86)\LuaRocks\systree\lib\lua\5.1\nvim-treesitter\info.dll'
  	no file 'C:/Users/*********/AppData/Local/nvim-data/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/libnvim-treesitter\info.dll'
  	no file 'C:/Users/*********/AppData/Local/nvim-data/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/nvim-treesitter\info.dll'
  	no file 'C:\Program Files (x86)\LuaRocks\systree\lib\lua\5.1\nvim-treesitter.dll'
  	no file 'C:/Users/*********/AppData/Local/nvim-data/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/libnvim-treesitter.dll'
  	no file 'C:/Users/*********/AppData/Local/nvim-data/lazy/blink.cmp/lua/blink/cmp/fuzzy/rust/../../../../../target/release/nvim-treesitter.dll'

GoRun

  Error  10:00:45 msg_show.lua_error E5108: Error executing lua ...Data/Local/nvim-data/lazy/guihua.lua/lua/guihua/util.lua:251: attempt to call field 'attach' (a nil value)
stack traceback:
	...Data/Local/nvim-data/lazy/guihua.lua/lua/guihua/util.lua:251: in function 'highlighter'
	...ta/Local/nvim-data/lazy/guihua.lua/lua/guihua/sprite.lua:126: in function 'initialize'
	...Data/Local/nvim-data/lazy/guihua.lua/lua/middleclass.lua:181: in function 'new'
	...ppData/Local/nvim-data/lazy/go.nvim/lua/go/asyncmake.lua:210: in function 'make'
	[string ":lua"]:1: in main chunk

GoBuild

  Error  10:02:13 msg_show.lua_error E5108: Error executing lua ...Data/Local/nvim-data/lazy/guihua.lua/lua/guihua/util.lua:251: attempt to call field 'attach' (a nil value)
stack traceback:
	...Data/Local/nvim-data/lazy/guihua.lua/lua/guihua/util.lua:251: in function 'highlighter'
	...ta/Local/nvim-data/lazy/guihua.lua/lua/guihua/sprite.lua:126: in function 'initialize'
	...Data/Local/nvim-data/lazy/guihua.lua/lua/middleclass.lua:181: in function 'new'
	...ppData/Local/nvim-data/lazy/go.nvim/lua/go/asyncmake.lua:210: in function 'make'
	[string ":lua"]:1: in main chunk

Vadim-Maklakov avatar Oct 27 '25 07:10 Vadim-Maklakov

I am having the exact same issues as the person above. I am on omarchy linux.

ezraclintoc avatar Oct 27 '25 20:10 ezraclintoc