mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 09:14:31 +02:00
misc: fix mkEnableOption descriptions
This commit is contained in:
parent
23327700e2
commit
238f0c590e
39 changed files with 525 additions and 489 deletions
|
@ -11,7 +11,7 @@ in
|
|||
|
||||
options = {
|
||||
plugins.lsp = {
|
||||
enable = mkEnableOption "Enable neovim's built-in LSP";
|
||||
enable = mkEnableOption "neovim's built-in LSP";
|
||||
|
||||
enabledServers = mkOption {
|
||||
type = with types; listOf (oneOf [
|
||||
|
|
|
@ -7,7 +7,7 @@ in
|
|||
{
|
||||
options = {
|
||||
plugins.lspsaga = {
|
||||
enable = mkEnableOption "Enable lspsava.nvim";
|
||||
enable = mkEnableOption "lspsaga.nvim";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
|
@ -111,27 +111,29 @@ in
|
|||
description = "Maximum finder preview lines";
|
||||
};
|
||||
|
||||
keys = let
|
||||
defaultKeyOpt = desc: mkOption {
|
||||
description = desc;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in {
|
||||
finderAction = {
|
||||
open = defaultKeyOpt "Open from finder";
|
||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||
split = defaultKeyOpt "Horizontal split in finder";
|
||||
quit = defaultKeyOpt "Quit finder";
|
||||
scrollDown = defaultKeyOpt "Scroll down finder";
|
||||
scrollUp = defaultKeyOpt "Scroll up finder";
|
||||
};
|
||||
keys =
|
||||
let
|
||||
defaultKeyOpt = desc: mkOption {
|
||||
description = desc;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
finderAction = {
|
||||
open = defaultKeyOpt "Open from finder";
|
||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||
split = defaultKeyOpt "Horizontal split in finder";
|
||||
quit = defaultKeyOpt "Quit finder";
|
||||
scrollDown = defaultKeyOpt "Scroll down finder";
|
||||
scrollUp = defaultKeyOpt "Scroll up finder";
|
||||
};
|
||||
|
||||
codeAction = {
|
||||
quit = defaultKeyOpt "Quit code actions menu";
|
||||
exec = defaultKeyOpt "Execute code action";
|
||||
codeAction = {
|
||||
quit = defaultKeyOpt "Quit code actions menu";
|
||||
exec = defaultKeyOpt "Execute code action";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
borderStyle = mkOption {
|
||||
type = types.nullOr (types.enum [ "thin" "rounded" "thick" ]);
|
||||
|
@ -147,67 +149,76 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
notDefault = default: opt: if (opt != default) then opt else null;
|
||||
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != {}) then opt else null;
|
||||
notNull = opt: opt;
|
||||
lspsagaConfig = {
|
||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||
error_sign = notNull cfg.signs.error;
|
||||
warn_sign = notNull cfg.signs.warning;
|
||||
hint_sign = notNull cfg.signs.hint;
|
||||
infor_sign = notNull cfg.signs.info;
|
||||
config =
|
||||
let
|
||||
notDefault = default: opt: if (opt != default) then opt else null;
|
||||
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != { }) then opt else null;
|
||||
notNull = opt: opt;
|
||||
lspsagaConfig = {
|
||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||
error_sign = notNull cfg.signs.error;
|
||||
warn_sign = notNull cfg.signs.warning;
|
||||
hint_sign = notNull cfg.signs.hint;
|
||||
infor_sign = notNull cfg.signs.info;
|
||||
|
||||
# TODO Fix this!
|
||||
# error_header = notNull cfg.headers.error;
|
||||
# warn_header = notNull cfg.headers.warning;
|
||||
# hint_header = notNull cfg.headers.hint;
|
||||
# infor_header = notNull cfg.headers.info;
|
||||
# TODO Fix this!
|
||||
# error_header = notNull cfg.headers.error;
|
||||
# warn_header = notNull cfg.headers.warning;
|
||||
# hint_header = notNull cfg.headers.hint;
|
||||
# infor_header = notNull cfg.headers.info;
|
||||
|
||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||
max_diag_msg_width = notNull cfg.maxDialogWidth;
|
||||
|
||||
code_action_icon = notNull cfg.icons.codeAction;
|
||||
finder_definition_icon = notNull cfg.icons.findDefinition;
|
||||
finder_reference_icon = notNull cfg.icons.findReference;
|
||||
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
||||
code_action_icon = notNull cfg.icons.codeAction;
|
||||
finder_definition_icon = notNull cfg.icons.findDefinition;
|
||||
finder_reference_icon = notNull cfg.icons.findReference;
|
||||
definition_preview_icon = notNull cfg.icons.definitionPreview;
|
||||
|
||||
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
||||
max_finder_preview_lines = notNull cfg.maxFinderPreviewLines;
|
||||
|
||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||
|
||||
border_style = let
|
||||
borderStyle = if cfg.borderStyle == "thin" then 1
|
||||
else if cfg.borderStyle == "rounded" then 2
|
||||
else if cfg.borderStyle == "thick" then 3
|
||||
else null;
|
||||
in borderStyle;
|
||||
border_style =
|
||||
let
|
||||
borderStyle =
|
||||
if cfg.borderStyle == "thin" then 1
|
||||
else if cfg.borderStyle == "rounded" then 2
|
||||
else if cfg.borderStyle == "thick" then 3
|
||||
else null;
|
||||
in
|
||||
borderStyle;
|
||||
|
||||
finder_action_keys = let
|
||||
keys = {
|
||||
open = notNull cfg.keys.finderAction.open;
|
||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||
split = notNull cfg.keys.finderAction.split;
|
||||
quit = notNull cfg.keys.finderAction.quit;
|
||||
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
||||
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
||||
};
|
||||
in notEmpty keys;
|
||||
finder_action_keys =
|
||||
let
|
||||
keys = {
|
||||
open = notNull cfg.keys.finderAction.open;
|
||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||
split = notNull cfg.keys.finderAction.split;
|
||||
quit = notNull cfg.keys.finderAction.quit;
|
||||
scroll_down = notNull cfg.keys.finderAction.scrollDown;
|
||||
scroll_up = notNull cfg.keys.finderAction.scrollUp;
|
||||
};
|
||||
in
|
||||
notEmpty keys;
|
||||
|
||||
code_action_keys = let
|
||||
keys = {
|
||||
quit = notNull cfg.keys.codeAction.quit;
|
||||
exec = notNull cfg.keys.codeAction.exec;
|
||||
};
|
||||
in notEmpty keys;
|
||||
code_action_keys =
|
||||
let
|
||||
keys = {
|
||||
quit = notNull cfg.keys.codeAction.quit;
|
||||
exec = notNull cfg.keys.codeAction.exec;
|
||||
};
|
||||
in
|
||||
notEmpty keys;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
local saga = require 'lspsaga'
|
||||
|
||||
saga.init_lsp_saga(${helpers.toLuaObject lspsagaConfig})
|
||||
'';
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
local saga = require 'lspsaga'
|
||||
|
||||
saga.init_lsp_saga(${helpers.toLuaObject lspsagaConfig})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue