Need some help on creating the dap config for Swift programming language in Ubuntu 20.04 #955
Replies: 6 comments
-
here is the dap.log output when the server tries to communicate. [ DEBUG ] 2023-06-14T21:50:38Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1604 ] "request" {
arguments = {
adapterID = "nvim-dap",
clientId = "neovim",
clientname = "neovim",
columnsStartAt1 = true,
linesStartAt1 = true,
locale = "en_US.UTF-8",
pathFormat = "path",
supportsProgressReporting = true,
supportsRunInTerminalRequest = true,
supportsStartDebuggingRequest = true,
supportsVariableType = true
},
command = "initialize",
seq = 0,
type = "request"
}
[ ERROR ] 2023-06-14T21:50:38Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1358 ] "stderr" {
command = "/home/gl-245/swift_stuff/swift_versions/swift-5.8-RELEASE-ubuntu18.04/usr/bin/lldb",
name = "lldb",
type = "executable"
} "error: 'Content-Length' is not a valid command.\n"
not sure I was trying to get the same thing working for the C++ and got similar error. so obviously i'm making the same mistake for both the configurations. With this much input can some one please help? |
Beta Was this translation helpful? Give feedback.
-
Here is the adapater and configurations i'm using for cpp where I'm getting same error as above. print("Inside the git BRAND NEW dap cpp")
local M = {}
local function setup_lldb_server_adapter(dap)
dap.adapters.lldb = {
type = 'executable',
command = '/home/gl-245/swift_stuff/swift_versions/swift-5.8-RELEASE-ubuntu18.04/usr/bin/lldb', -- adjust as needed, must be absolute path
name = 'lldb'
}
end
local function setup_lldb_configuration(dap)
dap.configurations.cpp = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
-- 💀
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
-- runInTerminal = false,
},
}
-- If you want to use this for Rust and C, add something like this:
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
end
function M.setup()
local dap = require('dap')
dap.set_log_level('DEBUG')
setup_lldb_server_adapter(dap)
setup_lldb_configuration(dap)
end
return M
|
Beta Was this translation helpful? Give feedback.
-
I have the exact same issue. Doesn't seem to be anyone answering this issue online |
Beta Was this translation helpful? Give feedback.
-
I'm wondering if anybody has had any success understanding this issue. I am getting the same error using nvim with an adapter for rust in Windows. Not sure where the error is coming from. thanks! |
Beta Was this translation helpful? Give feedback.
-
Same error, any solution? @Santhosh-KS @JayaAnim @a1gituser @Santhosh-KS |
Beta Was this translation helpful? Give feedback.
-
Since there hasn't been a solution from an expert, I'll share a workaround I discovered. It doesn't fully resolve the issue but allows me to launch applications in a debug context within Neovim's launch configuration menu. When using a fresh version of LazyVim with the clangd LSP installed, Mason ensures the {
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "codelldb",
"request": "launch",
"program": "${workspaceFolder}/path/to/executable",
"args": [],
"cwd": "${workspaceFolder}",
"environment": [],
"preLaunchTask": "build",
"postDebugTask": "",
"sourceLanguages": ["cpp"],
"stopOnEntry": false,
"externalConsole": false,
"initCommands": [
],
"logging": {
"engineLogging": true
}
}
]
} |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm new to neovim and Lua. But started using it recently. I'm trying to setup my neovim for Swift programming language.
here is my dap adapter and dap configurations,
https://github.com/Santhosh-KS/daptest-nvim-swift
I created this configurations based on the C/C++/Rust using cpp-lldb example provided in the https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-codelldb
I'm getting the following error pointing at my config error. Not sure how to correct the same.
If you want some quick help on how to run the swift program, I've put up some instructions on how to create a hello world program.
https://github.com/Santhosh-KS/daptest-nvim-swift/blob/main/README.md
Please let me know if you need more inputs to help me debug this issue.
Thanks in advance for all your help and support!
Beta Was this translation helpful? Give feedback.
All reactions