mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.17k stars 180 forks source link

Add support for unix domain sockets and named pipes #992

Closed mfussenegger closed 11 months ago

mfussenegger commented 12 months ago

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

Closes https://github.com/mfussenegger/nvim-dap/issues/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",
  }
}
Willem-J-an commented 11 months ago

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}"
        },