mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-01 04:44:31 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -5,10 +5,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-go;
|
||||
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
|
||||
in {
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-go = {
|
||||
enable = mkEnableOption "dap-go";
|
||||
|
||||
|
@ -22,7 +24,9 @@ in {
|
|||
delve = {
|
||||
path = helpers.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 =
|
||||
helpers.defaultNullOpts.mkInt 20
|
||||
"Time to wait for delve to initialize the debug session.";
|
||||
|
||||
port = helpers.defaultNullOpts.mkStr "$\{port}" ''
|
||||
A string that defines the port to start delve debugger.
|
||||
|
@ -36,19 +40,20 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg; {
|
||||
dap_configurations = dapConfigurations;
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
dap_configurations = dapConfigurations;
|
||||
|
||||
delve = with delve; {
|
||||
inherit path port args;
|
||||
initialize_timeout_sec = initializeTimeoutSec;
|
||||
build_flags = buildFlags;
|
||||
delve = with delve; {
|
||||
inherit path port args;
|
||||
initialize_timeout_sec = initializeTimeoutSec;
|
||||
build_flags = buildFlags;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
|
|
@ -5,22 +5,28 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-python;
|
||||
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
|
||||
in {
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-python = {
|
||||
enable = mkEnableOption "dap-python";
|
||||
|
||||
package = helpers.mkPackageOption "dap-python" pkgs.vimPlugins.nvim-dap-python;
|
||||
|
||||
adapterPythonPath = mkOption {
|
||||
default = "${pkgs.python3.withPackages (ps: with ps; [debugpy])}/bin/python3";
|
||||
default = "${pkgs.python3.withPackages (ps: with ps; [ debugpy ])}/bin/python3";
|
||||
description = "Path to the python interpreter. Path must be absolute or in $PATH and needs to have the debugpy package installed.";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
console = helpers.defaultNullOpts.mkEnumFirstDefault ["integratedTerminal" "internalConsole" "externalTerminal"] "Debugpy console.";
|
||||
console = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"integratedTerminal"
|
||||
"internalConsole"
|
||||
"externalTerminal"
|
||||
] "Debugpy console.";
|
||||
|
||||
customConfigurations = helpers.mkNullOrOption (types.listOf dapHelpers.configurationOption) "Custom python configurations for dap.";
|
||||
|
||||
|
@ -46,30 +52,27 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg; {
|
||||
inherit console;
|
||||
include_configs = includeConfigs;
|
||||
};
|
||||
in
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
inherit console;
|
||||
include_configs = includeConfigs;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
||||
extensionConfigLua = with helpers;
|
||||
extensionConfigLua =
|
||||
with helpers;
|
||||
''
|
||||
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject options})
|
||||
''
|
||||
+ (optionalString (cfg.testRunners != null) ''
|
||||
table.insert(require("dap-python").test_runners,
|
||||
${
|
||||
toLuaObject
|
||||
(
|
||||
builtins.mapAttrs (_: mkRaw) cfg.testRunners
|
||||
)
|
||||
})
|
||||
${toLuaObject (builtins.mapAttrs (_: mkRaw) cfg.testRunners)})
|
||||
'')
|
||||
+ (optionalString (cfg.customConfigurations != null) ''
|
||||
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
|
||||
|
|
|
@ -5,20 +5,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-ui;
|
||||
|
||||
mkSizeOption =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
either int (numbers.between 0.0 1.0)
|
||||
);
|
||||
mkSizeOption = helpers.mkNullOrOption (with types; either int (numbers.between 0.0 1.0));
|
||||
|
||||
mkKeymapOptions = name:
|
||||
mkKeymapOptions =
|
||||
name:
|
||||
mapAttrs (
|
||||
key: default:
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "${default}" "Map `${key}` for ${name}"
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "${
|
||||
default
|
||||
}" "Map `${key}` for ${name}"
|
||||
);
|
||||
|
||||
elementOption = types.submodule {
|
||||
|
@ -32,7 +31,7 @@ with lib; let
|
|||
layoutOption = types.submodule {
|
||||
options = {
|
||||
elements = mkOption {
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Elements to display in this layout.";
|
||||
type = with types; listOf (either str elementOption);
|
||||
};
|
||||
|
@ -46,178 +45,185 @@ with lib; let
|
|||
position = mkOption {
|
||||
default = "left";
|
||||
description = "Which side of editor to open layout on.";
|
||||
type = types.enum ["left" "right" "top" "bottom"];
|
||||
type = types.enum [
|
||||
"left"
|
||||
"right"
|
||||
"top"
|
||||
"bottom"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.plugins.dap.extensions.dap-ui =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "dap-ui";
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-ui = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "dap-ui";
|
||||
|
||||
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
|
||||
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
|
||||
|
||||
controls = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
|
||||
controls = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
|
||||
|
||||
element =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["repl" "scopes" "stacks" "watches" "breakpoints" "console"]
|
||||
"Element to show the controls on.";
|
||||
|
||||
icons = {
|
||||
disconnect = helpers.defaultNullOpts.mkStr "" "";
|
||||
pause = helpers.defaultNullOpts.mkStr "" "";
|
||||
play = helpers.defaultNullOpts.mkStr "" "";
|
||||
run_last = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_into = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_over = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_out = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_back = helpers.defaultNullOpts.mkStr "" "";
|
||||
terminate = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
};
|
||||
|
||||
elementMappings = helpers.mkNullOrOption (
|
||||
types.attrsOf (
|
||||
types.submodule {
|
||||
options = mkKeymapOptions "element mapping overrides" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
}
|
||||
)
|
||||
) "Per-element overrides of global mappings.";
|
||||
|
||||
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||
|
||||
floating = {
|
||||
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
||||
|
||||
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
||||
|
||||
mappings =
|
||||
helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui floating" {
|
||||
close = ''["<ESC>" "q"]'';
|
||||
};
|
||||
})
|
||||
"Keys to trigger actions in elements.";
|
||||
};
|
||||
|
||||
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||
element = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"repl"
|
||||
"scopes"
|
||||
"stacks"
|
||||
"watches"
|
||||
"breakpoints"
|
||||
"console"
|
||||
] "Element to show the controls on.";
|
||||
|
||||
icons = {
|
||||
collapsed = helpers.defaultNullOpts.mkStr "" "";
|
||||
current_frame = helpers.defaultNullOpts.mkStr "" "";
|
||||
expanded = helpers.defaultNullOpts.mkStr "" "";
|
||||
disconnect = helpers.defaultNullOpts.mkStr "" "";
|
||||
pause = helpers.defaultNullOpts.mkStr "" "";
|
||||
play = helpers.defaultNullOpts.mkStr "" "";
|
||||
run_last = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_into = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_over = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_out = helpers.defaultNullOpts.mkStr "" "";
|
||||
step_back = helpers.defaultNullOpts.mkStr "" "";
|
||||
terminate = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
|
||||
layouts =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf layoutOption)
|
||||
''
|
||||
```nix
|
||||
[
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "scopes";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "breakpoints";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "stacks";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "watches";
|
||||
size = 0.25;
|
||||
}
|
||||
];
|
||||
position = "left";
|
||||
size = 40;
|
||||
}
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "repl";
|
||||
size = 0.5;
|
||||
}
|
||||
{
|
||||
id = "console";
|
||||
size = 0.5;
|
||||
}
|
||||
];
|
||||
position = "bottom";
|
||||
size = 10;
|
||||
}
|
||||
];
|
||||
```
|
||||
''
|
||||
"List of layouts for dap-ui.";
|
||||
|
||||
mappings =
|
||||
helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
})
|
||||
"Keys to trigger actions in elements.";
|
||||
|
||||
render = {
|
||||
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
|
||||
|
||||
maxTypeLength = helpers.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.";
|
||||
};
|
||||
|
||||
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
A function which returns a window to be used for opening buffers such as a stack frame location.
|
||||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg;
|
||||
{
|
||||
inherit controls icons layouts mappings;
|
||||
|
||||
element_mappings = elementMappings;
|
||||
|
||||
floating = with floating; {
|
||||
inherit border mappings;
|
||||
max_height = maxHeight;
|
||||
max_width = maxWidth;
|
||||
elementMappings = helpers.mkNullOrOption (types.attrsOf (
|
||||
types.submodule {
|
||||
options = mkKeymapOptions "element mapping overrides" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
|
||||
force_buffers = forceBuffers;
|
||||
|
||||
render = with render; {
|
||||
inherit indent;
|
||||
max_type_length = maxTypeLength;
|
||||
max_value_lines = maxValueLines;
|
||||
};
|
||||
|
||||
select_window = selectWindow;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
)) "Per-element overrides of global mappings.";
|
||||
|
||||
expandLines = helpers.defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||
|
||||
floating = {
|
||||
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
||||
|
||||
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
||||
|
||||
mappings = helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui floating" { close = ''["<ESC>" "q"]''; };
|
||||
}) "Keys to trigger actions in elements.";
|
||||
};
|
||||
|
||||
forceBuffers = helpers.defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||
|
||||
icons = {
|
||||
collapsed = helpers.defaultNullOpts.mkStr "" "";
|
||||
current_frame = helpers.defaultNullOpts.mkStr "" "";
|
||||
expanded = helpers.defaultNullOpts.mkStr "" "";
|
||||
};
|
||||
|
||||
layouts = helpers.defaultNullOpts.mkNullable (types.listOf layoutOption) ''
|
||||
```nix
|
||||
[
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "scopes";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "breakpoints";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "stacks";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "watches";
|
||||
size = 0.25;
|
||||
}
|
||||
];
|
||||
position = "left";
|
||||
size = 40;
|
||||
}
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "repl";
|
||||
size = 0.5;
|
||||
}
|
||||
{
|
||||
id = "console";
|
||||
size = 0.5;
|
||||
}
|
||||
];
|
||||
position = "bottom";
|
||||
size = 10;
|
||||
}
|
||||
];
|
||||
```
|
||||
'' "List of layouts for dap-ui.";
|
||||
|
||||
mappings = helpers.mkNullOrOption (types.submodule {
|
||||
options = mkKeymapOptions "dap-ui" {
|
||||
edit = "e";
|
||||
expand = ''["<CR>" "<2-LeftMouse>"]'';
|
||||
open = "o";
|
||||
remove = "d";
|
||||
repl = "r";
|
||||
toggle = "t";
|
||||
};
|
||||
}) "Keys to trigger actions in elements.";
|
||||
|
||||
render = {
|
||||
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
|
||||
|
||||
maxTypeLength = helpers.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.";
|
||||
};
|
||||
|
||||
selectWindow = helpers.defaultNullOpts.mkLuaFn "null" ''
|
||||
A function which returns a window to be used for opening buffers such as a stack frame location.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
inherit
|
||||
controls
|
||||
icons
|
||||
layouts
|
||||
mappings
|
||||
;
|
||||
|
||||
element_mappings = elementMappings;
|
||||
|
||||
floating = with floating; {
|
||||
inherit border mappings;
|
||||
max_height = maxHeight;
|
||||
max_width = maxWidth;
|
||||
};
|
||||
|
||||
force_buffers = forceBuffers;
|
||||
|
||||
render = with render; {
|
||||
inherit indent;
|
||||
max_type_length = maxTypeLength;
|
||||
max_value_lines = maxValueLines;
|
||||
};
|
||||
|
||||
select_window = selectWindow;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap.extensions.dap-virtual-text;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.dap.extensions.dap-virtual-text = {
|
||||
enable = mkEnableOption "dap-virtual-text";
|
||||
|
||||
|
@ -61,26 +63,27 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg; {
|
||||
inherit commented;
|
||||
config =
|
||||
let
|
||||
options = with cfg; {
|
||||
inherit commented;
|
||||
|
||||
enabled_commands = enabledCommands;
|
||||
highlight_changed_variables = highlightChangedVariables;
|
||||
highlight_new_as_changed = highlightNewAsChanged;
|
||||
show_stop_reason = showStopReason;
|
||||
only_first_definition = onlyFirstDefinition;
|
||||
all_references = allReferences;
|
||||
clear_on_continue = clearOnContinue;
|
||||
display_callback = displayCallback;
|
||||
virt_text_pos = virtTextPos;
|
||||
all_frames = allFrames;
|
||||
virt_lines = virtLines;
|
||||
virt_text_win_col = virtTextWinCol;
|
||||
};
|
||||
in
|
||||
enabled_commands = enabledCommands;
|
||||
highlight_changed_variables = highlightChangedVariables;
|
||||
highlight_new_as_changed = highlightNewAsChanged;
|
||||
show_stop_reason = showStopReason;
|
||||
only_first_definition = onlyFirstDefinition;
|
||||
all_references = allReferences;
|
||||
clear_on_continue = clearOnContinue;
|
||||
display_callback = displayCallback;
|
||||
virt_text_pos = virtTextPos;
|
||||
all_frames = allFrames;
|
||||
virt_lines = virtLines;
|
||||
virt_text_win_col = virtTextWinCol;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.dap = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,40 +1,37 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
mkAdapterType = attrs:
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
rec {
|
||||
mkAdapterType =
|
||||
attrs:
|
||||
types.submodule {
|
||||
options =
|
||||
{
|
||||
id = helpers.mkNullOrOption types.str ''
|
||||
Identifier of the adapter. This is used for the
|
||||
`adapterId` property of the initialize request.
|
||||
For most debug adapters setting this is not necessary.
|
||||
options = {
|
||||
id = helpers.mkNullOrOption types.str ''
|
||||
Identifier of the adapter. This is used for the
|
||||
`adapterId` property of the initialize request.
|
||||
For most debug adapters setting this is not necessary.
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
options = {
|
||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
|
||||
How many seconds the client waits for a response on a initialize request before emitting a warning.
|
||||
'';
|
||||
|
||||
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.
|
||||
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
|
||||
How many seconds the client waits for a disconnect response from the debug
|
||||
adapter before emitting a warning and closing the connection.
|
||||
'';
|
||||
|
||||
options = {
|
||||
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
|
||||
How many seconds the client waits for a response on a initialize request before emitting a warning.
|
||||
'';
|
||||
|
||||
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
|
||||
How many seconds the client waits for a disconnect response from the debug
|
||||
adapter before emitting a warning and closing the connection.
|
||||
'';
|
||||
|
||||
sourceFiletype = helpers.mkNullOrOption types.str ''
|
||||
The filetype to use for content retrieved via a source request.
|
||||
'';
|
||||
};
|
||||
}
|
||||
// attrs;
|
||||
sourceFiletype = helpers.mkNullOrOption types.str ''
|
||||
The filetype to use for content retrieved via a source request.
|
||||
'';
|
||||
};
|
||||
} // attrs;
|
||||
};
|
||||
|
||||
executableAdapterOption = mkAdapterType {
|
||||
|
@ -54,7 +51,7 @@ with lib; rec {
|
|||
serverAdapterOption = mkAdapterType {
|
||||
host = helpers.defaultNullOpts.mkStr "127.0.0.1" "Host to connect to.";
|
||||
|
||||
port = helpers.mkNullOrOption (types.either types.int (types.enum ["$\{port}"])) ''
|
||||
port = helpers.mkNullOrOption (types.either types.int (types.enum [ "$\{port}" ])) ''
|
||||
Port to connect to.
|
||||
If "$\{port}" dap resolves a free port.
|
||||
This is intended to be used with `executable.args`.
|
||||
|
@ -76,7 +73,8 @@ with lib; rec {
|
|||
'';
|
||||
};
|
||||
|
||||
mkAdapterOption = name: type:
|
||||
mkAdapterOption =
|
||||
name: type:
|
||||
helpers.mkNullOrOption (with types; attrsOf (either str type)) ''
|
||||
Debug adapters of `${name}` type.
|
||||
The adapters can also be set to a function which takes three arguments:
|
||||
|
@ -100,7 +98,10 @@ with lib; rec {
|
|||
};
|
||||
|
||||
request = mkOption {
|
||||
type = types.enum ["attach" "launch"];
|
||||
type = types.enum [
|
||||
"attach"
|
||||
"launch"
|
||||
];
|
||||
description = ''
|
||||
Indicates whether the debug adapter should launch a debuggee or attach to one that is already running.
|
||||
'';
|
||||
|
@ -120,18 +121,20 @@ with lib; rec {
|
|||
numhl = helpers.mkNullOrOption types.str "`numhl` for sign.";
|
||||
};
|
||||
|
||||
processAdapters = type: adapters:
|
||||
processAdapters =
|
||||
type: adapters:
|
||||
with builtins;
|
||||
mapAttrs (_: adapter:
|
||||
if isString adapter
|
||||
then helpers.mkRaw adapter
|
||||
else
|
||||
filterAttrs (n: _: n != "enrichConfig") (
|
||||
adapter
|
||||
// {
|
||||
inherit type;
|
||||
enrich_config = adapter.enrichConfig;
|
||||
}
|
||||
))
|
||||
adapters;
|
||||
mapAttrs (
|
||||
_: adapter:
|
||||
if isString adapter then
|
||||
helpers.mkRaw adapter
|
||||
else
|
||||
filterAttrs (n: _: n != "enrichConfig") (
|
||||
adapter
|
||||
// {
|
||||
inherit type;
|
||||
enrich_config = adapter.enrichConfig;
|
||||
}
|
||||
)
|
||||
) adapters;
|
||||
}
|
||||
|
|
|
@ -5,70 +5,70 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.dap;
|
||||
dapHelpers = import ./dapHelpers.nix {inherit lib helpers;};
|
||||
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
|
||||
in
|
||||
with dapHelpers; {
|
||||
imports = [
|
||||
./dap-go.nix
|
||||
./dap-python.nix
|
||||
./dap-ui.nix
|
||||
./dap-virtual-text.nix
|
||||
];
|
||||
with dapHelpers;
|
||||
{
|
||||
imports = [
|
||||
./dap-go.nix
|
||||
./dap-python.nix
|
||||
./dap-ui.nix
|
||||
./dap-virtual-text.nix
|
||||
];
|
||||
|
||||
options.plugins.dap =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "dap";
|
||||
options.plugins.dap = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "dap";
|
||||
|
||||
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
|
||||
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
|
||||
|
||||
adapters = helpers.mkCompositeOption "Dap adapters." {
|
||||
executables = mkAdapterOption "executable" executableAdapterOption;
|
||||
servers = mkAdapterOption "server" serverAdapterOption;
|
||||
};
|
||||
adapters = helpers.mkCompositeOption "Dap adapters." {
|
||||
executables = mkAdapterOption "executable" executableAdapterOption;
|
||||
servers = mkAdapterOption "server" serverAdapterOption;
|
||||
};
|
||||
|
||||
configurations = helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption)) ''
|
||||
configurations =
|
||||
helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption))
|
||||
''
|
||||
Debuggee configurations, see `:h dap-configuration` for more info.
|
||||
'';
|
||||
|
||||
signs = helpers.mkCompositeOption "Signs for dap." {
|
||||
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
||||
signs = helpers.mkCompositeOption "Signs for dap." {
|
||||
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
||||
|
||||
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
||||
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
||||
|
||||
dapLogPoint = mkSignOption "L" "Sign for log points.";
|
||||
dapLogPoint = mkSignOption "L" "Sign for log points.";
|
||||
|
||||
dapStopped = mkSignOption "→" "Sign to indicate where the debuggee is stopped.";
|
||||
dapStopped = mkSignOption "→" "Sign to indicate where the debuggee is stopped.";
|
||||
|
||||
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
|
||||
};
|
||||
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
|
||||
};
|
||||
|
||||
extensionConfigLua = mkOption {
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Extension configuration for dap. Don't use this directly !
|
||||
'';
|
||||
default = "";
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
extensionConfigLua = mkOption {
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Extension configuration for dap. Don't use this directly !
|
||||
'';
|
||||
default = "";
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
options = with cfg;
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
inherit configurations;
|
||||
|
||||
adapters =
|
||||
(
|
||||
lib.optionalAttrs (adapters.executables != null)
|
||||
(processAdapters "executable" adapters.executables)
|
||||
)
|
||||
// (
|
||||
lib.optionalAttrs (adapters.servers != null)
|
||||
(processAdapters "server" adapters.servers)
|
||||
);
|
||||
(lib.optionalAttrs (adapters.executables != null) (
|
||||
processAdapters "executable" adapters.executables
|
||||
))
|
||||
// (lib.optionalAttrs (adapters.servers != null) (processAdapters "server" adapters.servers));
|
||||
|
||||
signs = with signs; {
|
||||
DapBreakpoint = dapBreakpoint;
|
||||
|
@ -80,22 +80,22 @@ in
|
|||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.adapters != null) ''
|
||||
require("dap").adapters = ${helpers.toLuaObject options.adapters}
|
||||
'')
|
||||
+ (optionalString (options.configurations != null) ''
|
||||
require("dap").configurations = ${helpers.toLuaObject options.configurations}
|
||||
'')
|
||||
+ (optionalString (cfg.signs != null) ''
|
||||
local __dap_signs = ${helpers.toLuaObject options.signs}
|
||||
for sign_name, sign in pairs(__dap_signs) do
|
||||
vim.fn.sign_define(sign_name, sign)
|
||||
end
|
||||
'')
|
||||
+ cfg.extensionConfigLua;
|
||||
};
|
||||
}
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.adapters != null) ''
|
||||
require("dap").adapters = ${helpers.toLuaObject options.adapters}
|
||||
'')
|
||||
+ (optionalString (options.configurations != null) ''
|
||||
require("dap").configurations = ${helpers.toLuaObject options.configurations}
|
||||
'')
|
||||
+ (optionalString (cfg.signs != null) ''
|
||||
local __dap_signs = ${helpers.toLuaObject options.signs}
|
||||
for sign_name, sign in pairs(__dap_signs) do
|
||||
vim.fn.sign_define(sign_name, sign)
|
||||
end
|
||||
'')
|
||||
+ cfg.extensionConfigLua;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue