nix-community.nixvim/tests/test-sources/plugins/by-name/treesitter/combine-plugins.nix
Stanislav Asunkin d063d0dd5e plugins/treesitter: don't exclude nvim-treesitter from combining by default
Nvim-treesitter's parsers from nixpkgs don't include grammars anymore.
Originally it was added to standalonePlugins as workaround.
If the user has some other plugin containing treesitter queries, this
change can cause a build failure due to collisions. But since it is
easier to add the plugin to standalonePlugins compared to removing it, I
think this should be the default.
2025-06-02 20:15:06 +03:00

38 lines
1.2 KiB
Nix

{
combine-plugins =
{ config, ... }:
{
performance.combinePlugins.enable = true;
plugins.treesitter = {
enable = true;
# Exclude nixvim injections for test to pass
nixvimInjections = false;
};
extraConfigLuaPost = ''
-- Ensure that queries from nvim-treesitter are first in rtp
local queries_path = "${config.plugins.treesitter.package}/queries"
for name, type in vim.fs.dir(queries_path, {depth = 10}) do
if type == "file" then
-- Get the file from rtp, resolve all symlinks and check
-- that the file is from nvim-treesitter. Only name is compared,
-- because 'combinePlugins' overrides packages.
local rtp_path = assert(
vim.uv.fs_realpath(vim.api.nvim_get_runtime_file("queries/" .. name, false)[1]),
name .. " not found in runtime"
)
assert(
rtp_path:find("nvim-treesitter", 1, true),
string.format(
"%s from rtp (%s) is not from nvim-treesitter",
name,
rtp_path
)
)
end
end
'';
};
}