ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
2.05k stars 123 forks source link

invalid node type #446

Closed stong1994 closed 5 months ago

stong1994 commented 5 months ago
nvim -v
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

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

After using the go.nvim plugin with LazyVim, I encountered an error when executing 'checkhealth'. The error message is as follows:

The following errors have been detected: ~
- ERROR go(locals): ...im-macos/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 2003 for language go
  go(locals) is concatenated from the following files:
  |    [OK]:"/Users/stong/.local/share/nvim/lazy/nvim-treesitter/queries/go/locals.scm"
  | [ERROR]:"/Users/stong/.local/share/nvim/lazy/go.nvim/after/queries/go/locals.scm", failed to load: ...im-macos/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 109 for language go

I have no idea about this error, any help would be appreciated!

There is my config And the full 'checkhealth' content is:

==============================================================================
conform: require("conform.health").check()

conform.nvim report ~
- Log file: /Users/stong/.local/state/nvim/conform.log
- WARNING fish_indent unavailable: Command not found
- OK gofumpt ready (go)
- OK goimports ready (go)
- OK prettier ready (typescript, handlebars, graphql, markdown.mdx, less, scss, css, vue, javascriptreact, markdown, html, javascript, jsonc, typescriptreact, yaml, json)
- OK shfmt ready (sh)
- OK stylua ready (lua)

==============================================================================
crates: require("crates.health").check()

Checking plugins ~
- OK null-ls.nvim installed

Checking external dependencies ~
- OK curl installed
- OK open installed

==============================================================================
go: require("go.health").check()

Binaries ~
- go installed.
- Tool installed: guru
- Tool installed: callgraph
- Tool installed: gotestsum
- Tool installed: dlv
- Tool installed: gorename
- Tool installed: iferr
- Tool installed: golines
- Tool installed: fillstruct
- Tool installed: gonew
- Tool installed: golangci-lint
- Tool installed: gopls
- Tool installed: goimports
- Tool installed: gofumpt
- Tool installed: json-to-struct
- Tool installed: impl
- Tool installed: gomodifytags
- Tool installed: richgo
- Tool installed: ginkgo
- Tool installed: govulncheck
- Tool installed: fillswitch
- Tool installed: gomvp
- Tool installed: gotests
- Tool installed: go-enum
- Tool installed: mockgen
- sed installed.
- curl installed.
- OK All binaries installed

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
- OK telescope: plugin is installed
- OK nvim-treesitter-go is installed
- OK nvim-dap: plugin is installed
- OK nvim-dap-ui: plugin is installed
- OK All plugin installed
- OK GOROOT is set
- OK GOBIN is set
- OK All environment variables set
- OK GOBIN is in PATH

==============================================================================
lazy: require("lazy.health").check()

lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found
- WARNING {alpha-nvim}: overriding <enabled>
- WARNING {nvim-treesitter-textobjects}: overriding <config>

==============================================================================
lazyvim: require("lazyvim.health").check()

LazyVim ~
- OK Using Neovim >= 0.9.0
- OK `git` is installed
- OK `rg` is installed
- OK `fd` is installed
- OK `lazygit` is installed

==============================================================================
luasnip: require("luasnip.health").check()

luasnip ~
- WARNING             For Variable/Placeholder-transformations, luasnip requires
  the jsregexp library. See `:help |luasnip-lsp-snippets-transformations`| for advice

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-04-11-robust-lounge` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.3 built on darwin20.0.0.`
- OK curl: `curl 7.84.0 (arm64-apple-darwin20.0.0) libcurl/7.84.0 OpenSSL/1.1.1q zlib/1.2.12 libssh2/1.10.0 nghttp2/1.46.0`
- OK gzip: `Apple gzip 428`
- OK gtar: `tar (GNU tar) 1.34`
- OK bash: `GNU bash,版本 5.2.15(1)-release (aarch64-apple-darwin22.1.0)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- OK Go: `go version go1.21.3 darwin/arm64`
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Ruby: `ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin22]`
- OK node: `v18.20.1`
- OK cargo: `cargo 1.76.0 (c84b36747 2024-01-18)`
- OK luarocks: `/opt/homebrew/bin/luarocks 3.9.2`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK java: `openjdk version "19" 2022-09-20`
- OK RubyGem: `3.2.3`
- OK python: `Python 3.9.18`
- OK npm: `10.5.1`
- OK javac: `javac 19`
- OK pip: `pip 23.3.1 from /Users/stong/.local/lib/python3.9/site-packages/pip (python 3.9)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 1. Remaining: 59. Limit: 60. Reset: 五  4/12 02:32:58 2024.
  Install and authenticate via gh-cli to increase rate limit.

