Skip to content

plugins/dap: add pipe type adapter #3627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions plugins/by-name/dap/dapHelpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ rec {
'';
};

pipeAdapterOption = mkAdapterType {
pipe = lib.nixvim.defaultNullOpts.mkStr "$\{pipe}" "Pipe name.";

executable = {
command = mkNullOrOption types.str "Command that spawns the adapter.";

args = mkNullOrOption (types.listOf types.str) "Command arguments.";

detached = lib.nixvim.defaultNullOpts.mkBool true "Spawn the debug adapter in detached state.";

cwd = mkNullOrOption types.str "Working directory.";
};

options.timeout = lib.nixvim.defaultNullOpts.mkInt 5000 ''
Max amount of time in ms to wait between spaning the executable and connecting to the pipe.
This gives the executable time to create the pipe
'';
};

mkAdapterOption =
name: type:
mkNullOrOption (with types; attrsOf (either str type)) ''
Expand Down
4 changes: 4 additions & 0 deletions plugins/by-name/dap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
adapters = lib.nixvim.mkCompositeOption "Dap adapters." {
executables = dapHelpers.mkAdapterOption "executable" dapHelpers.executableAdapterOption;
servers = dapHelpers.mkAdapterOption "server" dapHelpers.serverAdapterOption;
pipes = dapHelpers.mkAdapterOption "pipe" dapHelpers.pipeAdapterOption;
};

configurations =
Expand Down Expand Up @@ -70,6 +71,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
))
// (lib.optionalAttrs (cfg.adapters.servers != null) (
dapHelpers.processAdapters "server" cfg.adapters.servers
))
// (lib.optionalAttrs (cfg.adapters.pipes != null) (
dapHelpers.processAdapters "pipe" cfg.adapters.pipes
));

signs = with cfg.signs; {
Expand Down