Closed TSoli closed 5 months ago
It should work within Neovim but it has been a long time since I opened a rasi file. I will try to check the behavior you describe. To be sure, what version of Neovim/nvim-treesitter are you using ?
nvim 0.9.1, nvim-treesitter at this commit, tree-sitter cli 0.20.8 (d4c1bf7ce78051b7f4a381d1508d68928512ed5f)
EDIT: Just tried updating nvim-treesitter and still nothing. Guess I could try updating neovim and see...
I'll not be home before Friday so I will not be able to test this right now. I will check the recent breaking changes on nvim-treesitter part in case I missed something. If you open the treesitter playground in a rasi file, is there anything ?
I get the following error when I run :InspectTree
Error executing Lua callback: ...usr/share/nvim/runtime/lua/vim/treesitter/playground.lua:241: No parser available for the given buffer
stack traceback:
[C]: in function 'assert'
...usr/share/nvim/runtime/lua/vim/treesitter/playground.lua:241: in function 'inspect_tree'
...nvimOBWTPk/usr/share/nvim/runtime/lua/vim/treesitter.lua:496: in function 'inspect_tree'
....mount_nvimOBWTPk/usr/share/nvim/runtime/plugin/nvim.lua:18: in function <....mount_nvimOBWTPk/usr/share/nvim/runtime/plugin/nvim.lua:9>
which is strange since when I do :TSInstallInfo
it shows that the rasi parser is installed. The file I have open has extension .rasi as well so I am not sure what else to try?
Have you tried uninstalling the parser and re-installing
TSInstall rasi
Did you modify the definition of the rasi parser in your config ? Otherwise I can't see anything rn
Did you modify the definition of the rasi parser in your config ? Otherwise I can't see anything rn
Yes I have tried that. No luck. Do you mean you can't reproduce?
Nop just that until I am able to try I have no more idea
Sorry for this delay. I don't use rofi anymore so it is no more usual for me to open a rasi file and I have a tendency to only think about your issue when I don't have access to my PC. I will set a reminder for tomorrow. Hopefully I will think about it
Sorry for this delay. I don't use rofi anymore so it is no more usual for me to open a rasi file and I have a tendency to only think about your issue when I don't have access to my PC. I will set a reminder for tomorrow. Hopefully I will think about it
That's ok! I appreciate your work regardless. They're only config files that I don't touch too often so it's not the end of the world haha.
Hi, I finally thought to test this. At least right now, I have highlighting. I am on nvim v0.10.0-dev-1492+g3ca967387
so not the same version as you however.
Have you installed the simpler rasi.vim extension ? (don't know if this could cause issue.
In your tree-sitter config, have you additional_vim_regex_highlighting
set to false ? I know I had issue with this enabled.
I had a strange behavior, like if queries were cached and did not update after updating the plugin. I modified the highlight.scm
query file and the highlight updated properly
Did you also tried TSInstallFromGrammar rasi
?
Hi sorry for the delayed response. I do not have the rasi.vim extension installed. I have not set the additional_vim_syntax_highlighting
option in treesitter and I believe the default is false
. TSInstallFromGrammar rasi
did not work either.
Ok thats very strange. Maybe if you use a "dev" setup ? Can you
cd /path/to/this/repo
rm -r src
tree-sitter generate
ln -fs "$PWD/queries/" ~/.config/nvim/queries/rasi
tree-sitter.setup()
, add
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.rasi = {
install_info = {
url = 'path/to/this/repo',
files = {'src/parser.c'},
}
}
See if it works. 🤷♂️
Still not working with that either unfortunately. I am not sure if it is supposed to show as installed when I do TSInstallInfo
with thi setup but it does not. I am wondering if it may have something to do with how I load nvim-treesitter
then? At the moment I have it with event = BufReadPre
. Hasn't caused an issue with any other parsers but I can't think of what could be the issue. What do you use?
Currently using lazy.nvim, this is my config for treesitter
local function disable_for_large_files(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end
local ensure_installed = {
'c',
'cpp',
'rust',
'css',
'vim',
'lua',
'query',
'regex',
'bash',
'markdown',
'markdown_inline',
}
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.rasi = {
install_info = {
url = '~/dev/tree-sitter-rasi/',
files = {'src/parser.c'},
}
}
return {
'nvim-treesitter/nvim-treesitter',
version = false,
build = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
end,
event = 'BufReadPost',
opts = {
auto_install = true,
ensure_installed = ensure_installed,
indent = { enable = true },
-- Highlights
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = disable_for_large_files,
},
-- Playground
playground = {
enable = true,
disable = disable_for_large_files,
},
query_linter = { enable = true },
},
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
end,
dependencies = { 'nvim-treesitter/playground' },
}
@TSoli are you still facing the issue ?
Fwiw I am facing this issue still.
@TSoli are you still facing the issue ?
Yes unfortunately.
Fwiw I am facing this issue still.
Do you get the same error as I did when you run :InspectTree
?
I don't know if it matters but I am on Linux Mint 21.3 (which is based on Ubuntu 22.04). I only think to mention it since I assume a lot of people running WMs with rofi are probably on Arch or something else?
I don't get any errors with neither InspectTree
nor TSPlaygroundToggle
I don't see how the distro could influence this but yes I am running arch at home, but I used to use Debian 10 at work and TS was working well.
Can you send the file you've tried to open ?
Hey guys did the problem solved? I meet the same problem too... my neovim is v0.9.5 And my problem like this...
Error executing Lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/playground.lua:246: No parser available for the given buffer
stack traceback:
[C]: in function 'assert'
/usr/share/nvim/runtime/lua/vim/treesitter/playground.lua:246: in function 'inspect_tree'
/usr/share/nvim/runtime/lua/vim/treesitter.lua:497: in function 'inspect_tree'
/usr/share/nvim/runtime/plugin/nvim.lua:18: in function </usr/share/nvim/runtime/plugin/nvim.lua:9>
I'm a arch user and use rofi too...
Nope sorry, I have no idea where the issue is. Just in case, can you check what happens if you open a file in the examples ?
And also the output of :checkhealth nvim_treesitter
I run InspectTree
and then I got the following...
Error executing Lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/playground.lua:246: No parser available for the given buffer
stack traceback:
[C]: in function 'assert'
/usr/share/nvim/runtime/lua/vim/treesitter/playground.lua:246: in function 'inspect_tree'
/usr/share/nvim/runtime/lua/vim/treesitter.lua:497: in function 'inspect_tree'
/usr/share/nvim/runtime/plugin/nvim.lua:18: in function </usr/share/nvim/runtime/plugin/nvim.lua:9>
I notice "No parser available" so I run "TSInstall rasi" again and my config is
require'nvim-treesitter.configs'.setup({
ensure_installed = {
-- dev
"c", "cpp",
-- build
"cmake", "make", "dockerfile",
-- script
"lua", "bash", "python",
-- web
"javascript", "html", "css",
-- data
"sql", "proto", "textproto", "json", "json5", "yaml", "toml", "rasi",
-- other
"gitignore", "vim", "vimdoc", "query"
},
highlight = { enable = true },
indent = { enable = true },
})
but still got the errorNo parser available
so I run checkhealth nvim-treesitter
and then I got the following...
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 v18.18.2 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (GCC) 13.2.1 20240417
- 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.9-zen1-1-zen",
sysname = "Linux",
version = "#1 ZEN SMP PREEMPT_DYNAMIC Thu, 02 May 2024 17:48:53 +0000"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- cmake ✓ . ✓ ✓ .
- cpp ✓ ✓ ✓ ✓ ✓
- css ✓ . ✓ ✓ ✓
- dockerfile ✓ . . . ✓
- gitignore ✓ . . . .
- html ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- json5 ✓ . . . ✓
- lua ✓ ✓ ✓ ✓ ✓
- make ✓ . ✓ . ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- proto ✓ . ✓ . .
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- rasi ✓ ✓ ✓ ✓ ✓
- sql ✓ . . ✓ ✓
- textproto ✓ . ✓ ✓ .
- toml ✓ ✓ ✓ ✓ ✓
- 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} ~
@TSoli I have probably found the issue :sweat:
rasi
is not a recognized file extension by Neovim by default. You have to add it yourself, otherwise Neovim doesn't know it is a rasi
file, so it doesn't try to parse it with the corresponding parser.
Probably the easiest fix is to put this somewhere in your config
vim.filetype.add {
extension = {
rasi = 'rasi',
},
}
The correct fix would be to add this filetype in Neovim itself. I might try to do this at some point but if you're willing to try
The reason it was working for me was because I also had the rasi.vim plugin installed, which added the rasi filetype.
@GraysonnG @dty2 This was probably your issue too
Once https://github.com/vim/vim/pull/14821 is merged, I will try to add it in neovim as well
@TSoli I have probably found the issue 😓
rasi
is not a recognized file extension by Neovim by default. You have to add it yourself, otherwise Neovim doesn't know it is arasi
file, so it doesn't try to parse it with the corresponding parser. Probably the easiest fix is to put this somewhere in your configvim.filetype.add { extension = { rasi = 'rasi', }, }
The correct fix would be to add this filetype in Neovim itself. I might try to do this at some point but if you're willing to try
The reason it was working for me was because I also had the rasi.vim plugin installed, which added the rasi filetype.
Great! This seems to work for me. Thanks very much for your efforts in tracking this down.
Rasi filetype support has been added in vim (https://github.com/vim/vim/commit/280e5b13ca568ed592a894140bf1ac74356f4b33) and neovim (https://github.com/neovim/neovim/commit/07af492f635c51d44d02d8012611cc5e11a4af19)
Hi I have installed the parser using nvim-treesitter however I am getting no highlighting or anything in rasi files. The text is completely white, there is no auto indent or anything. Not sure if this is a problem with the nvim-treesitter plugin or the parser but thought I should try here first since it's more specific.