Skip to content
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

Add support for unix domain sockets and named pipes #992

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Conversation

mfussenegger
Copy link
Owner

For adapters like cmake which don't support stdin or TCP

Closes #924

For example:

local dap = require("dap")
dap.adapters.cmake = {
  type = "pipe",
  pipe = "${pipe}",
  executable = {
    command = "cmake",
    args = {"--debugger", "--debugger-pipe", "${pipe}"}
  }
}
dap.configurations.cmake = {
  {
    name = "Build",
    type = "cmake",
    request = "launch",
  }
}

@mfussenegger mfussenegger marked this pull request as ready for review July 26, 2023 17:15
doc/dap.txt Outdated
@@ -76,6 +76,9 @@ The `Adapter` needs to contain a `type`, which can be one of:
- `server`, to indicate that nvim-dap can connect to an already-running
debug adapter via TCP.

- `pipe`, to connect to an already running debug adapter via a unix domain
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be already running? Doesn't the executable field in the adapter spec make this invalid?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-phrased it a bit to (hopefully) clarify it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Thanks for this 🚀

For adapters like cmake which don't support stdin or TCP

Closes #924

For example:

    local dap = require("dap")
    dap.adapters.cmake = {
      type = "pipe",
      pipe = "${pipe}",
      executable = {
        command = "cmake",
        args = {"--debugger", "--debugger-pipe", "${pipe}"}
      }
    }
    dap.configurations.cmake = {
      {
        name = "Build",
        type = "cmake",
        request = "launch",
      }
    }
@mfussenegger mfussenegger merged commit 2f28ea8 into master Jul 27, 2023
16 checks passed
@mfussenegger mfussenegger deleted the pipes branch July 27, 2023 07:49
@Willem-J-an
Copy link

Nice! It also works for powershell! I think the powershell dap server has some weird way of interactive input; it wants to use the console as repl, but if I enable that setting it leads to errors. The regular repl does not return any output.

local PSES_BUNDLE_PATH = os.getenv("HOME") .. "/.local/share/nvim/mason/packages/powershell-editor-services"
local tmpdir = os.tmpname() .. 'd'
os.execute("mkdir " .. tmpdir)
dap.adapters.ps1 = {
	type = "pipe",
	pipe = "${pipe}",
	executable = {
		command = "pwsh",
		args = {
			"-NoLogo",
			"-NoProfile",
			"-File",
			PSES_BUNDLE_PATH .. "/PowerShellEditorServices/Start-EditorServices.ps1",
			"-BundledModulesPath",
			PSES_BUNDLE_PATH,
			"-LogPath",
			tmpdir .. "/logs.log",
			"-SessionDetailsPath",
			tmpdir .. "/session.json",
			"-FeatureFlags",
			"@()",
			"-AdditionalModules",
			"@()",
			"-HostName",
			"My Client",
			"-HostProfileId",
			"myclient",
			"-HostVersion",
			"1.0.0",
			"-LogLevel",
			"Normal",
			"-DebugServiceOnly",
			"-DebugServicePipeName",
			"${pipe}",
			"-WaitForDebugger"
		},
	},
}

        {
            "name": "PowerShell: Current",
            "type": "ps1",
            "request": "launch",
            "script": "${file}",
            "cwd": "${file}"
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support named pipes for DAP
3 participants