2023-06-01 10:39:33 +02:00
|
|
|
{
|
|
|
|
lib,
|
2023-11-06 15:04:08 +01:00
|
|
|
helpers,
|
2023-06-01 10:39:33 +02:00
|
|
|
config,
|
2023-11-06 15:04:08 +01:00
|
|
|
pkgs,
|
2023-06-01 10:39:33 +02:00
|
|
|
...
|
|
|
|
}:
|
2023-11-06 15:04:08 +01:00
|
|
|
with lib;
|
|
|
|
{
|
2024-12-15 20:28:24 +01:00
|
|
|
options.plugins.ts-context-commentstring = lib.nixvim.neovim-plugin.extraOptionsOptions // {
|
2023-06-01 10:39:33 +02:00
|
|
|
enable = mkEnableOption "nvim-ts-context-commentstring";
|
2023-11-27 14:23:10 +01:00
|
|
|
|
2024-09-04 22:00:43 +01:00
|
|
|
package = lib.mkPackageOption pkgs "ts-context-commentstring" {
|
|
|
|
default = [
|
|
|
|
"vimPlugins"
|
|
|
|
"nvim-ts-context-commentstring"
|
|
|
|
];
|
|
|
|
};
|
2023-11-27 14:23:10 +01:00
|
|
|
|
|
|
|
skipTsContextCommentStringModule = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Whether to skip backwards compatibility routines and speed up loading.
|
|
|
|
'';
|
|
|
|
example = false;
|
2024-05-05 19:39:35 +02:00
|
|
|
};
|
2023-11-27 14:23:10 +01:00
|
|
|
|
|
|
|
disableAutoInitialization = helpers.defaultNullOpts.mkBool false ''
|
|
|
|
Whether to disable auto-initialization.
|
2024-05-05 19:39:35 +02:00
|
|
|
'';
|
2023-11-27 14:23:10 +01:00
|
|
|
|
2024-03-07 19:44:13 +01:00
|
|
|
languages = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
|
2023-11-27 14:23:10 +01:00
|
|
|
Allows you to add support for more languages.
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2023-11-27 14:23:10 +01:00
|
|
|
See `:h ts-context-commentstring-commentstring-configuration` for more information.
|
|
|
|
'';
|
2023-06-01 10:39:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config =
|
|
|
|
let
|
|
|
|
cfg = config.plugins.ts-context-commentstring;
|
|
|
|
in
|
|
|
|
mkIf cfg.enable {
|
|
|
|
warnings = mkIf (!config.plugins.treesitter.enable) [
|
|
|
|
"Nixvim: ts-context-commentstring needs treesitter to function as intended"
|
|
|
|
];
|
|
|
|
|
|
|
|
extraPlugins = [ cfg.package ];
|
|
|
|
|
2023-11-27 14:23:10 +01:00
|
|
|
globals = with cfg; {
|
|
|
|
skip_ts_context_commentstring_module = skipTsContextCommentStringModule;
|
|
|
|
loaded_ts_context_commentstring = disableAutoInitialization;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraConfigLua =
|
|
|
|
let
|
|
|
|
setupOptions = with cfg; { inherit languages; } // cfg.extraOptions;
|
|
|
|
in
|
|
|
|
''
|
|
|
|
require('ts_context_commentstring').setup(${helpers.toLuaObject setupOptions})
|
|
|
|
'';
|
2023-06-01 10:39:33 +02:00
|
|
|
};
|
|
|
|
}
|