plugins: Introduce helpers.defaultNullOpts.mkLuaFn (#855)

This allows to avoid calling `mkRaw` on lua functions, as they will get
applied automatically.

This could also help in the future to refactor the use of Lua code to
make it more user-friendly.
This commit is contained in:
traxys 2023-12-29 15:24:42 +01:00 committed by GitHub
parent b38dbdb0dc
commit 1d8e7906c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 140 additions and 119 deletions

View file

@ -175,7 +175,7 @@ in {
```
'';
renderer = helpers.mkNullOrOption types.str ''
renderer = helpers.defaultNullOpts.mkLuaFn "nil" ''
Sets the renderer to used to display the completions.
See `|wilder-renderer|`.
@ -190,7 +190,7 @@ in {
```
'';
preHook = helpers.mkNullOrOption types.str ''
preHook = helpers.defaultNullOpts.mkLuaFn "nil" ''
A function which takes a `ctx`.
This function is called when wilder starts, or when wilder becomes unhidden.
See `|wilder-hidden|`.
@ -198,7 +198,7 @@ in {
`ctx` contains no keys.
'';
postHook = helpers.mkNullOrOption types.str ''
postHook = helpers.defaultNullOpts.mkLuaFn "nil" ''
A function which takes a `ctx`.
This function is called when wilder stops, or when wilder becomes hidden.
See `|wilder-hidden|`.
@ -237,9 +237,9 @@ in {
pipeline =
helpers.ifNonNull' pipeline
(map helpers.mkRaw pipeline);
renderer = helpers.mkRaw renderer;
preHook = helpers.mkRaw preHook;
postHook = helpers.mkRaw postHook;
inherit renderer;
pre_hook = preHook;
post_hook = postHook;
}
// cfg.extraOptions;
in