treesitter: allow specifying custom parser install dir (#60)

This commit is contained in:
LightQuantum 2022-10-31 18:32:59 +08:00 committed by GitHub
parent e19114a4d0
commit f7be736462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,12 @@ in
description = "Either \"all\" or a list of languages";
};
parserInstallDir = mkOption {
type = types.nullOr types.str;
default = null;
description = "Location of the parsers to be installed by the plugin (only needed when nixGrammars is disabled)";
};
ignoreInstall = mkOption {
type = types.listOf types.str;
default = [ ];
@ -90,11 +96,14 @@ in
ensure_installed = if cfg.nixGrammars then [ ] else cfg.ensureInstalled;
ignore_install = cfg.ignoreInstall;
parser_install_dir = cfg.parserInstallDir;
};
in
mkIf cfg.enable {
extraConfigLua = ''
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
'' + optionalString (cfg.parserInstallDir != null) ''
vim.opt.runtimepath:append("${cfg.parserInstallDir}")
'';
extraPlugins = with pkgs; if cfg.nixGrammars then