This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
Replies: 1 comment 1 reply
-
My configs: -- config.lua
local M = {}
local path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension")
local codelldb_path = path .. "/adapter/codelldb"
local liblldb_path = path .. "/lldb/lib/liblldb.so" -- for linux
if vim.fn.has("mac") == 1 then
liblldb_path = path .. "/lldb/lib/liblldb.dylib" -- for mac
end
local is_dap_ready = vim.fn.filereadable(codelldb_path) == 1
and vim.fn.filereadable(liblldb_path) == 1
local opts = {
server = {
standalone = false,
capabilities = require("plugins.lsp.capabilities"),
on_attach = function(_, bufnr)
require("plugins.lsp.on_attach")(_, bufnr)
-- Hover actions
vim.keymap.set(
"n",
"<leader>ch",
"<cmd>RustHoverActions<CR>",
{ desc = "[RS] Hover", buffer = bufnr }
)
vim.keymap.set(
"n",
"<leader>cc",
"<cmd>RustOpenCargo<CR>",
{ desc = "[RS] Open Cargo.toml", buffer = bufnr }
)
vim.keymap.set(
"n",
"<leader>cp",
"<cmd>RustParentModule<CR>",
{ desc = "[RS] Parent module", buffer = bufnr }
)
-- Code action groups
vim.keymap.set("n", "<leader>cr", function()
require("rust-tools").code_action_group.code_action_group()
end, { desc = "[RS] Actions", buffer = bufnr })
end,
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
},
},
},
tools = {
executor = require("rust-tools.executors").termopen,
on_initialized = nil,
reload_workspace_from_cargo_toml = true,
-- These apply to the default RustSetInlayHints command
inlay_hints = {
auto = true,
only_current_line = false,
show_parameter_hints = true,
parameter_hints_prefix = "⥢ ",
other_hints_prefix = "⥤ ",
max_len_align = false,
max_len_align_padding = 1,
right_align = false,
right_align_padding = 7,
highlight = "Comment",
},
hover_actions = {
auto_focus = true,
},
},
}
-- TODO it looks like dap was started together with rust-tools, which should be lazily loaded on demand
if is_dap_ready then
opts.dap =
{ adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) }
end
M.setup = function()
require("rust-tools").setup(opts)
end
return M
-- init.lua
return {
"simrat39/rust-tools.nvim",
enabled = true,
ft = "rust",
config = function()
require("plugins.rust_tools.config").setup()
end,
}
-- while dap config is like
return {
"mfussenegger/nvim-dap",
enabled = true,
dependencies = {
{ "rcarriga/nvim-dap-ui" },
{ "theHamsta/nvim-dap-virtual-text" },
},
cmd = {
"DAPToggleBreakpoint", "DAPContinue", "DAPStepOver", "DAPStepInto"
},
config = function()
require("plugins.dap.config").setup()
end
}
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have set my
dap
to be lazily loaded with specific command. But it seems that it would still be loaded together with rust-tools?I am using lazy.nvim. Any guidance? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions