I’ve been using neovim for editing .go files for the past couple of weeks without any issues, but after I’ve installed ubuntu’s software updates (I am using Ubuntu 22.04.4 LTS if that matters), now as soon as I open any file with .go extension and try to type import "
it bombards me with the following error:
Error in decoration provider treesitter/highlighter.line:
Error executing lua: ...nvim-treesitter/lua/nvim-treesitter/query_predicates.lua:80: attempt to call method 'parent' (a nil value)
stack traceback:
...nvim-treesitter/lua/nvim-treesitter/query_predicates.lua:80: in function 'handler'
/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:758: in function 'fn'
/usr/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'match_preds'
/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:874: in function 'iter'
/usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:313: in function 'fn'
/usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:213: in function 'for_each_highlight_state'
/usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:294: in function 'on_line_impl'
/usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:370: in function </usr/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:364>
Running :TSUpdate go
, did not fix the issue.
:checkhealth treesitter
shows that everything is okay:
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v20.14.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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.8.0-40-generic",
sysname = "Linux",
version = "#40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- gitcommit ✓ . . . ✓
- gitignore ✓ . . . ✓
- go ✓ ✓ ✓ ✓ ✓
- gomod ✓ . . . ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- jsonc ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- php ✓ ✓ ✓ ✓ ✓
- proto ✓ . ✓ . ✓
- query ✓ ✓ ✓ ✓ ✓
- 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} ~
I was using Lunarvim and experienced this exact issue. I solved it by removing the nightly version of Neovim (I am running Arch Linux) and replaced it with the stable release