mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-13 16:25:04 +00:00
nvim-dap: add adapters option
This commit is contained in:
parent
9ba45374ef
commit
f3466fe629
1 changed files with 231 additions and 3 deletions
|
|
@ -4,9 +4,213 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool attrsOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.types) bool attrsOf str submodule anything either enum oneOf listOf nullOr int;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (config.vim.lib) mkMappingOption;
|
||||
|
||||
commonOptions = {
|
||||
initialize_timeout_sec = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
defaultText = "4"; # plugin default
|
||||
description = ''
|
||||
How many seconds to wait for a response on an initialize request before
|
||||
emitting a warning
|
||||
'';
|
||||
};
|
||||
|
||||
disconnect_timeout_sec = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
defaultText = "3"; # plugin default
|
||||
description = ''
|
||||
How many seconds to wait for a disconnect response before
|
||||
emitting a warning and closing the connection
|
||||
'';
|
||||
};
|
||||
|
||||
source_filetype = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The filetype to use for content retrieved via a source request
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
execAdapterType = submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = enum ["executable"];
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = str;
|
||||
description = "Command to invoke";
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
options =
|
||||
commonOptions
|
||||
// {
|
||||
env = mkOption {
|
||||
type = nullOr (attrsOf str);
|
||||
default = null;
|
||||
description = "Environment variables passed to the command";
|
||||
};
|
||||
|
||||
cwd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Set the working directory for the command";
|
||||
};
|
||||
|
||||
detached = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
defaultText = "true"; # plugin default
|
||||
description = ''
|
||||
Whether to spawn the debug adapter process in a detached state
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
id = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Identifier of the adapter. This is used for the `adapterId` property
|
||||
of the initialize request.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
serverPipeExecutable = submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Command that spawns the debug adapter";
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
};
|
||||
|
||||
detached = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
defaultText = "true"; # plugin default
|
||||
description = ''
|
||||
Whether to spawn the debug adapter process in a detached state
|
||||
'';
|
||||
};
|
||||
|
||||
cwd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Working directory";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
serverAdapterType = submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = enum ["server"];
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
defaultText = "127.0.0.1"; # plugin default
|
||||
description = "Host to connect to";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = either int (enum ["\${port}"]);
|
||||
description = ''
|
||||
Port to connect to. Use "''${port}" for a dynamically resolved free
|
||||
port. This is intended to be used with executable.args.
|
||||
'';
|
||||
};
|
||||
|
||||
id = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Identifier of the adapter. This is used for the `adapterId` property
|
||||
of the initialize request.
|
||||
'';
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = nullOr serverPipeExecutable;
|
||||
default = null;
|
||||
description = ''
|
||||
Optional executable configuration to launch the debug adapter before
|
||||
connecting via TCP
|
||||
'';
|
||||
};
|
||||
|
||||
options =
|
||||
commonOptions
|
||||
// {
|
||||
max_retries = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
defaultText = "14"; # plugin default
|
||||
description = ''
|
||||
Amount of times the client should attempt to connect before
|
||||
erroring out (250ms delay between retries)
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
pipeAdapterType = submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = enum ["pipe"];
|
||||
};
|
||||
|
||||
pipe = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
Absolute path to the pipe file. Use \"''${pipe}\" for a dynamically
|
||||
generated temporary filename
|
||||
'';
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = nullOr serverPipeExecutable;
|
||||
default = null;
|
||||
description = ''
|
||||
Optional executable configuration to launch the debug adapter before
|
||||
connecting via pipe
|
||||
'';
|
||||
};
|
||||
|
||||
options =
|
||||
commonOptions
|
||||
// {
|
||||
timeout = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
defaultText = "5000"; # plugin default
|
||||
description = ''
|
||||
Max amount of time in ms to wait between spawning the
|
||||
executable and connecting to the pipe
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.debugger.nvim-dap = {
|
||||
enable = mkEnableOption "debugging via nvim-dap";
|
||||
|
|
@ -19,7 +223,10 @@ in {
|
|||
autoStart = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Automatically Opens and Closes DAP-UI upon starting/closing a debugging session";
|
||||
description = ''
|
||||
Automatically Opens and Closes DAP-UI upon starting/closing a
|
||||
debugging session
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -29,6 +236,27 @@ in {
|
|||
type = attrsOf str;
|
||||
};
|
||||
|
||||
adapters = mkOption {
|
||||
type = attrsOf (oneOf [
|
||||
execAdapterType
|
||||
serverAdapterType
|
||||
pipeAdapterType
|
||||
luaInline
|
||||
]);
|
||||
default = {};
|
||||
description = "Adapter configurations. See `:help dap-adapter`";
|
||||
};
|
||||
|
||||
configurations = mkOption {
|
||||
type = attrsOf (listOf anything);
|
||||
default = {};
|
||||
description = ''
|
||||
Mapping of filetype to list of possible `Configuration`.
|
||||
|
||||
See `:help dap-configuration`.
|
||||
'';
|
||||
};
|
||||
|
||||
mappings = {
|
||||
continue = mkMappingOption "Continue" "<leader>dc";
|
||||
restart = mkMappingOption "Restart" "<leader>dR";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue