helpers: Add mkLua,mkLuaFn (defaultNullOpts or not) (#866)

This makes it such that defaultNullOpts.mkStr never represents a lua
string, easing documenting where a string is a lua string vs lua code.
This commit is contained in:
traxys 2024-01-01 20:28:55 +01:00 committed by GitHub
parent f2e808a519
commit abd1c4007a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 45 deletions

View file

@ -100,7 +100,7 @@ in {
mapAttrs
(
name: desc:
helpers.mkNullOrOption types.str "The code of the function that runs ${desc}."
helpers.mkNullOrLuaFn "The code of the function that runs ${desc}."
)
{
enabling = "when enabling auto-save";
@ -123,13 +123,12 @@ in {
inherit (cfg) condition;
write_all_buffers = cfg.writeAllBuffers;
debounce_delay = cfg.debounceDelay;
callbacks = with cfg.callbacks;
mapAttrs (_: helpers.mkRaw) {
inherit enabling disabling;
before_asserting_save = beforeAssertingSave;
before_saving = beforeSaving;
after_saving = afterSaving;
};
callbacks = with cfg.callbacks; {
inherit enabling disabling;
before_asserting_save = beforeAssertingSave;
before_saving = beforeSaving;
after_saving = afterSaving;
};
}
// cfg.extraOptions;
in