feat(neovim): setup rust debugging
This commit is contained in:
parent
13105bbe3a
commit
e5aedbcbc0
35
home-manager/neovim/dap.lua
Normal file
35
home-manager/neovim/dap.lua
Normal file
@ -0,0 +1,35 @@
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
dapui.setup()
|
||||
|
||||
vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" })
|
||||
|
||||
-- debugging keymaps
|
||||
vim.keymap.set("n", "<F5>", dap.continue, { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<F9>", dap.toggle_breakpoint, { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<F10>", dap.step_over, { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<F11>", dap.step_into, { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "<S-F11>", dap.step_out, { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<F23>", dap.step_out, { noremap = true, silent = true }) -- <Shift-F11> in kitty
|
||||
|
||||
vim.keymap.set("n", "<M-k>", dapui.eval, { noremap = true, silent = true })
|
||||
|
||||
-- trigger auto-completion in repl
|
||||
vim.cmd([[
|
||||
augroup TriggerDapReplAutoCompletion
|
||||
autocmd!
|
||||
autocmd FileType dap-repl lua require("dap.ext.autocompl").attach()
|
||||
augroup END
|
||||
]])
|
||||
|
||||
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
|
@ -53,8 +53,13 @@ in
|
||||
nodePackages.typescript
|
||||
nodePackages.dockerfile-language-server-nodejs
|
||||
nodePackages.vscode-html-languageserver-bin
|
||||
lldb
|
||||
vscode-extensions.vadimcn.vscode-lldb
|
||||
];
|
||||
|
||||
# symlink for a stable path
|
||||
home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb;
|
||||
|
||||
programs = {
|
||||
neovim = {
|
||||
enable = true;
|
||||
@ -115,6 +120,10 @@ in
|
||||
lua-dev-nvim
|
||||
null-ls-nvim
|
||||
lsp_lines-nvim
|
||||
|
||||
# debugging
|
||||
nvim-dap
|
||||
nvim-dap-ui
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
@ -146,6 +155,7 @@ in
|
||||
vim.opt.background = '${theme}'
|
||||
|
||||
${builtins.readFile ./project-nvim.lua }
|
||||
${builtins.readFile ./dap.lua }
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
|
@ -73,6 +73,11 @@ for lsp, settings in pairs(servers) do
|
||||
})
|
||||
end
|
||||
|
||||
-- setup rust tools
|
||||
local codelldb_base_path = vim.env.HOME .. "/.vscode-extensions/vscode-lldb/share/vscode/extensions/vadimcn.vscode-lldb/"
|
||||
local codelldb_bin_path = codelldb_base_path .. 'adapter/codelldb'
|
||||
local codelldb_lib_path = codelldb_base_path .. 'lldb/lib/liblldb.so'
|
||||
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
@ -89,6 +94,9 @@ require("rust-tools").setup({
|
||||
},
|
||||
capabilities = capabilities,
|
||||
},
|
||||
dap = {
|
||||
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_bin_path, codelldb_lib_path)
|
||||
},
|
||||
})
|
||||
|
||||
local luadev = require("lua-dev").setup({
|
||||
|
Reference in New Issue
Block a user