mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 17:58:38 +02:00
helpers: Add option helpers for types that are either a lua str or a value (#876)
Those types needed the following code in apply: if builtins.isString value then mkRaw value else value This commit avoids this boilerplate, and clarifies that the `str` is lua code in the documentation.
This commit is contained in:
parent
8b8a1c0f4b
commit
8aa4b7e4ce
13 changed files with 109 additions and 129 deletions
|
@ -37,7 +37,7 @@ in {
|
|||
If neither is found "unittest" is used.
|
||||
'';
|
||||
|
||||
testRunners = helpers.mkNullOrOption (types.attrsOf types.str) ''
|
||||
testRunners = helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf strLuaFn) ''
|
||||
Set to register test runners.
|
||||
Built-in are test runners for unittest, pytest and django.
|
||||
The key is the test runner name, the value a function to generate the
|
||||
|
|
|
@ -12,7 +12,7 @@ in rec {
|
|||
For most debug adapters setting this is not necessary.
|
||||
'';
|
||||
|
||||
enrichConfig = helpers.mkNullOrOption types.str ''
|
||||
enrichConfig = helpers.mkNullOrLuaFn ''
|
||||
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
|
||||
configuration with additional information. It receives a configuration as first
|
||||
argument, and a callback that must be called with the final configuration as second argument.
|
||||
|
@ -129,7 +129,7 @@ in rec {
|
|||
adapter
|
||||
// {
|
||||
inherit type;
|
||||
enrich_config = helpers.mkRaw adapter.enrichConfig;
|
||||
enrich_config = adapter.enrichConfig;
|
||||
}
|
||||
))
|
||||
adapters;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue