Open mateuszaaa opened 1 year ago
@mateuszaaa , do you have breakpoints set up before starting the debug? Since the default nvim-dap config created by rust-tools.nvim is not to "stop on entry", without a breakpoint it simply exits.
Try :lua require'dap'.toggle_breakpoint()
to break at entrance of code first.
Have a similar issue with CodeLLDB v1.9.0 using Debug through the hover actions. I get the Compiling a debug build message, then nothing happens. Breakpoints have been set in the function being debugged, and my rust-tools config is as follows
opts = {
dap = {
adapter = function()
local extension_path = vim.env.HOME .. "/.vscode/extensions/vadimcn.vscode-lldb-1.9.0"
local codelldb_path = extension_path .. "adapter/codelldb"
local liblldb_path = extension_path .. "lldb/lib/liblldb.so"
require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path)
end,
},
server = {
on_attach = function(_, bufnr)
vim.keymap.set("n", "K", require("rust-tools").hover_actions.hover_actions, { buffer = bufnr })
vim.keymap.set(
"n",
"<leader>ca",
require("rust-tools").code_action_group.code_action_group,
{ buffer = bufnr }
)
-- vim.keymap.set("n", "<C-R>", require("rust-tools").debuggables.debuggables())
end,
},
},
I have the same issue as @ConnorWay32 with the following rust-tools.cfg
:
local generic_cfg = require("setup/generic-lspcfg")
local rt = require("rust-tools")
local mason_registry = require("mason-registry")
local codelldb = mason_registry.get_package("codelldb")
-- Copied from https://github.com/simrat39/rust-tools.nvim/wiki/Debugging
-- Adapted for mason
local extension_path = codelldb:get_install_path() .. "/extension/"
local codelldb_path = extension_path .. "adapter/codelldb"
-- This is the shared object for Ubuntu.. might be different on different OSes
local liblldb_path = extension_path .. "lldb/lib/liblldb"
local this_os = vim.loop.os_uname().sysname;
-- The path in windows is different
if this_os:find "Windows" then
codelldb_path = extension_path .. "adapter\\codelldb.exe"
liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll"
else
-- The liblldb extension is .so for linux and .dylib for macOS
liblldb_path = liblldb_path .. (this_os == "Linux" and ".so" or ".dylib")
end
-- Configure LSP through rust-tools.nvim plugin.
-- rust-tools will configure and enable certain LSP features for us.
-- See https://github.com/simrat39/rust-tools.nvim#configuration
rt.setup({
runnables = {
use_telescope = true,
},
-- all the opts to send to nvim-lspconfig
-- these override the defaults set by rust-tools.nvim
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
server = {
-- on_attach is a callback called when the language server attachs to the buffer
on_attach = function(_, bufnr)
generic_cfg.on_attach(_, bufnr)
generic_cfg.nmap("<Leader>k", rt.hover_actions.hover_actions, "Hover actions")
end,
settings = {
-- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = {
-- enable clippy on save
checkOnSave = {
command = "clippy",
},
},
},
},
dap = {
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path)
}
})
You can find the full configuration here: https://github.com/robamu/nvim-cfg/blob/main/lua/setup/rust-tools.lua
It actually works, I just had an error with dap-ui not opening automatically, and no breakpoint being set, so it was a bit confusing that nothing appeared to happen, but its working :-)
Hi all, i really appreciate your work. I wanted to test Rust debugging but for some reason it does not work... There are no errors or whatsoever:
rust-tool setup
https://user-images.githubusercontent.com/5952088/206032994-73691e0e-208f-4be2-83ee-37aabde69af1.gif