nvim-treesitter
nvim-treesitter copied to clipboard
Parser doesn't start until re-installed
Describe the bug
When I open a file in NeoVim, treesitter starts but does not highlight code.
Example:
However, after I run :TSInstall javascript, and confirm to re-install the parser, everything works fine:

To Reproduce
nvim test.js- notice the lack of highlighting
Expected behavior
I expect treesitter to automatically highlight my code.
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)
- OK: `node` found v14.17.6 (only needed for :TSInstallFromGrammar)
- OK: `git` executable found.
- OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (Gentoo 11.2.1_p20220115 p4) 11.2.1 20220115
- OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
## Parser/Features H L F I J
- elm ✓ . . . ✓
- beancount x . x . .
- python ✓ ✓ ✓ ✓ ✓
- sparql ✓ ✓ ✓ ✓ ✓
- comment ✓ . . . .
- elvish ✓ . . . ✓
- lua ✓ ✓ ✓ ✓ ✓
- ocaml ✓ ✓ ✓ . ✓
- go ✓ ✓ ✓ ✓ ✓
- haskell ✓ . ✓ . ✓
- glsl ✓ ✓ ✓ ✓ ✓
- fusion ✓ ✓ ✓ ✓ .
- pug ✓ . . . ✓
- ledger ✓ . ✓ ✓ ✓
- markdown ✓ . ✓ . ✓
- clojure ✓ ✓ ✓ . ✓
- supercollider ✓ ✓ ✓ ✓ ✓
- hack ✓ . . . .
- proto ✓ . ✓ . .
- heex ✓ ✓ ✓ ✓ ✓
- m68k ✓ ✓ ✓ . ✓
- typescript ✓ ✓ ✓ ✓ ✓
- wgsl ✓ . ✓ . .
- help ✓ . . . .
- jsonc ✓ ✓ ✓ ✓ ✓
- embedded_template✓ . . . ✓
- jsdoc ✓ . . . .
- cooklang ✓ . . . .
- solidity ✓ . . . .
- dot ✓ . . . ✓
- vala ✓ . . . .
- query ✓ ✓ ✓ ✓ ✓
- norg . . . . .
- cpp ✓ ✓ ✓ ✓ ✓
- bash ✓ ✓ ✓ . ✓
- ocaml_interface✓ ✓ ✓ . ✓
- vue ✓ . ✓ ✓ ✓
- llvm ✓ . . . .
- slint ✓ . . ✓ .
- prisma ✓ . . . .
- latex ✓ . ✓ . ✓
- http ✓ . . . ✓
- make ✓ . . . ✓
- rst ✓ ✓ . . ✓
- css ✓ . ✓ ✓ ✓
- glimmer ✓ . . . .
- erlang ✓ . ✓ . .
- gowork ✓ . . . ✓
- lalrpop ✓ ✓ . . .
- regex ✓ . . . .
- pioasm ✓ . . . ✓
- json5 ✓ . . . ✓
- svelte ✓ . ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- cmake ✓ . ✓ . .
- c ✓ ✓ ✓ ✓ ✓
- fortran ✓ . ✓ ✓ .
- java ✓ ✓ . ✓ ✓
- zig ✓ . ✓ ✓ ✓
- bibtex ✓ . ✓ ✓ .
- rego ✓ . . . ✓
- hjson ✓ ✓ ✓ ✓ ✓
- gomod ✓ . . . ✓
- gleam ✓ ✓ ✓ ✓ ✓
- verilog ✓ ✓ ✓ . ✓
- r ✓ ✓ . ✓ ✓
- org ✓ . . . ✓
- ninja ✓ . ✓ ✓ .
- gdscript ✓ ✓ . ✓ ✓
- yaml ✓ ✓ ✓ ✓ ✓
- astro ✓ ✓ ✓ ✓ ✓
- pascal ✓ ✓ ✓ ✓ ✓
- ql ✓ ✓ . ✓ ✓
- julia ✓ ✓ ✓ ✓ ✓
- fennel ✓ ✓ . . ✓
- dart ✓ ✓ . ✓ ✓
- nix ✓ ✓ ✓ . ✓
- turtle ✓ ✓ ✓ ✓ ✓
- toml ✓ ✓ ✓ ✓ ✓
- tsx ✓ ✓ ✓ ✓ ✓
- scss ✓ . . ✓ .
- javascript ✓ ✓ ✓ ✓ ✓
- yang ✓ . ✓ ✓ .
- hocon ✓ . . . ✓
- surface ✓ . ✓ ✓ ✓
- c_sharp ✓ ✓ ✓ . ✓
- scheme ✓ . ✓ . ✓
- eex ✓ . . . ✓
- elixir ✓ ✓ ✓ ✓ ✓
- cuda ✓ ✓ ✓ ✓ ✓
- commonlisp ✓ ✓ ✓ . .
- fish ✓ ✓ ✓ ✓ ✓
- kotlin ✓ ✓ ✓ . ✓
- ruby ✓ ✓ ✓ ✓ ✓
- todotxt ✓ . . . .
- scala ✓ . ✓ . ✓
- dockerfile ✓ . . . ✓
- rust ✓ ✓ ✓ ✓ ✓
- html ✓ ✓ ✓ ✓ ✓
- perl ✓ . ✓ . .
- tlaplus ✓ ✓ ✓ . ✓
- json ✓ ✓ ✓ ✓ .
- php ✓ ✓ ✓ ✓ ✓
- graphql ✓ . . ✓ ✓
- foam ✓ ✓ ✓ ✓ ✓
- rasi ✓ ✓ ✓ ✓ .
- hcl ✓ . ✓ ✓ ✓
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: beancount(highlights): Failed to load parser: uv_dlopen: /home/ilexite/.local/share/nvim/site/pack/packer/opt/nvim-treesitter/parser/beancount.so: undefined symbol: tree_sitter_beancount_external_scanner_create
beancount(highlights) is concatenated from the following files:
| [ERROR]:"/home/ilexite/.local/share/nvim/site/pack/packer/opt/nvim-treesitter/queries/beancount/highlights.scm", failed to load: Failed to load parser: uv_dlopen: /home/ilexite/.local/share/nvim/site/pack/packer/opt/nvim-treesitter/parser/beancount.so: undefined symbol: tree_sitter_beancount_external_scanner_create
- ERROR: beancount(folds): Failed to load parser: uv_dlopen: /home/ilexite/.local/share/nvim/site/pack/packer/opt/nvim-treesitter/parser/beancount.so: undefined symbol: tree_sitter_beancount_external_scanner_create
beancount(folds) is concatenated from the following files:
| [ERROR]:"/home/ilexite/.local/share/nvim/site/pack/packer/opt/nvim-treesitter/queries/beancount/folds.scm", failed to load: Failed to load parser: uv_dlopen: /home/ilexite/.local/share/nvim/site/pack/packer/opt/nvim-treesitter/parser/beancount.so: undefined symbol: tree_sitter_beancount_external_scanner_create
Output of nvim --version
NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/bin/x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/var/tmp/portage/app-editors/neovim-0.7.0/work/neovim-0.7.0_build/config -I/var/tmp/portage/app-editors/neovim-0.7.0/work/neovim-0.7.0/src -I/usr/include -I/var/tmp/portage/app-editors/neovim-0.7.0/work/neovim-0.7.0_build/src/nvim/auto -I/var/tmp/portage/app-editors/neovim-0.7.0/work/neovim-0.7.0_build/include
Compiled by portage@localhost
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "/etc/vim/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Additional context
No response
Please share your exact nvim-treesitter config. (Also, LuaJIT 2.0.5 is ancient and not really supported.)
Treesitter config:
{
"nvim-treesitter/nvim-treesitter",
event = { "BufRead", "BufNewFile" },
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
use_languagetree = true,
disable = { "org" },
additional_vim_regex_highlighting = { "org" },
},
indent = {
enable = true,
},
})
end,
},
@ilexite you ran :PackerCompile to enable the config = ... function?
Yes, I ran :PackerCompile many times with no success.
I am also getting this error, although oddly only for one language - elixir. I've tried uninstalling and reinstalling nvim-treesitter yet the issue persists.
output of nvim -version --
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az164-457
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/share/nvim"
Run :checkhealth for more info
config --
use { 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
config = "require('config.treesitter')"
}
contents of config.treesitter/init.lua --
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
underline = true,
virtual_text = false,
update_in_insert = true,
}
)
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = "all",
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
auto_install = true,
highlight = {
-- `false` will disable the whole extension
enable = true,
additional_vim_regex_highlighting = false,
},
autotag = {
enable = true
},
rainbow = {
enable = true,
extended_mode = false,
max_file_lines = nil,
},
autopairs = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
indent = {
enable = true
},
textobjects = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["aC"] = "@class.outer",
["iC"] = "@class.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["ae"] = "@block.outer",
["ie"] = "@block.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["is"] = "@statement.inner",
["as"] = "@statement.outer",
["ad"] = "@comment.outer",
["am"] = "@call.outer",
["im"] = "@call.inner"
}
},
}
It was working just a few hours ago, ran :PackerSync: a little bit ago and then the issue started. Confused why it's only happening for one specific language too...
Edit: re-installing it as @ilexite mentioned fixes the issue, but it happens again as soon as i close and re-open neovim
Edit 2: Disregard, figured out it was another plugin causing an issue for me (elixir.nvim)