mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-19 18:25:11 +02:00
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:
parent
b38dbdb0dc
commit
1d8e7906c9
30 changed files with 140 additions and 119 deletions
|
@ -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};
|
||||
|
|
|
@ -186,7 +186,7 @@ in {
|
|||
maxValueLines = helpers.defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
|
||||
};
|
||||
|
||||
selectWindow = helpers.mkNullOrOption types.str ''
|
||||
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
A function which returns a window to be used for opening buffers such as a stack frame location.
|
||||
'';
|
||||
};
|
||||
|
@ -212,7 +212,7 @@ in {
|
|||
max_value_lines = maxValueLines;
|
||||
};
|
||||
|
||||
select_window = helpers.mkRaw selectWindow;
|
||||
select_window = selectWindow;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
|
||||
clearOnContinue = helpers.defaultNullOpts.mkBool false "Clear virtual text on `continue` (might cause flickering when stepping).";
|
||||
|
||||
displayCallback = helpers.defaultNullOpts.mkStr ''
|
||||
displayCallback = helpers.defaultNullOpts.mkLuaFn ''
|
||||
function(variable, buf, stackframe, node, options)
|
||||
if options.virt_text_pos == 'inline' then
|
||||
return ' = ' .. variable.value
|
||||
|
@ -72,7 +72,7 @@ in {
|
|||
only_first_definition = onlyFirstDefinition;
|
||||
all_references = allReferences;
|
||||
clear_on_continue = clearOnContinue;
|
||||
display_callback = helpers.mkRaw displayCallback;
|
||||
display_callback = displayCallback;
|
||||
virt_text_pos = virtTextPos;
|
||||
all_frames = allFrames;
|
||||
virt_lines = virtLines;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue