mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
plugins/dap-ui: migrate to mkNeovimPlugin
This commit is contained in:
parent
a70168e0fa
commit
9eae5db29a
5 changed files with 253 additions and 172 deletions
|
@ -1,15 +1,11 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkOption types;
|
||||||
inherit (lib.nixvim) defaultNullOpts;
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
|
||||||
cfg = config.plugins.dap.extensions.dap-ui;
|
|
||||||
|
|
||||||
mkSizeOption = lib.nixvim.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 =
|
||||||
|
@ -54,17 +50,15 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
options.plugins.dap.extensions.dap-ui = lib.nixvim.plugins.neovim.extraOptionsOptions // {
|
name = "dap-ui";
|
||||||
enable = lib.mkEnableOption "dap-ui";
|
moduleName = "dapui";
|
||||||
|
packPathName = "nvim-dap-ui";
|
||||||
|
package = "nvim-dap-ui";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "dap-ui" {
|
maintainers = [ lib.maintainers.khaneliman ];
|
||||||
default = [
|
|
||||||
"vimPlugins"
|
|
||||||
"nvim-dap-ui"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
controls = {
|
controls = {
|
||||||
enabled = defaultNullOpts.mkBool true "Enable controls";
|
enabled = defaultNullOpts.mkBool true "Enable controls";
|
||||||
|
|
||||||
|
@ -77,20 +71,20 @@ in
|
||||||
"console"
|
"console"
|
||||||
] "Element to show the controls on.";
|
] "Element to show the controls on.";
|
||||||
|
|
||||||
icons = {
|
icons = lib.mapAttrs (name: icon: defaultNullOpts.mkStr icon "The icon for ${name}.") {
|
||||||
disconnect = defaultNullOpts.mkStr "" "";
|
disconnect = "";
|
||||||
pause = defaultNullOpts.mkStr "" "";
|
pause = "";
|
||||||
play = defaultNullOpts.mkStr "" "";
|
play = "";
|
||||||
run_last = defaultNullOpts.mkStr "" "";
|
run_last = "";
|
||||||
step_into = defaultNullOpts.mkStr "" "";
|
step_into = "";
|
||||||
step_over = defaultNullOpts.mkStr "" "";
|
step_over = "";
|
||||||
step_out = defaultNullOpts.mkStr "" "";
|
step_out = "";
|
||||||
step_back = defaultNullOpts.mkStr "" "";
|
step_back = "";
|
||||||
terminate = defaultNullOpts.mkStr "" "";
|
terminate = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
elementMappings = lib.nixvim.mkNullOrOption (types.attrsOf (
|
element_mappings = lib.nixvim.mkNullOrOption (types.attrsOf (
|
||||||
types.submodule {
|
types.submodule {
|
||||||
options = mkKeymapOptions "element mapping overrides" {
|
options = mkKeymapOptions "element mapping overrides" {
|
||||||
edit = "e";
|
edit = "e";
|
||||||
|
@ -106,12 +100,12 @@ in
|
||||||
}
|
}
|
||||||
)) "Per-element overrides of global mappings.";
|
)) "Per-element overrides of global mappings.";
|
||||||
|
|
||||||
expandLines = defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
expand_lines = defaultNullOpts.mkBool true "Expand current line to hover window if larger than window size.";
|
||||||
|
|
||||||
floating = {
|
floating = {
|
||||||
maxHeight = mkSizeOption "Maximum height of the floating window.";
|
max_height = mkSizeOption "Maximum height of the floating window.";
|
||||||
|
|
||||||
maxWidth = mkSizeOption "Maximum width of the floating window.";
|
max_width = mkSizeOption "Maximum width of the floating window.";
|
||||||
|
|
||||||
border = defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
border = defaultNullOpts.mkBorder "single" "dap-ui floating window" "";
|
||||||
|
|
||||||
|
@ -125,7 +119,7 @@ in
|
||||||
}) "Keys to trigger actions in elements.";
|
}) "Keys to trigger actions in elements.";
|
||||||
};
|
};
|
||||||
|
|
||||||
forceBuffers = defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
force_buffers = defaultNullOpts.mkBool true "Prevents other buffers being loaded into dap-ui windows.";
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
collapsed = defaultNullOpts.mkStr "" "";
|
collapsed = defaultNullOpts.mkStr "" "";
|
||||||
|
@ -189,57 +183,17 @@ in
|
||||||
render = {
|
render = {
|
||||||
indent = defaultNullOpts.mkInt 1 "Default indentation size.";
|
indent = defaultNullOpts.mkInt 1 "Default indentation size.";
|
||||||
|
|
||||||
maxTypeLength = lib.nixvim.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
|
max_type_length = lib.nixvim.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
|
||||||
|
|
||||||
maxValueLines = defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
|
max_value_lines = defaultNullOpts.mkInt 100 "Maximum number of lines to allow a value to fill before trimming.";
|
||||||
};
|
};
|
||||||
|
|
||||||
selectWindow = defaultNullOpts.mkLuaFn null ''
|
select_window = 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.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
# NOTE: Renames added in https://github.com/nix-community/nixvim/pull/2897 (2025-01-26)
|
||||||
let
|
deprecateExtraOptions = true;
|
||||||
options =
|
imports = [ ./deprecations.nix ];
|
||||||
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
|
|
||||||
lib.mkIf cfg.enable {
|
|
||||||
extraPlugins = [ cfg.package ];
|
|
||||||
|
|
||||||
plugins.dap = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
extensionConfigLua = ''
|
|
||||||
require("dapui").setup(${lib.nixvim.toLuaObject options});
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
126
plugins/by-name/dap-ui/deprecations.nix
Normal file
126
plugins/by-name/dap-ui/deprecations.nix
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
oldPluginBasePath = [
|
||||||
|
"plugins"
|
||||||
|
"dap"
|
||||||
|
"extensions"
|
||||||
|
"dap-ui"
|
||||||
|
];
|
||||||
|
newPluginBasePath = [
|
||||||
|
"plugins"
|
||||||
|
"dap-ui"
|
||||||
|
];
|
||||||
|
|
||||||
|
settingsPath = newPluginBasePath ++ [ "settings" ];
|
||||||
|
|
||||||
|
renamedOptions = [
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"enabled"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"element"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"disconnect"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"pause"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"play"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"run_last"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"step_into"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"step_over"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"step_out"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"step_back"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"controls"
|
||||||
|
"icons"
|
||||||
|
"terminate"
|
||||||
|
]
|
||||||
|
[ "elementMappings" ]
|
||||||
|
[ "expandLines" ]
|
||||||
|
[
|
||||||
|
"floating"
|
||||||
|
"maxHeight"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"floating"
|
||||||
|
"maxWidth"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"floating"
|
||||||
|
"border"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"floating"
|
||||||
|
"mappings"
|
||||||
|
]
|
||||||
|
[ "forceBuffers" ]
|
||||||
|
[
|
||||||
|
"icons"
|
||||||
|
"collapsed"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"icons"
|
||||||
|
"current_frame"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"icons"
|
||||||
|
"expanded"
|
||||||
|
]
|
||||||
|
[ "layouts" ]
|
||||||
|
[ "mappings" ]
|
||||||
|
[
|
||||||
|
"render"
|
||||||
|
"indent"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"render"
|
||||||
|
"maxTypeLength"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"render"
|
||||||
|
"maxValueLines"
|
||||||
|
]
|
||||||
|
[ "selectWindow" ]
|
||||||
|
];
|
||||||
|
|
||||||
|
renameWarnings =
|
||||||
|
lib.nixvim.mkSettingsRenamedOptionModules oldPluginBasePath settingsPath
|
||||||
|
renamedOptions;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = renameWarnings ++ [
|
||||||
|
(lib.mkRenamedOptionModule (oldPluginBasePath ++ [ "enable" ]) (newPluginBasePath ++ [ "enable" ]))
|
||||||
|
];
|
||||||
|
}
|
|
@ -13,7 +13,6 @@ let
|
||||||
in
|
in
|
||||||
lib.nixvim.plugins.mkNeovimPlugin {
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
imports = [
|
imports = [
|
||||||
./dap-ui.nix
|
|
||||||
./dap-virtual-text.nix
|
./dap-virtual-text.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
99
tests/test-sources/plugins/by-name/dap-ui/default.nix
Normal file
99
tests/test-sources/plugins/by-name/dap-ui/default.nix
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.dap-ui.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
default = {
|
||||||
|
plugins.dap-ui = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
controls = {
|
||||||
|
element = "repl";
|
||||||
|
enabled = true;
|
||||||
|
icons = {
|
||||||
|
disconnect = "";
|
||||||
|
pause = "";
|
||||||
|
play = "";
|
||||||
|
run_last = "";
|
||||||
|
step_back = "";
|
||||||
|
step_into = "";
|
||||||
|
step_out = "";
|
||||||
|
step_over = "";
|
||||||
|
terminate = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
element_mappings = { };
|
||||||
|
expand_lines = true;
|
||||||
|
floating = {
|
||||||
|
border = "single";
|
||||||
|
mappings = {
|
||||||
|
close = [
|
||||||
|
"q"
|
||||||
|
"<Esc>"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
force_buffers = true;
|
||||||
|
icons = {
|
||||||
|
collapsed = "";
|
||||||
|
current_frame = "";
|
||||||
|
expanded = "";
|
||||||
|
};
|
||||||
|
layouts = [
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
mappings = {
|
||||||
|
edit = "e";
|
||||||
|
expand = [
|
||||||
|
"<CR>"
|
||||||
|
"<2-LeftMouse>"
|
||||||
|
];
|
||||||
|
open = "o";
|
||||||
|
remove = "d";
|
||||||
|
repl = "r";
|
||||||
|
toggle = "t";
|
||||||
|
};
|
||||||
|
render = {
|
||||||
|
indent = 1;
|
||||||
|
max_value_lines = 100;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,97 +0,0 @@
|
||||||
{
|
|
||||||
empty = {
|
|
||||||
plugins.dap.extensions.dap-ui.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
default = {
|
|
||||||
plugins.dap.extensions.dap-ui = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
controls = {
|
|
||||||
element = "repl";
|
|
||||||
enabled = true;
|
|
||||||
icons = {
|
|
||||||
disconnect = "";
|
|
||||||
pause = "";
|
|
||||||
play = "";
|
|
||||||
run_last = "";
|
|
||||||
step_back = "";
|
|
||||||
step_into = "";
|
|
||||||
step_out = "";
|
|
||||||
step_over = "";
|
|
||||||
terminate = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
elementMappings = { };
|
|
||||||
expandLines = true;
|
|
||||||
floating = {
|
|
||||||
border = "single";
|
|
||||||
mappings = {
|
|
||||||
close = [
|
|
||||||
"q"
|
|
||||||
"<Esc>"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
forceBuffers = true;
|
|
||||||
icons = {
|
|
||||||
collapsed = "";
|
|
||||||
current_frame = "";
|
|
||||||
expanded = "";
|
|
||||||
};
|
|
||||||
layouts = [
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
mappings = {
|
|
||||||
edit = "e";
|
|
||||||
expand = [
|
|
||||||
"<CR>"
|
|
||||||
"<2-LeftMouse>"
|
|
||||||
];
|
|
||||||
open = "o";
|
|
||||||
remove = "d";
|
|
||||||
repl = "r";
|
|
||||||
toggle = "t";
|
|
||||||
};
|
|
||||||
render = {
|
|
||||||
indent = 1;
|
|
||||||
maxValueLines = 100;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue