-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nvim-treesitter: declarative install of parsers causes errors #189838
Comments
I've commented on nvim-treesitter/nvim-treesitter#3250, meanwhile revert nvim-treesitter to a previous version. |
This is fixed for me by adding |
This seems more like a workaround than a proper fix though. |
Following the instructions in the readme to specify an alternate treesitter plugin installation path worked for me. In
Updated with @vasyharan's fix to add |
Thanks, this worked for me as well. |
Does that solution still pick up your declaratively installed tree sitters? |
Unfortunately no -- I specify my treesitter plugins via Another drawback to this approach is that the treesitter parsers seem to re-install every time I open nvim (not sure if @portothree is seeing this too?) - but this may be a separate treesitter bug. |
I haven't encoutered this, no. Unless this is being done in the background, do you get a message of parsers being downloaded everytime you open nvim? |
This is a workaround for an issue where treesitter expects the install dir to be readable and writable -- it's not happy with now nix is installing it. Unless there's a patch, the fix will be to manually set the install dir to a good location: NixOS/nixpkgs#189838 (comment)
The nvim change is to workaround this: NixOS/nixpkgs#189838
I saw this happen when I didn't append the parser_install_dir to the runtime path. fixed with:
|
I think this no longer happens now, and one can use |
I can confirm that using |
Removing the Lua workarounds and changing from
|
Does not happen in |
Possibly? I had that error on launch earlier. Just now I tried your PR, and now it works even without the PR in my overlay. Not sure what to make of that. 😅 Thank you in any case! |
No problem! I will go ahead and merge that anyways in case it caused the problem |
It never really worked, and always seemed to break. Trying some new things. the biggest functional change seems to be changing `nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)` to `nvim-treesitter.withAllGrammars`. This was foind burried in a github issue [1]. I did not do any research beyond copy and paste. [1]: NixOS/nixpkgs#189838 (comment)
I stumbled on the same issue as OP and tried to solve by doing the two paths that worked here. The first is by using withAllGrammars The second path was by providing an alternative path and using pkgs.vimPlugins.nvim-treesitter. I was able to provide the languages I wanted and they were installed on the first time I started neovim. And executing TSModuleInfo showed them installed. The issue is that I see zero efficient on neovim. I made sure that as part of the settings for the plugin highlight = {enable = true, }. As I said I copied the settings from @jocelynthode I am now not sure if there is some kind of a bug or It is me doing something wrong. |
So deciding if treesitter is active only based of shine colors isn't the best approach, especially when there are other settings/plugins that may effect the color scheme. A better "test" for if treesitter "is working" is to look into something like textobjects(nvim-treesitter-textobjects). A basic test for me(After configuring textobjects) was to try and do visual select a function/inside function and that it is working. |
If you mean manually checking if treesitter is working, there is also |
We already check the queries for nvim-treesitter (not textobjects) which is pretty much equivalent to the table in |
Just to confirm - is |
yes, it can be used like this:
|
It seems to work for all grammars apart from the tree-sitter one itself - |
@ghostbuster91 Can you post the error meesages and the relevant parts of your setup? |
It seems to me that there is nothing specific there but yes, here you go:
lua:
|
@ghostbuster91 this seems like it might be an upstream issue, disabling |
Interesting, disabling |
Having taken a brief look at https://github.com/nvim-treesitter/playground, I'm not aware of any issues for this |
Thanks @figsoda, I will then create one. |
I opened nvim-treesitter/playground#111 to fix this |
@figsoda Thanks, I appreciate it :) |
It never really worked, and always seemed to break. Trying some new things. the biggest functional change seems to be changing `nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)` to `nvim-treesitter.withAllGrammars`. This was foind burried in a github issue [1]. I did not do any research beyond copy and paste. [1]: NixOS/nixpkgs#189838 (comment)
Describe the bug
If I install my treesitter parsers declaratively, e.g. as in https://nixos.wiki/wiki/Tree_sitters with
nvim-treesitter.withPlugins
, starting neovim spawns the following error:Expected behavior
No errors
Additional context
I think this was changed recently upstream in nvim-treesitter. Indeed, the README now stipulates that the parser directory must be RW (although I'm not really sure why, so long as one doesn't use the
:TSInstall/Update/Remove
stuff). Not sure if this error is merely cosmetic or functional (I don't know how to test if treesitter is working properly).Notify maintainers
@teto
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: