Skip to content

Commit 4f3b721

Browse files
committed
plugins/dap: add pipe type adapter
1 parent ecc7880 commit 4f3b721

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

plugins/by-name/dap/dapHelpers.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ rec {
7777
'';
7878
};
7979

80+
pipeAdapterOption = mkAdapterType {
81+
pipe = lib.nixvim.defaultNullOpts.mkStr "$\{pipe}" "Pipe name.";
82+
83+
executable = {
84+
command = mkNullOrOption types.str "Command that spawns the adapter.";
85+
86+
args = mkNullOrOption (types.listOf types.str) "Command arguments.";
87+
88+
detached = lib.nixvim.defaultNullOpts.mkBool true "Spawn the debug adapter in detached state.";
89+
90+
cwd = mkNullOrOption types.str "Working directory.";
91+
};
92+
93+
options.timeout = lib.nixvim.defaultNullOpts.mkInt 5000 ''
94+
Max amount of time in ms to wait between spaning the executable and connecting to the pipe.
95+
This gives the executable time to create the pipe
96+
'';
97+
};
98+
8099
mkAdapterOption =
81100
name: type:
82101
mkNullOrOption (with types; attrsOf (either str type)) ''

plugins/by-name/dap/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
2626
adapters = lib.nixvim.mkCompositeOption "Dap adapters." {
2727
executables = dapHelpers.mkAdapterOption "executable" dapHelpers.executableAdapterOption;
2828
servers = dapHelpers.mkAdapterOption "server" dapHelpers.serverAdapterOption;
29+
pipes = dapHelpers.mkAdapterOption "pipe" dapHelpers.pipeAdapterOption;
2930
};
3031

3132
configurations =
@@ -70,6 +71,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
7071
))
7172
// (lib.optionalAttrs (cfg.adapters.servers != null) (
7273
dapHelpers.processAdapters "server" cfg.adapters.servers
74+
))
75+
// (lib.optionalAttrs (cfg.adapters.pipes != null) (
76+
dapHelpers.processAdapters "pipe" cfg.adapters.pipes
7377
));
7478

7579
signs = with cfg.signs; {

0 commit comments

Comments
 (0)