plugins: swith to the new behaviour of mkRaw

This commit is contained in:
Gaetan Lepage 2023-11-22 12:00:32 +01:00 committed by Gaétan Lepage
parent 8cf2d943d2
commit 19f39c3b1b
32 changed files with 66 additions and 127 deletions

View file

@ -173,10 +173,10 @@ in {
show_dirname = showDirname;
show_basename = showBasename;
show_modified = showModified;
modified = helpers.ifNonNull' modified (helpers.mkRaw modified);
modified = helpers.mkRaw modified;
show_navic = showNavic;
lead_custom_section = helpers.ifNonNull' leadCustomSection (helpers.mkRaw leadCustomSection);
custom_section = helpers.ifNonNull' customSection (helpers.mkRaw customSection);
lead_custom_section = helpers.mkRaw leadCustomSection;
custom_section = helpers.mkRaw customSection;
inherit theme;
context_follow_icon_color = contextFollowIconColor;
symbols = {

View file

@ -299,18 +299,14 @@ in {
left_trunc_marker = leftTruncMarker;
right_trunc_marker = rightTruncMarker;
separator_style = separatorStyle;
name_formatter =
helpers.ifNonNull' nameFormatter
(helpers.mkRaw nameFormatter);
name_formatter = helpers.mkRaw nameFormatter;
truncate_names = truncateNames;
tab_size = tabSize;
max_name_length = maxNameLength;
color_icons = colorIcons;
show_buffer_icons = showBufferIcons;
show_buffer_close_icons = showBufferCloseIcons;
get_element_icon =
helpers.ifNonNull' getElementIcon
(helpers.mkRaw getElementIcon);
get_element_icon = helpers.mkRaw getElementIcon;
show_close_icon = showCloseIcon;
show_tab_indicators = showTabIndicators;
show_duplicate_prefix = showDuplicatePrefix;
@ -320,9 +316,7 @@ in {
max_prefix_length = maxPrefixLength;
sort_by = sortBy;
inherit diagnostics;
diagnostics_indicator =
helpers.ifNonNull' diagnosticsIndicator
(helpers.mkRaw diagnosticsIndicator);
diagnostics_indicator = helpers.mkRaw diagnosticsIndicator;
diagnostics_update_in_insert = diagnosticsUpdateInInsert;
inherit offsets;
groups = helpers.ifNonNull' groups {
@ -333,9 +327,7 @@ in {
};
inherit hover;
inherit debug;
custom_filter =
helpers.ifNonNull' customFilter
(helpers.mkRaw customFilter);
custom_filter = helpers.mkRaw customFilter;
}
// cfg.extraOptions;

View file

@ -79,12 +79,8 @@ in {
dim_inactive = dimInactive;
lualine_bold = lualineBold;
day_brightness = dayBrightness;
on_colors =
helpers.ifNonNull' cfg.onColors
(helpers.mkRaw onColors);
on_highlights =
helpers.ifNonNull' cfg.onHighlights
(helpers.mkRaw onHighlights);
on_colors = helpers.mkRaw onColors;
on_highlights = helpers.mkRaw onHighlights;
};
in ''
require("tokyonight").setup(${helpers.toLuaObject setupOptions})

View file

@ -573,9 +573,7 @@ in {
formatting = with formatting; {
expandable_indicator = expandableIndicator;
inherit fields;
format =
helpers.ifNonNull' format
(helpers.mkRaw format);
format = helpers.mkRaw format;
};
matching = with matching; {
@ -657,11 +655,11 @@ in {
max_width =
if isInt maxWidth
then maxWidth
else helpers.ifNonNull' maxWidth (helpers.mkRaw maxWidth);
else helpers.mkRaw maxWidth;
max_height =
if isInt maxHeight
then maxHeight
else helpers.ifNonNull' maxHeight (helpers.mkRaw maxHeight);
else helpers.mkRaw maxHeight;
};
};
inherit experimental;

View file

@ -212,7 +212,7 @@ in {
max_value_lines = maxValueLines;
});
select_window = helpers.ifNonNull' selectWindow (helpers.mkRaw selectWindow);
select_window = helpers.mkRaw selectWindow;
}
// cfg.extraOptions;
in

View file

@ -72,7 +72,7 @@ in {
only_first_definition = onlyFirstDefinition;
all_references = allReferences;
clear_on_continue = clearOnContinue;
display_callback = helpers.ifNonNull' displayCallback (helpers.mkRaw displayCallback);
display_callback = helpers.mkRaw displayCallback;
virt_text_pos = virtTextPos;
all_frames = allFrames;
virt_lines = virtLines;

View file

@ -129,7 +129,7 @@ in rec {
adapter
// {
inherit type;
enrich_config = helpers.ifNonNull' adapter.enrichConfig (helpers.mkRaw adapter.enrichConfig);
enrich_config = helpers.mkRaw adapter.enrichConfig;
}
))
adapters;

View file

@ -1059,9 +1059,7 @@ in {
popup_border_style = cfg.popupBorderStyle;
resize_timer_interval = cfg.resizeTimerInterval;
sort_case_insensitive = cfg.sortCaseInsensitive;
sort_function =
ifNonNull' cfg.sortFunction
(mkRaw cfg.sortFunction);
sort_function = mkRaw cfg.sortFunction;
use_popups_for_input = cfg.usePopupsForInput;
use_default_mappings = cfg.useDefaultMappings;
source_selector = with cfg.sourceSelector; {

View file

@ -159,7 +159,7 @@ in {
setupOptions = with cfg;
{
inlay_hints = with inlayHints; {
inline = helpers.ifNonNull' inline (helpers.mkRaw inline);
inline = helpers.mkRaw inline;
only_current_line = onlyCurrentLine;
only_current_line_autocmd = onlyCurrentLineAutocmd;
show_parameter_hints = showParameterHints;

View file

@ -302,9 +302,7 @@ in {
enable
height
;
on_lines =
helpers.ifNonNull' onLines
(helpers.mkRaw onLines);
on_lines = helpers.mkRaw onLines;
};
inherit lsp3;
}

View file

@ -86,7 +86,7 @@ with lib; let
example = ''
require('lint.parser').from_pattern(pattern, groups, severity_map, defaults, opts)
'';
apply = s: helpers.ifNonNull' s (helpers.mkRaw s);
apply = helpers.mkRaw;
mandatory = true;
};
};

View file

@ -144,9 +144,7 @@ in {
helpers.ifNonNull' cfg.executor
(helpers.mkRaw "require(${rust-tools.executors}).${cfg.executor}");
on_initialized =
helpers.ifNonNull' cfg.onInitialized
(helpers.mkRaw cfg.onInitialized);
on_initialized = helpers.mkRaw cfg.onInitialized;
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
inlay_hints = with cfg.inlayHints;

View file

@ -86,9 +86,7 @@ in {
separator
zindex
;
on_attach =
helpers.ifNonNull' onAttach
(helpers.mkRaw onAttach);
on_attach = helpers.mkRaw onAttach;
}
// cfg.extraOptions;
in

View file

@ -129,9 +129,7 @@
extraOptions =
{
inherit (cfg) cmd filetypes autostart;
root_dir =
helpers.ifNonNull' cfg.rootDir
(helpers.mkRaw cfg.rootDir);
root_dir = helpers.mkRaw cfg.rootDir;
on_attach =
helpers.ifNonNull' cfg.onAttach
(

View file

@ -43,7 +43,7 @@ with lib; {
preview_empty_name = cfg.previewEmptyName;
show_message = cfg.showMessage;
input_buffer_type = cfg.inputBufferType;
post_hook = helpers.ifNonNull' cfg.postHook (helpers.mkRaw cfg.postHook);
post_hook = helpers.mkRaw cfg.postHook;
};
in
mkIf cfg.enable {

View file

@ -225,21 +225,11 @@ in {
else cfg.fallbackSeverity;
log_level = cfg.logLevel;
notify_format = cfg.notifyFormat;
on_attach =
helpers.ifNonNull' cfg.onAttach
(helpers.mkRaw cfg.onAttach);
on_init =
helpers.ifNonNull' cfg.onInit
(helpers.mkRaw cfg.onInit);
on_exit =
helpers.ifNonNull' cfg.onExit
(helpers.mkRaw cfg.onExit);
root_dir =
helpers.ifNonNull' cfg.rootDir
(helpers.mkRaw cfg.rootDir);
should_attach =
helpers.ifNonNull' cfg.shouldAttach
(helpers.mkRaw cfg.shouldAttach);
on_attach = helpers.mkRaw cfg.onAttach;
on_init = helpers.mkRaw cfg.onInit;
on_exit = helpers.mkRaw cfg.onExit;
root_dir = helpers.mkRaw cfg.rootDir;
should_attach = helpers.mkRaw cfg.shouldAttach;
temp_dir = cfg.tempDir;
update_in_insert = cfg.updateInInsert;

View file

@ -159,13 +159,9 @@ in {
inherit (plugin) disable as;
installer =
helpers.ifNonNull' plugin.installer
(helpers.mkRaw plugin.installer);
installer = helpers.mkRaw plugin.installer;
updater =
helpers.ifNonNull' plugin.updater
(helpers.mkRaw plugin.updater);
updater = helpers.mkRaw plugin.updater;
inherit
(plugin)

View file

@ -151,12 +151,8 @@ in {
;
add_dirs = addDirs;
auto_depth = autoDepth;
browse_files =
helpers.ifNonNull' browseFiles
(helpers.mkRaw browseFiles);
browse_folders =
helpers.ifNonNull' browseFolders
(helpers.mkRaw browseFolders);
browse_files = helpers.mkRaw browseFiles;
browse_folders = helpers.mkRaw browseFolders;
collapse_dirs = collapseDirs;
cwd_to_path = cwdToPath;
dir_icon = dirIcon;
@ -172,7 +168,7 @@ in {
else
attr
// {
display = helpers.ifNonNull' attr.display (helpers.mkRaw attr.display);
display = helpers.mkRaw attr.display;
}
)
displayStat

View file

@ -30,7 +30,7 @@ in {
'';
diffContextLines = helpers.defaultNullOpts.mkNullable (with types; either ints.unsigned str) "vim.o.scrolloff" ''
Defaults to the scrolloff
Defaults to the scrolloff.
'';
entryFormat = helpers.defaultNullOpts.mkStr "state #$ID, $STAT, $TIME" ''
@ -79,8 +79,8 @@ in {
use_custom_command = useCustomCommand;
side_by_side = sideBySide;
diff_context_lines =
if isInt diffContextLines
then helpers.mkRaw "diffContextLines"
if isString diffContextLines
then helpers.mkRaw diffContextLines
else diffContextLines;
entry_format = entryFormat;
time_format = timeFormat;

View file

@ -120,13 +120,11 @@ in {
cleaning_interval = cleaningInterval;
};
trigger_events = cfg.triggerEvents;
condition =
helpers.ifNonNull' cfg.condition
(helpers.mkRaw cfg.condition);
condition = helpers.mkRaw cfg.condition;
write_all_buffers = cfg.writeAllBuffers;
debounce_delay = cfg.debounceDelay;
callbacks = with cfg.callbacks;
mapAttrs (name: value: helpers.ifNonNull' value (helpers.mkRaw value)) {
mapAttrs (_: helpers.mkRaw) {
inherit enabling disabling;
before_asserting_save = beforeAssertingSave;
before_saving = beforeSaving;

View file

@ -160,8 +160,8 @@ in {
then
with cfg.cwdChangeHandling; {
restore_upcoming_session = restoreUpcomingSession;
pre_cwd_changed_hook = helpers.ifNonNull' preCwdChangedHook (helpers.mkRaw preCwdChangedHook);
post_cwd_changed_hook = helpers.ifNonNull' postCwdChangedHook (helpers.mkRaw postCwdChangedHook);
pre_cwd_changed_hook = helpers.mkRaw preCwdChangedHook;
post_cwd_changed_hook = helpers.mkRaw postCwdChangedHook;
}
else cfg.cwdChangeHandling;
bypass_session_save_file_types = cfg.bypassSessionSaveFileTypes;

View file

@ -60,8 +60,8 @@ in {
{
inherit mapping;
timeout =
if isInt timeout
then helpers.mkRaw "timeout"
if isString timeout
then helpers.mkRaw timeout
else timeout;
clear_empty_lines = clearEmptyLines;
inherit keys;

View file

@ -278,7 +278,7 @@ in {
summary_pass = summaryPass;
summary_fail = summaryFail;
};
load_coverage_cb = helpers.ifNonNull' loadCoverageCb (helpers.mkRaw loadCoverageCb);
load_coverage_cb = helpers.mkRaw loadCoverageCb;
inherit signs;
sign_group = signGroup;
summary = with summary; {

View file

@ -387,8 +387,6 @@ in {
// configOpts;
config = let
mkRawIfNonNull = v: helpers.ifNonNull' v (helpers.mkRaw v);
mkGlobalConfig = c: {
inherit (c) labels;
search =
@ -408,14 +406,14 @@ in {
rainbow = {
inherit (c.label.rainbow) enabled shade;
};
format = mkRawIfNonNull c.label.format;
format = helpers.mkRaw c.label.format;
};
highlight = {
inherit (c.highlight) backdrop matches priority groups;
};
action = mkRawIfNonNull c.action;
action = helpers.mkRaw c.action;
inherit (c) pattern continue;
config = mkRawIfNonNull c.config;
config = helpers.mkRaw c.config;
prompt = {
inherit (c.prompt) enabled prefix;
win_config = c.prompt.winConfig;
@ -446,7 +444,7 @@ in {
jump_labels = c.jumpLabels;
multi_line = c.multiLine;
inherit (c) keys;
char_actions = mkRawIfNonNull c.charActions;
char_actions = helpers.mkRaw c.charActions;
});
treesitter = mkModeConfig cfg.modes.treesitter (c: {});
treesitter_search = mkModeConfig cfg.modes.treesitterSearch (c: {});

View file

@ -139,8 +139,8 @@ in {
}
)
icons;
on_open = helpers.ifNonNull' onOpen (helpers.mkRaw onOpen);
on_close = helpers.ifNonNull' onClose (helpers.mkRaw onClose);
on_open = helpers.mkRaw onOpen;
on_close = helpers.mkRaw onClose;
inherit render;
minimum_width = minimumWidth;
inherit fps;

View file

@ -81,9 +81,7 @@ in {
disable_in_macro = cfg.disableInMacro;
disable_in_visualblock = cfg.disableInVisualblock;
disable_in_replace_mode = cfg.disableInReplaceMode;
ignored_next_char =
helpers.ifNonNull' cfg.ignoredNextChar
(helpers.mkRaw cfg.ignoredNextChar);
ignored_next_char = helpers.mkRaw cfg.ignoredNextChar;
enable_moveright = cfg.enableMoveright;
enable_afterquote = cfg.enableAfterQuote;
enable_check_bracket_line = cfg.enableCheckBracketLine;

View file

@ -135,10 +135,7 @@ in {
win_vheight = winVheight;
inherit wrap;
buf_label = bufLabel;
should_preview_cb =
if (shouldPreviewCb == null)
then null
else helpers.mkRaw shouldPreviewCb;
should_preview_cb = helpers.mkRaw shouldPreviewCb;
};
func_map = cfg.funcMap;
filter = {

View file

@ -58,9 +58,9 @@ in {
options = with cfg;
{
open_fold_hl_timeout = openFoldHlTimeout;
provider_selector = helpers.ifNonNull' providerSelector (helpers.mkRaw providerSelector);
provider_selector = helpers.mkRaw providerSelector;
close_fold_kinds = closeFoldKinds;
fold_virt_text_handler = helpers.ifNonNull' foldVirtTextHandler (helpers.mkRaw foldVirtTextHandler);
fold_virt_text_handler = helpers.mkRaw foldVirtTextHandler;
enable_get_fold_virt_text = enableGetFoldVirtText;
preview = with preview; {

View file

@ -381,12 +381,8 @@ in {
use_default_keymaps = cfg.useDefaultKeymaps;
view_options = with cfg.viewOptions; {
show_hidden = showHidden;
is_hidden_file =
helpers.ifNonNull' isHiddenFile
(helpers.mkRaw isHiddenFile);
is_always_hidden =
helpers.ifNonNull' isAlwaysHidden
(helpers.mkRaw isAlwaysHidden);
is_hidden_file = helpers.mkRaw isHiddenFile;
is_always_hidden = helpers.mkRaw isAlwaysHidden;
};
float = with cfg.float; {
inherit padding;

View file

@ -57,7 +57,7 @@ with lib; {
extraConfigLua = let
opts = {
inherit (cfg) dir options;
pre_save = helpers.mkRawIfNonNull cfg.preSave;
pre_save = helpers.mkRaw cfg.preSave;
save_empty = cfg.saveEmpty;
};
in ''

View file

@ -177,12 +177,12 @@ in {
else helpers.mkRaw size
);
open_mapping = helpers.ifNonNull' openMapping (helpers.mkRaw "[[${openMapping}]]");
on_create = helpers.ifNonNull' onCreate (helpers.mkRaw onCreate);
on_open = helpers.ifNonNull' onOpen (helpers.mkRaw onOpen);
on_close = helpers.ifNonNull' onClose (helpers.mkRaw onClose);
on_stdout = helpers.ifNonNull' onStdout (helpers.mkRaw onStdout);
on_stderr = helpers.ifNonNull' onStderr (helpers.mkRaw onStderr);
on_exit = helpers.ifNonNull' onExit (helpers.mkRaw onExit);
on_create = helpers.mkRaw onCreate;
on_open = helpers.mkRaw onOpen;
on_close = helpers.mkRaw onClose;
on_stdout = helpers.mkRaw onStdout;
on_stderr = helpers.mkRaw onStderr;
on_exit = helpers.mkRaw onExit;
hide_numbers = hideNumbers;
shade_filetypes = shadeFiletypes;
shade_terminals = shadeTerminals;
@ -197,7 +197,7 @@ in {
float_opts = floatOpts;
winbar = with winbar; {
inherit enabled;
name_formatter = helpers.ifNonNull' nameFormatter (helpers.mkRaw nameFormatter);
name_formatter = helpers.mkRaw nameFormatter;
};
};
in

View file

@ -237,15 +237,9 @@ in {
pipeline =
helpers.ifNonNull' pipeline
(map helpers.mkRaw pipeline);
render =
helpers.ifNonNull' render
(helpers.mkRaw render);
preHook =
helpers.ifNonNull' preHook
(helpers.mkRaw preHook);
postHook =
helpers.ifNonNull' postHook
(helpers.mkRaw postHook);
render = helpers.mkRaw render;
preHook = helpers.mkRaw preHook;
postHook = helpers.mkRaw postHook;
}
// cfg.extraOptions;
in