==============================================================================
neoconf: require("neoconf.health").check()

neoconf.nvim ~
- OK **treesitter-nvim** is installed
- OK **TreeSitter jsonc** parser is installed
- OK **neodev.nvim** is installed
- OK **lspconfig** is installed
- OK **lspconfig jsonls** is installed
- OK **lspconfig lua_ls** is installed

==============================================================================
noice: require("noice.health").check()

noice.nvim ~
- OK **Neovim** >= 0.8.0
- OK You're using a GUI that should work ok
- OK **vim.go.lazyredraw** is not enabled
- OK **nvim-notify** is installed
- OK **TreeSitter vim** parser is installed
- OK **TreeSitter regex** parser is installed
- OK **TreeSitter lua** parser is installed
- OK **TreeSitter bash** parser is installed
- OK **TreeSitter markdown** parser is installed
- OK **TreeSitter markdown_inline** parser is installed
- OK `vim.notify` is set to **Noice**
- OK `vim.lsp.handlers["textDocument/hover"]` is set to **Noice**
- OK `vim.lsp.handlers["textDocument/signatureHelp"]` is set to **Noice**
- OK `vim.lsp.handlers["window/showMessage"]` is set to **Noice**
- OK `vim.lsp.util.convert_input_to_markdown_lines` is set to **Noice**
- OK `vim.lsp.util.stylize_markdown` is set to **Noice**
- OK `cmp.entry.get_documentation` is set to **Noice**

==============================================================================
null-ls: require("null-ls.health").check()

- OK gomodifytags: the source "gomodifytags" can be ran.
- OK impl: the source "impl" can be ran.
- OK goimports: the command "goimports" is executable.
- OK gofumpt: the command "gofumpt" is executable.
- OK markdownlint: the command "markdownlint" is executable.
- OK prettier: the command "prettier" is executable.
- ERROR fish_indent: the command "fish_indent" is not executable.
- ERROR fish: the command "fish" is not executable.
- OK stylua: the command "stylua" is executable.
- OK shfmt: the command "shfmt" is executable.

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

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /Users/stong/sdk/nvim-macos/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=^H`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $TERM_PROGRAM="iTerm.app"
- $COLORTERM="truecolor"

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

Installation ~
- OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v18.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 15.0.0 (clang-1500.1.0.2.5)
- 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 = "23.1.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:31 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8112"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - diff                ✓ . . . .
  - go                  ✓ x ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - jsdoc               ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - jsonc               ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - luadoc              ✓ . . . .
  - luap                ✓ . . . .
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - regex               ✓ . . . .
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - xml                 ✓ ✓ ✓ ✓ ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

  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} ~

The following errors have been detected: ~
- ERROR go(locals): ...im-macos/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 2003 for language go
  go(locals) is concatenated from the following files:
  |    [OK]:"/Users/stong/.local/share/nvim/lazy/nvim-treesitter/queries/go/locals.scm"
  | [ERROR]:"/Users/stong/.local/share/nvim/lazy/go.nvim/after/queries/go/locals.scm", failed to load: ...im-macos/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 109 for language go

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: pbcopy

Python 3 provider (optional) ~
- pyenv: Path: /opt/homebrew/Cellar/pyenv/2.3.25/libexec/pyenv
- pyenv: Root: /Users/stong/.pyenv
- WARNING No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
- WARNING Could not load Python 3:
  /Users/stong/.pyenv/shims/python3 does not have the "neovim" module.
  python3.12 not found in search path or not executable.
  /opt/homebrew/bin/python3.11 does not have the "neovim" module.
  python3.10 not found in search path or not executable.
  /Users/stong/.pyenv/shims/python3.9 does not have the "neovim" module.
  python3.8 not found in search path or not executable.
  python3.7 not found in search path or not executable.
  /Users/stong/.pyenv/shims/python does not have the "neovim" module.
  - ADVICE:
    - See :help |provider-python| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim
- Executable: Not found

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- Ruby: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin22]
- WARNING `neovim-ruby-host` not found.
  - ADVICE:
    - Run `gem install neovim` to ensure the neovim RubyGem is installed.
    - Run `gem environment` to ensure the gem bin directory is in $PATH.
    - If you are using rvm/rbenv/chruby, try "rehashing".
    - See :help |g:ruby_host_prog| for non-standard gem installations.
    - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim

Node.js provider (optional) ~
- Node.js: v18.20.1
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
  - ADVICE:
    - Run in shell: npm install -g neovim
    - Run in shell (if you use yarn): yarn global add neovim
    - Run in shell (if you use pnpm): pnpm install -g neovim
    - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `notify` ~
- No healthcheck provided

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /Users/stong/.local/state/nvim/lsp.log
- Log size: 56 KB

vim.lsp: Active Clients ~
- jsonls (id=1, root_dir=/Users/stong/.config/nvim)
- null-ls (id=2, root_dir=/Users/stong/.config/nvim)

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: bash       ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/bash.so
- OK Parser: c          ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/c.so
- OK Parser: diff       ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/diff.so
- OK Parser: go         ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/go.so
- OK Parser: html       ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/html.so
- OK Parser: javascript ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/javascript.so
- OK Parser: jsdoc      ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/jsdoc.so
- OK Parser: json       ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/json.so
- OK Parser: jsonc      ABI: 13, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/jsonc.so
- OK Parser: lua        ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so
- OK Parser: luadoc     ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/luadoc.so
- OK Parser: luap       ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/luap.so
- OK Parser: markdown   ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/markdown_inline.so
- OK Parser: python     ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/python.so
- OK Parser: query      ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/query.so
- OK Parser: regex      ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/regex.so
- OK Parser: toml       ABI: 13, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/toml.so
- OK Parser: tsx        ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/tsx.so
- OK Parser: typescript ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/typescript.so
- OK Parser: vim        ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/vimdoc.so
- OK Parser: xml        ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/xml.so
- OK Parser: yaml       ABI: 14, path: /Users/stong/.local/share/nvim/lazy/nvim-treesitter/parser/yaml.so
- OK Parser: c          ABI: 14, path: /Users/stong/sdk/nvim-macos/lib/nvim/parser/c.so
- OK Parser: lua        ABI: 14, path: /Users/stong/sdk/nvim-macos/lib/nvim/parser/lua.so
- OK Parser: query      ABI: 14, path: /Users/stong/sdk/nvim-macos/lib/nvim/parser/query.so
- OK Parser: vim        ABI: 14, path: /Users/stong/sdk/nvim-macos/lib/nvim/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /Users/stong/sdk/nvim-macos/lib/nvim/parser/vimdoc.so

==============================================================================
which-key: require("which-key.health").check()

WhichKey: checking conflicting keymaps ~
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"gc"**
- rhs: ` `
buztard commented 5 months ago

Looks like the cause is a recent update in nvim-treesitter.

stong1994 commented 5 months ago

Looks like the cause is a recent update in nvim-treesitter.

Thank you for sharing the commit. As a newcomer to the project, I'm still getting familiar with everything, so I couldn't fully understand the details mentioned in the commit message. I'll make sure to keep track of this issue as I continue to learn. Thanks once again for your help!"

ray-x commented 5 months ago

Pushed a fix. Would you check if it works for you, please run TSUpdate go as well.

stong1994 commented 5 months ago

Pushed a fix. Would you check if it works for you, please run TSUpdate go as well.

It works, good job!