mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-09 08:44:32 +02:00
plugins/dap: remove helpers
This commit is contained in:
parent
e48dda4fe4
commit
216ae2bf40
6 changed files with 108 additions and 103 deletions
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
|
||||||
cfg = config.plugins.dap.extensions.dap-go;
|
cfg = config.plugins.dap.extensions.dap-go;
|
||||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
dapHelpers = import ./dapHelpers.nix { inherit lib; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.dap.extensions.dap-go = {
|
options.plugins.dap.extensions.dap-go = {
|
||||||
|
@ -22,25 +22,25 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
dapConfigurations = helpers.mkNullOrOption (types.listOf dapHelpers.configurationOption) ''
|
dapConfigurations = lib.nixvim.mkNullOrOption (types.listOf dapHelpers.configurationOption) ''
|
||||||
Additional dap configurations.
|
Additional dap configurations.
|
||||||
See `:h dap-configuration` for more detail.
|
See `:h dap-configuration` for more detail.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
delve = {
|
delve = {
|
||||||
path = helpers.defaultNullOpts.mkStr "dlv" "The path to the executable dlv which will be used for debugging.";
|
path = defaultNullOpts.mkStr "dlv" "The path to the executable dlv which will be used for debugging.";
|
||||||
|
|
||||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 20 "Time to wait for delve to initialize the debug session.";
|
initializeTimeoutSec = defaultNullOpts.mkInt 20 "Time to wait for delve to initialize the debug session.";
|
||||||
|
|
||||||
port = helpers.defaultNullOpts.mkStr "$\{port}" ''
|
port = defaultNullOpts.mkStr "$\{port}" ''
|
||||||
A string that defines the port to start delve debugger.
|
A string that defines the port to start delve debugger.
|
||||||
Defaults to string "$\{port}" which instructs dap
|
Defaults to string "$\{port}" which instructs dap
|
||||||
to start the process in a random available port.
|
to start the process in a random available port.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
args = helpers.mkNullOrOption (types.listOf types.str) "Additional args to pass to dlv.";
|
args = lib.nixvim.mkNullOrOption (types.listOf types.str) "Additional args to pass to dlv.";
|
||||||
|
|
||||||
buildFlags = helpers.defaultNullOpts.mkStr "" "Build flags to pass to dlv.";
|
buildFlags = defaultNullOpts.mkStr "" "Build flags to pass to dlv.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib)
|
||||||
|
optionalString
|
||||||
|
types
|
||||||
|
;
|
||||||
|
inherit (lib.nixvim)
|
||||||
|
defaultNullOpts
|
||||||
|
mkNullOrOption
|
||||||
|
toLuaObject
|
||||||
|
;
|
||||||
|
|
||||||
cfg = config.plugins.dap.extensions.dap-python;
|
cfg = config.plugins.dap.extensions.dap-python;
|
||||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
dapHelpers = import ./dapHelpers.nix { inherit lib; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plugins.dap.extensions.dap-python = {
|
options.plugins.dap.extensions.dap-python = {
|
||||||
|
@ -31,28 +38,28 @@ in
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
console = helpers.defaultNullOpts.mkEnumFirstDefault [
|
console = defaultNullOpts.mkEnumFirstDefault [
|
||||||
"integratedTerminal"
|
"integratedTerminal"
|
||||||
"internalConsole"
|
"internalConsole"
|
||||||
"externalTerminal"
|
"externalTerminal"
|
||||||
] "Debugpy console.";
|
] "Debugpy console.";
|
||||||
|
|
||||||
customConfigurations = helpers.mkNullOrOption (types.listOf dapHelpers.configurationOption) "Custom python configurations for dap.";
|
customConfigurations = mkNullOrOption (types.listOf dapHelpers.configurationOption) "Custom python configurations for dap.";
|
||||||
|
|
||||||
includeConfigs = helpers.defaultNullOpts.mkBool true "Add default configurations.";
|
includeConfigs = defaultNullOpts.mkBool true "Add default configurations.";
|
||||||
|
|
||||||
resolvePython = helpers.defaultNullOpts.mkLuaFn null ''
|
resolvePython = defaultNullOpts.mkLuaFn null ''
|
||||||
Function to resolve path to python to use for program or test execution.
|
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.
|
By default the `VIRTUAL_ENV` and `CONDA_PREFIX` environment variables are used if present.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
testRunner = helpers.mkNullOrOption (types.either types.str types.rawLua) ''
|
testRunner = mkNullOrOption (types.either types.str types.rawLua) ''
|
||||||
The name of test runner to use by default.
|
The name of test runner to use by default.
|
||||||
The default value is dynamic and depends on `pytest.ini` or `manage.py` markers.
|
The default value is dynamic and depends on `pytest.ini` or `manage.py` markers.
|
||||||
If neither is found "unittest" is used.
|
If neither is found "unittest" is used.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
testRunners = helpers.mkNullOrOption (with lib.types; attrsOf strLuaFn) ''
|
testRunners = mkNullOrOption (with lib.types; attrsOf strLuaFn) ''
|
||||||
Set to register test runners.
|
Set to register test runners.
|
||||||
Built-in are test runners for unittest, pytest and django.
|
Built-in are test runners for unittest, pytest and django.
|
||||||
The key is the test runner name, the value a function to generate the
|
The key is the test runner name, the value a function to generate the
|
||||||
|
@ -75,13 +82,12 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
extensionConfigLua =
|
extensionConfigLua =
|
||||||
with helpers;
|
|
||||||
''
|
''
|
||||||
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject options})
|
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject options})
|
||||||
''
|
''
|
||||||
+ (optionalString (cfg.testRunners != null) ''
|
+ (optionalString (cfg.testRunners != null) ''
|
||||||
table.insert(require("dap-python").test_runners,
|
table.insert(require("dap-python").test_runners,
|
||||||
${toLuaObject (builtins.mapAttrs (_: mkRaw) cfg.testRunners)})
|
${toLuaObject (builtins.mapAttrs (_: lib.nixvim.mkRaw) cfg.testRunners)})
|
||||||
'')
|
'')
|
||||||
+ (optionalString (cfg.customConfigurations != null) ''
|
+ (optionalString (cfg.customConfigurations != null) ''
|
||||||
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
|
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
|
||||||
|
|
|
@ -1,29 +1,27 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkOption types;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
|
||||||
cfg = config.plugins.dap.extensions.dap-ui;
|
cfg = config.plugins.dap.extensions.dap-ui;
|
||||||
|
|
||||||
mkSizeOption = helpers.mkNullOrOption (with types; either int (numbers.between 0.0 1.0));
|
mkSizeOption = lib.nixvim.mkNullOrOption (with types; either int (numbers.between 0.0 1.0));
|
||||||
|
|
||||||
mkKeymapOptions =
|
mkKeymapOptions =
|
||||||
name:
|
name:
|
||||||
lib.mapAttrs (
|
lib.mapAttrs (
|
||||||
key: default:
|
key: default:
|
||||||
helpers.defaultNullOpts.mkNullable (
|
defaultNullOpts.mkNullable (with types; either str (listOf str)) default "Map `${key}` for ${name}"
|
||||||
with types; either str (listOf str)
|
|
||||||
) default "Map `${key}` for ${name}"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
elementOption = types.submodule {
|
elementOption = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
id = helpers.mkNullOrOption types.str "Element ID.";
|
id = lib.nixvim.mkNullOrOption types.str "Element ID.";
|
||||||
|
|
||||||
size = mkSizeOption "Size of the element in lines/columns or as proportion of total editor size (0-1).";
|
size = mkSizeOption "Size of the element in lines/columns or as proportion of total editor size (0-1).";
|
||||||
};
|
};
|
||||||
|
@ -68,9 +66,9 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
controls = {
|
controls = {
|
||||||
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
|
enabled = defaultNullOpts.mkBool true "Enable controls";
|
||||||
|
|
||||||
element = helpers.defaultNullOpts.mkEnumFirstDefault [
|
element = defaultNullOpts.mkEnumFirstDefault [
|
||||||
"repl"
|
"repl"
|
||||||
"scopes"
|
"scopes"
|
||||||
"stacks"
|
"stacks"
|
||||||
|
@ -80,19 +78,19 @@ in
|
||||||
] "Element to show the controls on.";
|
] "Element to show the controls on.";
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
disconnect = helpers.defaultNullOpts.mkStr "" "";
|
disconnect = defaultNullOpts.mkStr "" "";
|
||||||
pause = helpers.defaultNullOpts.mkStr "" "";
|
pause = defaultNullOpts.mkStr "" "";
|
||||||
play = helpers.defaultNullOpts.mkStr "" "";
|
play = defaultNullOpts.mkStr "" "";
|
||||||
run_last = helpers.defaultNullOpts.mkStr "" "";
|
run_last = defaultNullOpts.mkStr "" "";
|
||||||
step_into = helpers.defaultNullOpts.mkStr "" "";
|
step_into = defaultNullOpts.mkStr "" "";
|
||||||
step_over = helpers.defaultNullOpts.mkStr "" "";
|
step_over = defaultNullOpts.mkStr "" "";
|
||||||
step_out = helpers.defaultNullOpts.mkStr "" "";
|
step_out = defaultNullOpts.mkStr "" "";
|
||||||
step_back = helpers.defaultNullOpts.mkStr "" "";
|
step_back = defaultNullOpts.mkStr "" "";
|
||||||
terminate = helpers.defaultNullOpts.mkStr "" "";
|
terminate = defaultNullOpts.mkStr "" "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
elementMappings = helpers.mkNullOrOption (types.attrsOf (
|
elementMappings = lib.nixvim.mkNullOrOption (types.attrsOf (
|
||||||
types.submodule {
|
types.submodule {
|
||||||
options = mkKeymapOptions "element mapping overrides" {
|
options = mkKeymapOptions "element mapping overrides" {
|
||||||
edit = "e";
|
edit = "e";
|
||||||
|
@ -108,16 +106,16 @@ in
|
||||||
}
|
}
|
||||||
)) "Per-element overrides of global mappings.";
|
)) "Per-element overrides of global mappings.";
|
||||||
|
|
||||||
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
expandLines = defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||||
|
|
||||||
floating = {
|
floating = {
|
||||||
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
||||||
|
|
||||||
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
||||||
|
|
||||||
border = helpers.defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
border = defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
||||||
|
|
||||||
mappings = helpers.mkNullOrOption (types.submodule {
|
mappings = lib.nixvim.mkNullOrOption (types.submodule {
|
||||||
options = mkKeymapOptions "dap-ui floating" {
|
options = mkKeymapOptions "dap-ui floating" {
|
||||||
close = [
|
close = [
|
||||||
"<ESC>"
|
"<ESC>"
|
||||||
|
@ -127,15 +125,15 @@ in
|
||||||
}) "Keys to trigger actions in elements.";
|
}) "Keys to trigger actions in elements.";
|
||||||
};
|
};
|
||||||
|
|
||||||
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
forceBuffers = defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
collapsed = helpers.defaultNullOpts.mkStr "" "";
|
collapsed = defaultNullOpts.mkStr "" "";
|
||||||
current_frame = helpers.defaultNullOpts.mkStr "" "";
|
current_frame = defaultNullOpts.mkStr "" "";
|
||||||
expanded = helpers.defaultNullOpts.mkStr "" "";
|
expanded = defaultNullOpts.mkStr "" "";
|
||||||
};
|
};
|
||||||
|
|
||||||
layouts = helpers.defaultNullOpts.mkListOf layoutOption [
|
layouts = defaultNullOpts.mkListOf layoutOption [
|
||||||
{
|
{
|
||||||
elements = [
|
elements = [
|
||||||
{
|
{
|
||||||
|
@ -174,7 +172,7 @@ in
|
||||||
}
|
}
|
||||||
] "List of layouts for dap-ui.";
|
] "List of layouts for dap-ui.";
|
||||||
|
|
||||||
mappings = helpers.mkNullOrOption (types.submodule {
|
mappings = lib.nixvim.mkNullOrOption (types.submodule {
|
||||||
options = mkKeymapOptions "dap-ui" {
|
options = mkKeymapOptions "dap-ui" {
|
||||||
edit = "e";
|
edit = "e";
|
||||||
expand = [
|
expand = [
|
||||||
|
@ -189,14 +187,14 @@ in
|
||||||
}) "Keys to trigger actions in elements.";
|
}) "Keys to trigger actions in elements.";
|
||||||
|
|
||||||
render = {
|
render = {
|
||||||
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
|
indent = defaultNullOpts.mkInt 1 "Default indentation size.";
|
||||||
|
|
||||||
maxTypeLength = helpers.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
|
maxTypeLength = lib.nixvim.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
|
||||||
|
|
||||||
maxValueLines = helpers.defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
|
maxValueLines = defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
|
||||||
};
|
};
|
||||||
|
|
||||||
selectWindow = helpers.defaultNullOpts.mkLuaFn null ''
|
selectWindow = defaultNullOpts.mkLuaFn null ''
|
||||||
A function which returns a window to be used for opening buffers such as a stack frame location.
|
A function which returns a window to be used for opening buffers such as a stack frame location.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
|
||||||
cfg = config.plugins.dap.extensions.dap-virtual-text;
|
cfg = config.plugins.dap.extensions.dap-virtual-text;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -19,30 +20,30 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
enabledCommands = helpers.defaultNullOpts.mkBool true ''
|
enabledCommands = defaultNullOpts.mkBool true ''
|
||||||
Create commands `DapVirtualTextEnable`, `DapVirtualTextDisable`, `DapVirtualTextToggle`.
|
Create commands `DapVirtualTextEnable`, `DapVirtualTextDisable`, `DapVirtualTextToggle`.
|
||||||
(`DapVirtualTextForceRefresh` for refreshing when debug adapter did not notify its termination).
|
(`DapVirtualTextForceRefresh` for refreshing when debug adapter did not notify its termination).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
highlightChangedVariables = helpers.defaultNullOpts.mkBool true ''
|
highlightChangedVariables = defaultNullOpts.mkBool true ''
|
||||||
Highlight changed values with `NvimDapVirtualTextChanged`, else always `NvimDapVirtualText`.
|
Highlight changed values with `NvimDapVirtualTextChanged`, else always `NvimDapVirtualText`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
highlightNewAsChanged = helpers.defaultNullOpts.mkBool false ''
|
highlightNewAsChanged = defaultNullOpts.mkBool false ''
|
||||||
Highlight new variables in the same way as changed variables (if highlightChangedVariables).
|
Highlight new variables in the same way as changed variables (if highlightChangedVariables).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
showStopReason = helpers.defaultNullOpts.mkBool true "Show stop reason when stopped for exceptions.";
|
showStopReason = defaultNullOpts.mkBool true "Show stop reason when stopped for exceptions.";
|
||||||
|
|
||||||
commented = helpers.defaultNullOpts.mkBool false "Prefix virtual text with comment string.";
|
commented = defaultNullOpts.mkBool false "Prefix virtual text with comment string.";
|
||||||
|
|
||||||
onlyFirstDefinition = helpers.defaultNullOpts.mkBool true "Only show virtual text at first definition (if there are multiple).";
|
onlyFirstDefinition = defaultNullOpts.mkBool true "Only show virtual text at first definition (if there are multiple).";
|
||||||
|
|
||||||
allReferences = helpers.defaultNullOpts.mkBool false "Show virtual text on all all references of the variable (not only definitions).";
|
allReferences = defaultNullOpts.mkBool false "Show virtual text on all all references of the variable (not only definitions).";
|
||||||
|
|
||||||
clearOnContinue = helpers.defaultNullOpts.mkBool false "Clear virtual text on `continue` (might cause flickering when stepping).";
|
clearOnContinue = defaultNullOpts.mkBool false "Clear virtual text on `continue` (might cause flickering when stepping).";
|
||||||
|
|
||||||
displayCallback = helpers.defaultNullOpts.mkLuaFn ''
|
displayCallback = defaultNullOpts.mkLuaFn ''
|
||||||
function(variable, buf, stackframe, node, options)
|
function(variable, buf, stackframe, node, options)
|
||||||
if options.virt_text_pos == 'inline' then
|
if options.virt_text_pos == 'inline' then
|
||||||
return ' = ' .. variable.value
|
return ' = ' .. variable.value
|
||||||
|
@ -52,16 +53,16 @@ in
|
||||||
end,
|
end,
|
||||||
'' "A callback that determines how a variable is displayed or whether it should be omitted.";
|
'' "A callback that determines how a variable is displayed or whether it should be omitted.";
|
||||||
|
|
||||||
virtTextPos = helpers.defaultNullOpts.mkStr "vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol'" ''
|
virtTextPos = defaultNullOpts.mkStr "vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol'" ''
|
||||||
Position of virtual text, see `:h nvim_buf_set_extmark()`.
|
Position of virtual text, see `:h nvim_buf_set_extmark()`.
|
||||||
Default tries to inline the virtual text. Use 'eol' to set to end of line.
|
Default tries to inline the virtual text. Use 'eol' to set to end of line.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
allFrames = helpers.defaultNullOpts.mkBool false "Show virtual text for all stack frames not only current.";
|
allFrames = defaultNullOpts.mkBool false "Show virtual text for all stack frames not only current.";
|
||||||
|
|
||||||
virtLines = helpers.defaultNullOpts.mkBool false "Show virtual lines instead of virtual text (will flicker!).";
|
virtLines = defaultNullOpts.mkBool false "Show virtual lines instead of virtual text (will flicker!).";
|
||||||
|
|
||||||
virtTextWinCol = helpers.mkNullOrOption lib.types.int ''
|
virtTextWinCol = lib.nixvim.mkNullOrOption lib.types.int ''
|
||||||
Position the virtual text at a fixed window column (starting from the first text column).
|
Position the virtual text at a fixed window column (starting from the first text column).
|
||||||
See `:h nvim_buf_set_extmark()`.
|
See `:h nvim_buf_set_extmark()`.
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,35 +1,36 @@
|
||||||
{ lib, helpers }:
|
{ lib }:
|
||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
|
inherit (lib.nixvim) mkNullOrOption;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
mkAdapterType =
|
mkAdapterType =
|
||||||
attrs:
|
attrs:
|
||||||
types.submodule {
|
types.submodule {
|
||||||
options = {
|
options = {
|
||||||
id = helpers.mkNullOrOption types.str ''
|
id = mkNullOrOption types.str ''
|
||||||
Identifier of the adapter. This is used for the
|
Identifier of the adapter. This is used for the
|
||||||
`adapterId` property of the initialize request.
|
`adapterId` property of the initialize request.
|
||||||
For most debug adapters setting this is not necessary.
|
For most debug adapters setting this is not necessary.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enrichConfig = helpers.mkNullOrLuaFn ''
|
enrichConfig = lib.nixvim.mkNullOrLuaFn ''
|
||||||
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
|
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
|
||||||
configuration with additional information. It receives a configuration as first
|
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.
|
argument, and a callback that must be called with the final configuration as second argument.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
|
initializeTimeoutSec = lib.nixvim.defaultNullOpts.mkInt 4 ''
|
||||||
How many seconds the client waits for a response on a initialize request before emitting a warning.
|
How many seconds the client waits for a response on a initialize request before emitting a warning.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
|
disconnectTimeoutSec = lib.nixvim.defaultNullOpts.mkInt 3 ''
|
||||||
How many seconds the client waits for a disconnect response from the debug
|
How many seconds the client waits for a disconnect response from the debug
|
||||||
adapter before emitting a warning and closing the connection.
|
adapter before emitting a warning and closing the connection.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sourceFiletype = helpers.mkNullOrOption types.str ''
|
sourceFiletype = mkNullOrOption types.str ''
|
||||||
The filetype to use for content retrieved via a source request.
|
The filetype to use for content retrieved via a source request.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -37,39 +38,39 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
executableAdapterOption = mkAdapterType {
|
executableAdapterOption = mkAdapterType {
|
||||||
command = helpers.mkNullOrOption types.str "The command to invoke.";
|
command = mkNullOrOption types.str "The command to invoke.";
|
||||||
|
|
||||||
args = helpers.mkNullOrOption (types.listOf types.str) "Arguments for the command.";
|
args = mkNullOrOption (types.listOf types.str) "Arguments for the command.";
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
env = helpers.mkNullOrOption types.attrs "Set the environment variables for the command.";
|
env = mkNullOrOption types.attrs "Set the environment variables for the command.";
|
||||||
|
|
||||||
cwd = helpers.mkNullOrOption types.str "Set the working directory for the command.";
|
cwd = mkNullOrOption types.str "Set the working directory for the command.";
|
||||||
|
|
||||||
detached = helpers.defaultNullOpts.mkBool true "Start the debug adapter in a detached state.";
|
detached = lib.nixvim.defaultNullOpts.mkBool true "Start the debug adapter in a detached state.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
serverAdapterOption = mkAdapterType {
|
serverAdapterOption = mkAdapterType {
|
||||||
host = helpers.defaultNullOpts.mkStr "127.0.0.1" "Host to connect to.";
|
host = lib.nixvim.defaultNullOpts.mkStr "127.0.0.1" "Host to connect to.";
|
||||||
|
|
||||||
port = helpers.mkNullOrOption (types.either types.int (types.enum [ "$\{port}" ])) ''
|
port = mkNullOrOption (types.either types.int (types.enum [ "$\{port}" ])) ''
|
||||||
Port to connect to.
|
Port to connect to.
|
||||||
If "$\{port}" dap resolves a free port.
|
If "$\{port}" dap resolves a free port.
|
||||||
This is intended to be used with `executable.args`.
|
This is intended to be used with `executable.args`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
executable = {
|
executable = {
|
||||||
command = helpers.mkNullOrOption types.str "Command that spawns the adapter.";
|
command = mkNullOrOption types.str "Command that spawns the adapter.";
|
||||||
|
|
||||||
args = helpers.mkNullOrOption (types.listOf types.str) "Command arguments.";
|
args = mkNullOrOption (types.listOf types.str) "Command arguments.";
|
||||||
|
|
||||||
detached = helpers.defaultNullOpts.mkBool true "Spawn the debug adapter in detached state.";
|
detached = lib.nixvim.defaultNullOpts.mkBool true "Spawn the debug adapter in detached state.";
|
||||||
|
|
||||||
cwd = helpers.mkNullOrOption types.str "Working directory.";
|
cwd = mkNullOrOption types.str "Working directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
options.maxRetries = helpers.defaultNullOpts.mkInt 14 ''
|
options.maxRetries = lib.nixvim.defaultNullOpts.mkInt 14 ''
|
||||||
Amount of times the client should attempt to connect before erroring out.
|
Amount of times the client should attempt to connect before erroring out.
|
||||||
There is a 250ms delay between each retry.
|
There is a 250ms delay between each retry.
|
||||||
'';
|
'';
|
||||||
|
@ -77,7 +78,7 @@ rec {
|
||||||
|
|
||||||
mkAdapterOption =
|
mkAdapterOption =
|
||||||
name: type:
|
name: type:
|
||||||
helpers.mkNullOrOption (with types; attrsOf (either str type)) ''
|
mkNullOrOption (with types; attrsOf (either str type)) ''
|
||||||
Debug adapters of `${name}` type.
|
Debug adapters of `${name}` type.
|
||||||
The adapters can also be set to a function which takes three arguments:
|
The adapters can also be set to a function which takes three arguments:
|
||||||
|
|
||||||
|
@ -117,21 +118,20 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSignOption = default: desc: {
|
mkSignOption = default: desc: {
|
||||||
text = helpers.defaultNullOpts.mkStr default desc;
|
text = lib.nixvim.defaultNullOpts.mkStr default desc;
|
||||||
texthl = helpers.mkNullOrOption types.str "`texthl` for sign.";
|
texthl = mkNullOrOption types.str "`texthl` for sign.";
|
||||||
linehl = helpers.mkNullOrOption types.str "`linehl` for sign.";
|
linehl = mkNullOrOption types.str "`linehl` for sign.";
|
||||||
numhl = helpers.mkNullOrOption types.str "`numhl` for sign.";
|
numhl = mkNullOrOption types.str "`numhl` for sign.";
|
||||||
};
|
};
|
||||||
|
|
||||||
processAdapters =
|
processAdapters =
|
||||||
type: adapters:
|
type: adapters:
|
||||||
with builtins;
|
lib.mapAttrs (
|
||||||
mapAttrs (
|
|
||||||
_: adapter:
|
_: adapter:
|
||||||
if isString adapter then
|
if builtins.isString adapter then
|
||||||
helpers.mkRaw adapter
|
lib.nixvim.mkRaw adapter
|
||||||
else
|
else
|
||||||
filterAttrs (n: _: n != "enrichConfig") (
|
lib.filterAttrs (n: _: n != "enrichConfig") (
|
||||||
adapter
|
adapter
|
||||||
// {
|
// {
|
||||||
inherit type;
|
inherit type;
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkAdapterOption
|
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
mkOption
|
mkOption
|
||||||
mkSignOption
|
|
||||||
optionalString
|
optionalString
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
|
||||||
cfg = config.plugins.dap;
|
cfg = config.plugins.dap;
|
||||||
|
|
||||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
dapHelpers = import ./dapHelpers.nix { inherit lib; };
|
||||||
|
inherit (dapHelpers) mkSignOption;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -37,18 +35,18 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
adapters = helpers.mkCompositeOption "Dap adapters." {
|
adapters = lib.nixvim.mkCompositeOption "Dap adapters." {
|
||||||
executables = mkAdapterOption "executable" dapHelpers.executableAdapterOption;
|
executables = dapHelpers.mkAdapterOption "executable" dapHelpers.executableAdapterOption;
|
||||||
servers = mkAdapterOption "server" dapHelpers.serverAdapterOption;
|
servers = dapHelpers.mkAdapterOption "server" dapHelpers.serverAdapterOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
configurations =
|
configurations =
|
||||||
helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption))
|
lib.nixvim.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption))
|
||||||
''
|
''
|
||||||
Debuggee configurations, see `:h dap-configuration` for more info.
|
Debuggee configurations, see `:h dap-configuration` for more info.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
signs = helpers.mkCompositeOption "Signs for dap." {
|
signs = lib.nixvim.mkCompositeOption "Signs for dap." {
|
||||||
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
||||||
|
|
||||||
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
||||||
|
@ -79,9 +77,11 @@ in
|
||||||
|
|
||||||
adapters =
|
adapters =
|
||||||
(lib.optionalAttrs (adapters.executables != null) (
|
(lib.optionalAttrs (adapters.executables != null) (
|
||||||
processAdapters "executable" adapters.executables
|
dapHelpers.processAdapters "executable" adapters.executables
|
||||||
))
|
))
|
||||||
// (lib.optionalAttrs (adapters.servers != null) (processAdapters "server" adapters.servers));
|
// (lib.optionalAttrs (adapters.servers != null) (
|
||||||
|
dapHelpers.processAdapters "server" adapters.servers
|
||||||
|
));
|
||||||
|
|
||||||
signs = with signs; {
|
signs = with signs; {
|
||||||
DapBreakpoint = dapBreakpoint;
|
DapBreakpoint = dapBreakpoint;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue