Replaced vimspector with dap. Using rust-tools
This commit is contained in:
parent
ac423ae2d1
commit
32d49a32a6
71
init.lua
71
init.lua
|
@ -90,6 +90,10 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'simrat39/rust-tools.nvim',
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
|
@ -179,7 +183,7 @@ require('lazy').setup({
|
||||||
-- These are some example plugins that I've included in the kickstart repository.
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
-- Uncomment any of the lines below to enable them.
|
-- Uncomment any of the lines below to enable them.
|
||||||
require 'kickstart.plugins.autoformat',
|
require 'kickstart.plugins.autoformat',
|
||||||
-- require 'kickstart.plugins.debug',
|
require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||||
|
@ -445,7 +449,14 @@ local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {
|
||||||
|
-- inlayHints = {
|
||||||
|
-- enabled = true,
|
||||||
|
-- typeHints = {
|
||||||
|
-- enable = true,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
-- tsserver = {},
|
-- tsserver = {},
|
||||||
-- eslint = {},
|
-- eslint = {},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
|
@ -535,3 +546,59 @@ cmp.setup {
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
local rt = require("rust-tools")
|
||||||
|
|
||||||
|
rt.setup({
|
||||||
|
-- dap = {
|
||||||
|
-- adapter = {
|
||||||
|
-- type = 'server',
|
||||||
|
-- port = "${port}",
|
||||||
|
-- executable = {
|
||||||
|
-- command = codelldb_path,
|
||||||
|
-- args = { "--port", "${port}" },
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
-- },
|
||||||
|
server = {
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
local nmap = function(keys, func, desc)
|
||||||
|
if desc then
|
||||||
|
desc = 'LSP: ' .. desc
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
|
||||||
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||||
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||||
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||||
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
|
-- See `:help K` for why this keymap
|
||||||
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
|
-- Lesser used LSP functionality
|
||||||
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||||
|
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||||
|
nmap('<leader>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, '[W]orkspace [L]ist Folders')
|
||||||
|
-- Hover actions
|
||||||
|
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||||
|
-- Code action groups
|
||||||
|
vim.keymap.set("n", "<Leader>ca", rt.code_action_group.code_action_group,
|
||||||
|
{ desc = '[C]ode [A]ctions', buffer = bufnr })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
tools = {
|
||||||
|
hover_actions = {
|
||||||
|
auto_focus = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
return {
|
|
||||||
'puremourning/vimspector',
|
|
||||||
config = function()
|
|
||||||
vim.cmd([[
|
|
||||||
let g:vimspector_sidebar_width = 40
|
|
||||||
let g:vimspector_bottombar_height = 15
|
|
||||||
let g:vimspector_terminal_maxwidth = 85
|
|
||||||
]])
|
|
||||||
-- Vimspector
|
|
||||||
vim.cmd([[
|
|
||||||
nmap <F9> <cmd>call vimspector#Launch()<cr>
|
|
||||||
nmap <F5> <cmd>call vimspector#StepOver()<cr>
|
|
||||||
nmap <F8> <cmd>call vimspector#Reset()<cr>
|
|
||||||
" nmap <F11> <cmd>call vimspector#StepOver()<cr>")
|
|
||||||
nmap <F12> <cmd>call vimspector#StepOut()<cr>")
|
|
||||||
nmap <F10> <cmd>call vimspector#StepInto()<cr>")
|
|
||||||
]])
|
|
||||||
vim.keymap.set('n', "Db", ":call vimspector#ToggleBreakpoint()<cr>")
|
|
||||||
vim.keymap.set('n', "Dw", ":call vimspector#AddWatch()<cr>")
|
|
||||||
vim.keymap.set('n', "De", ":call vimspector#Evaluate()<cr>")
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -19,7 +19,7 @@ return {
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
|
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
-- 'leoluz/nvim-dap-go',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
|
@ -38,19 +38,22 @@ return {
|
||||||
-- online, please don't ask me how to install them :)
|
-- online, please don't ask me how to install them :)
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
-- Update this to ensure that you have the debuggers for the langs you want
|
||||||
'delve',
|
-- 'delve',
|
||||||
|
-- 'codelldb'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
vim.keymap.set('n', '<F5>', dap.continue)
|
vim.keymap.set('n', '<F5>', dap.continue, { desc = "Start debugger" })
|
||||||
vim.keymap.set('n', '<F1>', dap.step_into)
|
vim.keymap.set('n', '<F1>', dap.step_into, { desc = "Step into" })
|
||||||
vim.keymap.set('n', '<F2>', dap.step_over)
|
vim.keymap.set('n', '<F2>', dap.step_over, { desc = "Step over" })
|
||||||
vim.keymap.set('n', '<F3>', dap.step_out)
|
vim.keymap.set('n', '<F3>', dap.step_out, { desc = "Step out" })
|
||||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint)
|
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
|
||||||
vim.keymap.set('n', '<leader>B', function()
|
vim.keymap.set('n', '<leader>B', function()
|
||||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
end)
|
end
|
||||||
|
,
|
||||||
|
{ desc = "Breakpoint condition" })
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
|
@ -77,7 +80,11 @@ return {
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
|
-- local mason_registry = require("mason-registry")
|
||||||
|
--
|
||||||
|
-- local codelldb = mason_registry.get_package('codelldb')
|
||||||
|
-- local extension_path = codelldb:get_install_path() .. "/extension/"
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
require('dap-go').setup()
|
-- require('dap-go').setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue