mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
92 lines
2.8 KiB
Nix
92 lines
2.8 KiB
Nix
|
{
|
||
|
pkgs,
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
|
}:
|
||
|
with lib; let
|
||
|
cfg = config.plugins.dap;
|
||
|
helpers = import ../helpers.nix {inherit lib;};
|
||
|
dapHelpers = import ./dapHelpers.nix {inherit lib;};
|
||
|
in
|
||
|
with dapHelpers; {
|
||
|
imports = [
|
||
|
./dap-go.nix
|
||
|
./dap-python.nix
|
||
|
./dap-ui.nix
|
||
|
./dap-virtual-text.nix
|
||
|
];
|
||
|
|
||
|
options.plugins.dap =
|
||
|
helpers.extraOptionsOptions
|
||
|
// {
|
||
|
enable = mkEnableOption "dap";
|
||
|
|
||
|
package = helpers.mkPackageOption "dap" pkgs.vimPlugins.nvim-dap;
|
||
|
|
||
|
adapters = helpers.mkCompositeOption "Dap adapters." {
|
||
|
executables = mkAdapterOption "executable" executableAdapterOption;
|
||
|
servers = mkAdapterOption "server" serverAdapterOption;
|
||
|
};
|
||
|
|
||
|
configurations = helpers.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption)) ''
|
||
|
Debugee configurations, see `:h dap-configuration` for more info.
|
||
|
'';
|
||
|
|
||
|
signs = helpers.mkCompositeOption "Signs for dap." {
|
||
|
dapBreakpoint = mkSignOption "B" "Sign for breakpoints.";
|
||
|
|
||
|
dapBreakpointCondition = mkSignOption "C" "Sign for conditional breakpoints.";
|
||
|
|
||
|
dapLogPoint = mkSignOption "L" "Sign for log points.";
|
||
|
|
||
|
dapStopped = mkSignOption "→" "Sign to indicate where the debugee is stopped.";
|
||
|
|
||
|
dapBreakpointRejected = mkSignOption "R" "Sign to indicate breakpoints rejected by the debug adapter.";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
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)
|
||
|
);
|
||
|
|
||
|
signs = with signs; {
|
||
|
DapBreakpoint = dapBreakpoint;
|
||
|
DapBreakpointCondition = dapBreakpointCondition;
|
||
|
DapLogPoint = dapLogPoint;
|
||
|
DapStopped = dapStopped;
|
||
|
DapBreakpointRejected = dapBreakpointRejected;
|
||
|
};
|
||
|
}
|
||
|
// cfg.extraOptions;
|
||
|
in
|
||
|
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
|
||
|
'');
|
||
|
};
|
||
|
}
|