plugins/ts-context-commentstring: use new setup-based init

This commit is contained in:
Gaetan Lepage 2023-11-27 14:23:10 +01:00 committed by Gaétan Lepage
parent abb10f097e
commit be14bc1b91

View file

@ -15,6 +15,36 @@ with lib; {
helpers.mkPackageOption
"ts-context-commentstring"
pkgs.vimPlugins.nvim-ts-context-commentstring;
skipTsContextCommentStringModule = mkOption {
type = types.bool;
default = true;
description = ''
Whethter to skip backwards compatibility routines and speed up loading.
'';
example = false;
};
disableAutoInitialization = helpers.defaultNullOpts.mkBool false ''
Whether to disable auto-initialization.
'';
languages =
helpers.mkNullOrOption
(
with types;
attrsOf
(
either
str
(attrsOf str)
)
)
''
Allows you to add support for more languages.
See `:h ts-context-commentstring-commentstring-configuration` for more information.
'';
};
config = let
@ -27,10 +57,19 @@ with lib; {
extraPlugins = [cfg.package];
plugins.treesitter.moduleConfig.context_commentstring =
globals = with cfg; {
skip_ts_context_commentstring_module = skipTsContextCommentStringModule;
loaded_ts_context_commentstring = disableAutoInitialization;
};
extraConfigLua = let
setupOptions = with cfg;
{
enable = true;
inherit languages;
}
// cfg.extraOptions;
in ''
require('ts_context_commentstring').setup(${helpers.toLuaObject setupOptions})
'';
};
}