Add Rust debugger
This commit is contained in:
parent
d4617e8187
commit
9bf21b782e
|
@ -9,7 +9,11 @@
|
|||
"kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "da8b00581a52f5f87ad2aba9f52171fda7491f18" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "796008869e67ef27a5aa5ac44c08ce2a60b89f55" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "5ad3e113b0c3fde3caba8630599373046f6197e8" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" },
|
||||
"nvim-dap": { "branch": "master", "commit": "3bde6f786057fa29d8356559b2ae3a52d9317fba" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "deade69789089c3da15237697156334fb3e943f0" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f2efc5f35743b8383a1b50f727faae94658506d5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" },
|
||||
|
|
88
nvim/lua/configs/debugging.lua
Normal file
88
nvim/lua/configs/debugging.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
return function()
|
||||
local dap = require "dap"
|
||||
local dapui = require "dapui"
|
||||
|
||||
dapui.setup({
|
||||
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
||||
mappings = {
|
||||
-- Use a table to apply multiple mappings
|
||||
expand = { "<CR>", "<2-LeftMouse>" },
|
||||
open = "o",
|
||||
remove = "d",
|
||||
edit = "e",
|
||||
repl = "r",
|
||||
toggle = "t",
|
||||
},
|
||||
-- Expand lines larger than the window
|
||||
-- Requires >= 0.7
|
||||
expand_lines = vim.fn.has("nvim-0.7") == 1,
|
||||
-- Layouts define sections of the screen to place windows.
|
||||
-- The position can be "left", "right", "top" or "bottom".
|
||||
-- The size specifies the height/width depending on position. It can be an Int
|
||||
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
|
||||
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
|
||||
-- Elements are the elements shown in the layout (in order).
|
||||
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
-- Elements can be strings or table with id and size keys.
|
||||
"breakpoints",
|
||||
"stacks",
|
||||
"watches",
|
||||
{ id = "scopes", size = 0.25 },
|
||||
},
|
||||
size = 40, -- 40 columns
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 0.25, -- 25% of total lines
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
controls = {
|
||||
-- Requires Neovim nightly (or 0.8 when released)
|
||||
enabled = true,
|
||||
-- Display controls in this element
|
||||
element = "repl",
|
||||
icons = {
|
||||
pause = "",
|
||||
play = "",
|
||||
step_into = "",
|
||||
step_over = "",
|
||||
step_out = "",
|
||||
step_back = "",
|
||||
run_last = "↻",
|
||||
terminate = "□",
|
||||
},
|
||||
},
|
||||
floating = {
|
||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
windows = { indent = 1 },
|
||||
render = {
|
||||
max_type_length = nil, -- Can be integer or nil.
|
||||
max_value_lines = 100, -- Can be integer or nil.
|
||||
},
|
||||
})
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
-- dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
-- dapui.close()
|
||||
-- end
|
||||
-- dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
-- dapui.close()
|
||||
-- end
|
||||
end
|
||||
|
|
@ -1,12 +1,20 @@
|
|||
return function()
|
||||
local rt = require "rust-tools"
|
||||
rt.setup({
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
vim.keymap.set('n', "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
vim.keymap.set('n', "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
local mason = require "mason-registry"
|
||||
local capabilities = require "cmp_nvim_lsp"
|
||||
|
||||
local lsp_root = mason.get_package("codelldb"):get_install_path() .. "/extension/"
|
||||
local lsp_path = lsp_root .. "adapter/codelldb"
|
||||
local lib_path = lsp_root .. "lldb/lib/liblldb.so"
|
||||
|
||||
local opts = {
|
||||
server = {
|
||||
standalone = true,
|
||||
-- capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
local buf_opts = { noremap = true, silent = true, buffer = buf_number }
|
||||
vim.keymap.set('n', "<C-b>", rt.hover_actions.hover_actions, buf_opts)
|
||||
vim.keymap.set('n', "<Leader>a", rt.code_action_group.code_action_group, buf_opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, buf_opts)
|
||||
end,
|
||||
["rust-analyzer"] = {
|
||||
|
@ -16,8 +24,13 @@ return function()
|
|||
command = "clippy",
|
||||
allFeatures = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
dap = {
|
||||
adapter = require("rust-tools.dap").get_codelldb_adapter(lsp_path, lib_path),
|
||||
},
|
||||
}
|
||||
|
||||
rt.setup(opts)
|
||||
end
|
||||
|
||||
|
|
|
@ -70,6 +70,58 @@ return {
|
|||
{
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
-- DAP
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
local dap = require "dap"
|
||||
vim.keymap.set('n', "<leader>b", dap.toggle_breakpoint)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
config = require "configs/debugging",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
},
|
||||
-- Mason
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
ensure_installed = {
|
||||
"rust_analyzer",
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
config = function()
|
||||
require("mason-nvim-dap").setup({
|
||||
automatic_installation = true,
|
||||
ensure_installed = {
|
||||
"codelldb",
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
},
|
||||
-- Rust tools
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
|
|
Loading…
Reference in a new issue