vimPlugins.nvim-treesitter-legacy: init#472119
Conversation
d431053 to
82b9814
Compare
There was a problem hiding this comment.
After trying to use #470883, it is clear to me that migrating is not easy.
I'm curious what parts you use that are not clear from their README. I created nix-community/nixvim#4084 in nixvim for migrating from master to main and it seemed pretty straight forward for the base functionality. Some things used to be handled by the plugin have been upstreamed to neovim and just require you to do outside of the plugin config table for starting the highlighting/indenting/etc. I did not have a very big treesitter config though so didn't need to mess with much.
I do know there are FEATURES that are missing with the rewrite, though... like incremental selection and treesitter-refactor plugins because of the API changes.
Reading through some of the removed functionality and the "work in progress" on ancillary projects that depended on the current "master" API does make this have value, though.
I propose deprecating nvim-treesitter-legacy right before 26.04, then dropping it after 26.11, together with all non-updated plugins.
What does "non-updated plugins" mean ? There are many plugins that don't need to keep pushing new versions because they are API stable and "just work".
I am not sure whether we want to keep updating grammars for the legacy version, or not touch that directory at all.
No, this should be a frozen in time thing like upstream is treating it, imo.
pkgs/applications/editors/vim/plugins/nvim-treesitter-legacy/overrides.nix
Outdated
Show resolved
Hide resolved
| demicolon-nvim = super.demicolon-nvim.overrideAttrs (old: { | ||
| dependencies = with self; [ | ||
| nvim-treesitter | ||
| nvim-treesitter-legacy |
There was a problem hiding this comment.
mawkler/demicolon.nvim#14 seems to imply that this plugin works with main branch
| luasnip | ||
| null-ls-nvim | ||
| nvim-treesitter | ||
| nvim-treesitter-legacy |
There was a problem hiding this comment.
ray-x/go.nvim#592 implies it is tested/works with main now.
|
|
||
| intellitab-nvim = super.intellitab-nvim.overrideAttrs { | ||
| dependencies = [ self.nvim-treesitter ]; | ||
| dependencies = [ self.nvim-treesitter-legacy ]; |
There was a problem hiding this comment.
Only uses get_indent from nvim-treesitter https://github.com/pta2002/intellitab.nvim/blob/main/lua/intellitab/init.lua#L29-L31 and that exists on main https://github.com/nvim-treesitter/nvim-treesitter/blob/4fc09bee78e91bf4ba471cdab4bf9dfa37fde51c/lua/nvim-treesitter/indent.lua#L112
| @@ -1563,8 +1563,8 @@ | |||
|
|
|||
| kulala-nvim = super.kulala-nvim.overrideAttrs { | |||
There was a problem hiding this comment.
This one is actually depending on a migration mistweaverco/kulala.nvim#790 https://github.com/mistweaverco/kulala.nvim/blob/9fc4831a116fb32b0fd420ed483f5102a873446a/lua/kulala/config/init.lua#L49
| dependencies = with self; [ | ||
| leap-nvim | ||
| nvim-treesitter | ||
| nvim-treesitter-legacy |
There was a problem hiding this comment.
https://github.com/ggandor/leap-ast.nvim hasn't been updated in 3 years and isn't compatible (ts_utils doesn't exist in main)
Requirements
Neovim >= 0.7.0 [leap.nvim](https://github.com/ggandor/leap.nvim) [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) (This dependency is only temporary; it will not be necessary in the future.)
There was a problem hiding this comment.
Might be best, it doesn't look active (could be because it used to work well for its purpose) and if they haven't updated to the new api by now, people might not be using it anymore / maintaining it.
|
|
||
| markid = super.markid.overrideAttrs { | ||
| dependencies = [ self.nvim-treesitter ]; | ||
| dependencies = [ self.nvim-treesitter-legacy ]; |
There was a problem hiding this comment.
I think the configs table is missing in main https://github.com/David-Kunz/markid/blob/9b249e4d2ad0767a1091017cd52264590e41a274/lua/markid.lua#L2-L3 so this might need update. Hasn't been updated in 2 years though
| nvim-nio | ||
| nvim-dap-go | ||
| nvim-treesitter | ||
| nvim-treesitter-legacy |
There was a problem hiding this comment.
This plugin was already updated to support main branch https://github.com/fredrikaverpil/neotest-golang/blob/37e400cfe9d193e508b1a512e96cbef83b08deb6/README.md?plain=1#L9-L13
| nvim-lspconfig | ||
| telescope-nvim | ||
| nvim-treesitter | ||
| nvim-treesitter-legacy |
There was a problem hiding this comment.
This is still in process of migrating to main NvChad/NvChad#3313
| nvim-biscuits = super.nvim-biscuits.overrideAttrs { | ||
| dependencies = with self; [ | ||
| nvim-treesitter | ||
| nvim-treesitter-legacy |
There was a problem hiding this comment.
This plugin has NOT been updated to work with new API.
|
|
||
| nvim-FeMaco-lua = super.nvim-FeMaco-lua.overrideAttrs { | ||
| dependencies = [ self.nvim-treesitter ]; | ||
| dependencies = [ self.nvim-treesitter-legacy ]; |
There was a problem hiding this comment.
This plugin has NOT been updated to work with new API.
|
We should really merge this as soon as possible, otherwise we break 12 out of 19 plugins that depend on nvim-treesitter (12 plugins still depend on the master branch, others are updated) |
|
I really want to see this getting pushed forward, as my whole nvim config is now broken since nvf doesn't support the new treesitter yet and i did some upsis and now its pretty hard for me to just rollback :/ So i trusted the commit comment and tried to override it, just to notice that the legacy package is not there yet. Thanks in advance and hope you had a good start into the new year! :) |
| @@ -0,0 +1,13 @@ | |||
| { vimUtils, fetchFromGitHub }: | |||
| vimUtils.buildVimPlugin { | |||
There was a problem hiding this comment.
issue: nvim-treesitter-legacy has lots of queries in its runtimepath.
They will conflict with the nvim-treesitter main queries.
As the current most common use case is for people to pull in nvim-treesitter-legacy as a dependency of another plugin, this can break things in subtle ways that may be difficult to troubleshoot.
We should probably remove the queries from nvim-treesitter-legacy and make them opt-in.
There was a problem hiding this comment.
There is a check if two different versions of nvim-treesitter are installed
31d10c1
Also, even if someone tries to install a plugin with a parser from nvim-treesitter main, but has nvim-treesitter.withAllPlugins, the parsers should still be compatible, as we used the list of those from main branch long before release
There was a problem hiding this comment.
The queries and parsers are now decoupled. What if someone wants to install the parsers and queries without nvim-treesitter?
the parsers should still be compatible, as we used the list of those from main branch long before release
You mean the main parsers should still be compatible with the nvim-treesitter-legacy queries?
That's not going to be guaranteed for future updates. The nvim-treesitter-legacy queries are frozen, the parsers aren't.
There was a problem hiding this comment.
Well, I can remove old parsers and only use the new ones, which should solve compatibility issues. But this minor use case should not block this PR. Currently, most of the plugins that use nvim-treesitter are broken. I can create a follow-up PR, but I do not want to change this, so no one has to re-review it.
There was a problem hiding this comment.
Checking if the user has duplicated queries from the main and master branches is impossible because we symlinkJoin those. So the only solution would be to get rid of both old queries and parsers
Deleting one of those doesn't really make sense because, as you said
That's not going to be guaranteed for future updates. The nvim-treesitter-legacy queries are frozen, the parsers aren't.
There was a problem hiding this comment.
So the only solution would be to get rid of both old queries and parsers
That's what I'm proposing (and yes, it's fine if we do this in a follow-up PR).
The only reason configs are breaking is because plugins rely on the old module API, which is Lua and should have no compatibility issues with the new queries or parsers (unless, the capture names for indents, etc. change, which I think is unlikely to happen anytime soon).
Long term, we should aim to fix upstream plugins that depend on nvim-treesitter-legacy to depend on treesitter-modules.nvim instead.
Update:Ah it appears that I need to switch: - require('nvim-treesitter.configs').setup { highlight = { enable = true } }
+ require('nvim-treesitter').setup { highlight = { enable = true } }As described in: nvim-treesitter/nvim-treesitter#7901 (comment). At least I don't get an error at startup now, I haven't done any further testing. PS: Maybe also relevant: nvim-lua/kickstart.nvim#1732 (comment)? Sorry for intruding your pull request, I started getting: Is this related? I've read something about migrations, but I'm not sure what I would need to change. My config for treesitter is just: {
plugin = nvim-treesitter.withAllGrammars;
type = "lua";
config = ''
require('nvim-treesitter.configs').setup { highlight = { enable = true } }
'';
} |
|
@Elias-Graf, this is because nvim-treesitter was entirely rewritten, and we recently switched to the new version. This is not a bug. But in the future, please open an issue instead |
The new main branch breaks many plugins.
Flake lock file updates:
• Added input 'nixpkgs-patch-0-nvim-treesitter-main':
'NixOS/nixpkgs#470883'
• Added input 'nixpkgs-patch-nvim-treesitter-legacy':
'NixOS/nixpkgs#472119'
Flake lock file updates:
• Updated input 'dwm-gep':
'git+https://git.tchfoo.com/gepbird/dwm?ref=refs/heads/rice&rev=5a6862a0247710fb9fa831190571bcf871c5d227' (2025-12-24)
→ 'git+https://git.tchfoo.com/gepbird/dwm?ref=refs/heads/rice&rev=2262a557f86319a559d3b9a799dbb02d5ff4a2c2' (2026-01-04)
• Updated input 'home-manager':
'github:nix-community/home-manager/7a7b43c7231a439d248179ba8d561dd6cd81799b' (2025-12-29)
→ 'github:nix-community/home-manager/1cfa305fba94468f665de1bd1b62dddf2e0cb012' (2026-01-03)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/c0b0e0fddf73fd517c3471e546c0df87a42d53f4' (2025-12-28)
→ 'github:NixOS/nixpkgs/fb7944c166a3b630f177938e478f0378e64ce108' (2026-01-02)
• Added input 'nixpkgs-patch-grayjay-fix-build':
'NixOS/nixpkgs#475903'
• Added input 'nixpkgs-patch-nvim-treesitter-legacy':
'NixOS/nixpkgs#472119'
• Updated input 'nur':
'github:nix-community/NUR/1f8c02a96c58c0dd90f2de45440b9ef01571abc3' (2025-12-29)
→ 'github:nix-community/NUR/ed59c24d452493c9c0d3d297c1b6c0412d353b4c' (2026-01-03)
• Updated input 'nvim-gep':
'git+https://git.tchfoo.com/gepbird/nvim?ref=refs/heads/main&rev=5a0910846c385ba01566f8fddd64d2918188f33b' (2025-12-24)
→ 'git+https://git.tchfoo.com/gepbird/nvim?ref=refs/heads/main&rev=c00a8b55a2608a200bbdbd4e7449f428fcf71966' (2026-01-03)
• Updated input 'nvim-gep/neovim-nightly':
'github:nix-community/neovim-nightly-overlay/14a21b492d6acd79495b14c9d127a94b77c0b72c' (2025-12-24)
→ 'github:nix-community/neovim-nightly-overlay/519c66e44d81e2a752759d60320dbd6f06c14437' (2026-01-03)
• Updated input 'nvim-gep/neovim-nightly/neovim-src':
'github:neovim/neovim/1aa26f5d55550dd12c2cfd0f74618f0dcd6467ec' (2025-12-23)
→ 'github:neovim/neovim/067b5743f543798f4e58003816fc930f4106c2b0' (2026-01-02)
• Added input 'nvim-gep/nixpkgs-patch-nvim-treesitter-legacy':
follows 'nixpkgs-patch-nvim-treesitter-legacy'
• Added input 'nvim-gep/nixpkgs-patcher':
follows ''
• Updated input 'nvim-gep/nixvim':
'github:nix-community/nixvim/1787eeda5a2ce35bcd57dbb482718b0d897786ae' (2025-12-22)
→ 'github:nix-community/nixvim/d61584cc4cac9af1ba74ad235992df575391276d' (2026-01-02)
• Updated input 'nvim-gep/nvim-treesitter-textobjects':
'github:nvim-treesitter/nvim-treesitter-textobjects/f7122acf1bd2c9e4626651ad33bf5944be9d9392' (2025-12-24)
→ 'github:nvim-treesitter/nvim-treesitter-textobjects/28a3494c075ef0f353314f627546537e43c09592' (2026-01-03)
• Updated input 'treefmt-nix':
'github:numtide/treefmt-nix/42d96e75aa56a3f70cab7e7dc4a32868db28e8fd' (2025-12-17)
→ 'github:numtide/treefmt-nix/d56486eb9493ad9c4777c65932618e9c2d0468fc' (2026-01-03)
Flake lock file updates:
• Updated input 'gep-dotfiles':
'git+https://git.tchfoo.com/gepbird/dotfiles?ref=refs/heads/main&rev=b76c0c3a0f2433a32d4d3279b0b8ef0afbfe3827' (2025-12-29)
→ 'git+https://git.tchfoo.com/gepbird/dotfiles?ref=refs/heads/main&rev=ae28d5d6da1c3a1e880da578b2e3cfb2722710f2' (2026-01-04)
• Added input 'gep-dotfiles/nixpkgs-patch-grayjay-fix-build':
'NixOS/nixpkgs#475903'
• Added input 'gep-dotfiles/nixpkgs-patch-nvim-treesitter-legacy':
follows 'nixpkgs-patch-nvim-treesitter-legacy'
• Updated input 'gep-dotfiles/nvim-gep':
'git+https://git.tchfoo.com/gepbird/nvim?ref=refs/heads/main&rev=5a0910846c385ba01566f8fddd64d2918188f33b' (2025-12-24)
→ 'git+https://git.tchfoo.com/gepbird/nvim?ref=refs/heads/main&rev=c00a8b55a2608a200bbdbd4e7449f428fcf71966' (2026-01-03)
• Updated input 'gep-dotfiles/nvim-gep/neovim-nightly':
'github:nix-community/neovim-nightly-overlay/14a21b492d6acd79495b14c9d127a94b77c0b72c' (2025-12-24)
→ 'github:nix-community/neovim-nightly-overlay/519c66e44d81e2a752759d60320dbd6f06c14437' (2026-01-03)
• Updated input 'gep-dotfiles/nvim-gep/neovim-nightly/neovim-src':
'github:neovim/neovim/1aa26f5d55550dd12c2cfd0f74618f0dcd6467ec' (2025-12-23)
→ 'github:neovim/neovim/067b5743f543798f4e58003816fc930f4106c2b0' (2026-01-02)
• Added input 'gep-dotfiles/nvim-gep/nixpkgs-patch-nvim-treesitter-legacy':
follows 'gep-dotfiles/nixpkgs-patch-nvim-treesitter-legacy'
• Added input 'gep-dotfiles/nvim-gep/nixpkgs-patcher':
follows 'gep-dotfiles'
• Updated input 'gep-dotfiles/nvim-gep/nixvim':
'github:nix-community/nixvim/1787eeda5a2ce35bcd57dbb482718b0d897786ae' (2025-12-22)
→ 'github:nix-community/nixvim/d61584cc4cac9af1ba74ad235992df575391276d' (2026-01-02)
• Updated input 'gep-dotfiles/nvim-gep/nvim-treesitter-textobjects':
'github:nvim-treesitter/nvim-treesitter-textobjects/f7122acf1bd2c9e4626651ad33bf5944be9d9392' (2025-12-24)
→ 'github:nvim-treesitter/nvim-treesitter-textobjects/28a3494c075ef0f353314f627546537e43c09592' (2026-01-03)
• Updated input 'home-manager':
'github:nix-community/home-manager/e4e78a2cbeaddd07ab7238971b16468cc1d14daf' (2025-12-30)
→ 'github:nix-community/home-manager/1cfa305fba94468f665de1bd1b62dddf2e0cb012' (2026-01-03)
• Updated input 'nixos-hardware':
'github:NixOS/nixos-hardware/9b3c38bf6c260d0e88154ef07fa833fa845bfd14' (2025-12-30)
→ 'github:NixOS/nixos-hardware/40b1a28dce561bea34858287fbb23052c3ee63fe' (2025-12-31)
• Updated input 'nixos-raspberrypi':
'github:nvmd/nixos-raspberrypi/a12cce5710031c44e0e36b581d8e71bc4f157907' (2025-11-26)
→ 'github:nvmd/nixos-raspberrypi/f517fc39419afb6fbec31f9a44de7d41e3a9ad76' (2026-01-02)
• Updated input 'nixos-raspberrypi/flake-compat':
'github:edolstra/flake-compat/f387cd2afec9419c8ee37694406ca490c3f34ee5' (2025-10-27)
→ follows ''
• Updated input 'nixos-raspberrypi/nixpkgs':
'github:nvmd/nixpkgs/59714dfc31ef9b9d78c6d581f12169b6665767f8' (2025-11-25)
→ 'github:nvmd/nixpkgs/31926ce9afb1c915fa4190b77ca9be389ccaf18e' (2026-01-02)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/c0b0e0fddf73fd517c3471e546c0df87a42d53f4' (2025-12-28)
→ 'github:NixOS/nixpkgs/fb7944c166a3b630f177938e478f0378e64ce108' (2026-01-02)
• Added input 'nixpkgs-patch-librechat-fix-build':
'NixOS/nixpkgs#476747'
• Removed input 'nixpkgs-patch-nixos-anubis-fix-eval-warning'
• Updated input 'nixpkgs-patch-nixos-nginx-add-build-time-syntax-validation':
'NixOS/nixpkgs#474858'
→ 'NixOS/nixpkgs#474858'
• Added input 'nixpkgs-patch-nvim-treesitter-legacy':
'NixOS/nixpkgs#472119'
• Updated input 'nur':
'github:nix-community/NUR/572a9dc34f5f0b6b2c460e92185d63c1fdbb8a9c' (2025-12-30)
→ 'github:nix-community/NUR/ed59c24d452493c9c0d3d297c1b6c0412d353b4c' (2026-01-03)
• Updated input 'treefmt-nix':
'github:numtide/treefmt-nix/dec15f37015ac2e774c84d0952d57fcdf169b54d' (2025-12-30)
→ 'github:numtide/treefmt-nix/d56486eb9493ad9c4777c65932618e9c2d0468fc' (2026-01-03)
• Updated input 'ymstnt-dotfiles':
'github:ymstnt/dotfiles/eba522a10a47e00d9e6305a63b12f99e3b2f1175' (2025-12-26)
→ 'github:ymstnt/dotfiles/91c3cd11f9ac27dbd51a20637c5cb57838bcacd4' (2025-12-31)
this has to stay until NixOS/nixpkgs#472119 gets merged, at minimum shoutout michael-c-buckley for the info & assist
This is a straight-up copy of our
nvim-treesitterdirectory. For now, it is identical to the main package, but #470883 will updatevimPlugins.nvim-treesitterto the newer version.After trying to use #470883, it is clear to me that migrating is not easy. There is even no migration guide because of how different those two versions are. Users (and plugins) need more time to update
I propose deprecating nvim-treesitter-legacy right before 26.04, then dropping it after 26.11, together with all non-updated plugins.
I am not sure whether we want to keep updating grammars for the legacy version, or not touch that directory at all.We agreed to keep grammars frozenWarning
This should be merged at the same time as #470883, because the
neovim wrapper: throw if two versions of nvim-treesitter are presentcommit will break everything, when there is no difference between the legacy and new version.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.