nvim-dap-virtual-text
nvim-dap-virtual-text copied to clipboard
Treesitter error when running in kotlin
I am getting the below error when trying to run the plugin with kotlin. Note that the error doesn't appear to be with tree-sitter as it works fine when i remove the nvim-dap-virtual-text plugin.
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:103: no parser for 'kotlin' language, see :help treesitter-parsers stack traceback: [C]: in function 'error' /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:103: in function 'add' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:113: in function 'new' /usr/share/nvim/runtime/lua/vim/treesitter.lua:64: in function '_create_parser' /usr/share/nvim/runtime/lua/vim/treesitter.lua:131: in function 'get_parser' ...-virtual-text/lua/nvim-dap-virtual-text/virtual_text.lua:93: in function 'set_virtual_text' ...lazy/nvim-dap-virtual-text/lua/nvim-dap-virtual-text.lua:112: in function 'c' ....local/share/nvim-lazy/lazy/nvim-dap/lua/dap/session.lua:968: in function <....local/share/nvim-lazy/lazy/nvim-dap/lua/dap/session.lua:962>
nvim-cap-virtual-text.lua
return {
{
"theHamsta/nvim-dap-virtual-text",
config = function()
require("nvim-dap-virtual-text").setup()
end
},
}
treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json", -- add symbols-outline
"kotlin",
},
I am getting the below error when trying to run the plugin with kotlin. Note that the error doesn't appear to be with tree-sitter as it works fine when i remove the nvim-dap-virtual-text plugin.
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:103: no parser for 'kotlin' language, see :help treesitter-parsers stack traceback: [C]: in function 'error' /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:103: in function 'add' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:113: in function 'new' /usr/share/nvim/runtime/lua/vim/treesitter.lua:64: in function '_create_parser' /usr/share/nvim/runtime/lua/vim/treesitter.lua:131: in function 'get_parser' ...-virtual-text/lua/nvim-dap-virtual-text/virtual_text.lua:93: in function 'set_virtual_text' ...lazy/nvim-dap-virtual-text/lua/nvim-dap-virtual-text.lua:112: in function 'c' ....local/share/nvim-lazy/lazy/nvim-dap/lua/dap/session.lua:968: in function <....local/share/nvim-lazy/lazy/nvim-dap/lua/dap/session.lua:962>
nvim-cap-virtual-text.lua
return { { "theHamsta/nvim-dap-virtual-text", config = function() require("nvim-dap-virtual-text").setup() end }, }
treesitter
{ "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "bash", "html", "javascript", "json", -- add symbols-outline "kotlin", },
What is the output of :check health nvim-treesitter
? Are you sure you where using tree-sitter highlighting before on kotlin files? Nvim has a lua function to inspect tokens under cursor(:Inspect
if I remember correctly)
Are you sure you where using tree-sitter highlighting before on kotlin files?
Now that you mention it, my treesitter highlighting appears to have stopped working altogether....
Nvim has a lua function to inspect tokens under cursor(:Inspect if I remember correctly)
sorry i have no idea what you mean (new to neovim). can you please elaborate?
i have tried running the same on go
and getting the same error. below is the healthcheck output on my go file:
==============================================================================
health:
- ERROR No healthcheck found for "health" plugin.
==============================================================================
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.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 = "5.15.0-92-generic",
sysname = "Linux",
version = "#102-Ubuntu SMP Wed Jan 10 09:33:48 UTC 2024"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- diff ✓ . . . .
- html ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- jsdoc ✓ . . . .
- json ✓ ✓ ✓ ✓ .
- jsonc ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- luadoc ✓ . . . .
- luap ✓ . . . .
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- regex ✓ . . . .
- toml ✓ ✓ ✓ ✓ ✓
- tsx ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- 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} ~
@theHamsta You're right, the go
parser wasn't installed. Running :TSInstall go
fixed it. The only issue that i had to imperatively install go this way. do you know what i can add to install decoratively in my plugin.lua files?
Just wanted to chime in, I get this error whenever nvim-dap jumps to an assembly file. I get this error
stack traceback:
[C]: in function 'error'
...t/usr/share/nvim/runtime/lua/vim/treesitter/language.lua:93: in function 'add'
...r/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:98: in function 'new'
...ashfs-root/usr/share/nvim/runtime/lua/vim/treesitter.lua:61: in function '_create_parser'
...ashfs-root/usr/share/nvim/runtime/lua/vim/treesitter.lua:131: in function 'get_parser'
...-virtual-text/lua/nvim-dap-virtual-text/virtual_text.lua:93: in function 'set_virtual_text'
...ndle/nvim-dap-virtual-text/lua/nvim-dap-virtual-text.lua:112: in function 'c'
...ersonal/.config/nvim/bundle/nvim-dap/lua/dap/session.lua:968: in function <...ersonal/.config/nvim/bundle/nvim-dap/lua/dap/session.lua:962>
Error executing vim.schedule lua callback: ...t/usr/share/nvim/runtime/lua/vim/treesitter/language.lua:93: no parser for 'asm' language, see :help treesitter-parsers
My :checkhealth nvim-treesitter
reads all clear
Click to expand
==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- OK `tree-sitter` found 0.20.8 (c4871a26045d5cf6707da51c89e564605630dc99) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v14.21.3 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
- 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 = "3.10.0-1160.11.1.el7.x86_64",
sysname = "Linux",
version = "#1 SMP Fri Dec 18 16:34:56 UTC 2020"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- cpp ✓ ✓ ✓ ✓ ✓
- diff ✓ . . . .
- disassembly ✓ . . . ✓
- html ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- make ✓ . ✓ . ✓
- markdown ✓ . ✓ ✓ ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- ungrammar ✓ ✓ ✓ ✓ ✓
- usd ✓ ✓ ✓ ✓ .
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
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've forked nvim-dap-virtual-text for the time being with this fix, which appears to be working
virtual_text.lua
if vim.treesitter.get_parser and vim.treesitter.language and vim.treesitter.language.get_lang then
lang = vim.treesitter.language.get_lang(vim.bo[buf].ft)
- parser = vim.treesitter.get_parser(buf)
+ if lang ~= nil then
+ parser = vim.treesitter.get_parser(buf)
+ end
I have the same problem with Java when stepping through .class files, I'm not sure what is the problem, since neovim filetype is set to java, but in the snippet from the previous post vim.bo[buf].ft is null. I'm pretty sure this was working before.
It would be interesting if there were a way to disable nvim-dap-virtual-text for certain filetypes, so that when the filetype is null, it won't complain.