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

@ -26,7 +26,7 @@ in {
includeConfigs = helpers.defaultNullOpts.mkBool true "Add default configurations.";
resolvePython = helpers.mkNullOrOption types.str ''
resolvePython = helpers.defaultNullOpts.mkLuaFn "null" ''
Function to resolve path to python to use for program or test execution.
By default the `VIRTUAL_ENV` and `CONDA_PREFIX` environment variables are used if present.
'';
@ -75,7 +75,7 @@ in {
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
'')
+ (optionalString (cfg.resolvePython != null) ''
require("dap-python").resolve_python = ${toLuaObject (mkRaw cfg.resolvePython)}
require("dap-python").resolve_python = ${toLuaObject cfg.resolvePython}
'')
+ (optionalString (cfg.testRunner != null) ''
require("dap-python").test_runner = ${toLuaObject cfg.testRunner};