mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 16:39:00 +02:00
plugins/treesitter: add workaround for performance.combinePlugins
This commit is contained in:
parent
0c32f5bda5
commit
ce93f1724f
2 changed files with 42 additions and 0 deletions
|
@ -328,5 +328,10 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
foldmethod = mkDefault "expr";
|
foldmethod = mkDefault "expr";
|
||||||
foldexpr = mkDefault "nvim_treesitter#foldexpr()";
|
foldexpr = mkDefault "nvim_treesitter#foldexpr()";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Since https://github.com/NixOS/nixpkgs/pull/321550 upstream queries are added
|
||||||
|
# to grammar plugins. Exclude nvim-treesitter itself from combining to avoid
|
||||||
|
# collisions with grammar's queries
|
||||||
|
performance.combinePlugins.standalonePlugins = [ cfg.package ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
combine-plugins = {
|
||||||
|
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 = "${pkgs.vimPlugins.nvim-treesitter}/queries"
|
||||||
|
for name, type in vim.fs.dir(queries_path, {depth = 10}) do
|
||||||
|
if type == "file" then
|
||||||
|
-- Resolve all symlinks and compare nvim-treesitter's path with
|
||||||
|
-- whatever we've got from runtime
|
||||||
|
local nvim_treesitter_path = assert(vim.uv.fs_realpath(vim.fs.joinpath(queries_path, name)))
|
||||||
|
local rtp_path = assert(
|
||||||
|
vim.uv.fs_realpath(vim.api.nvim_get_runtime_file("queries/" .. name, false)[1]),
|
||||||
|
name .. " not found in runtime"
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
nvim_treesitter_path == rtp_path,
|
||||||
|
string.format(
|
||||||
|
"%s from rtp (%s) is not the same as from nvim-treesitter (%s)",
|
||||||
|
name,
|
||||||
|
rtp_path, nvim_treesitter_path
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue