remove rust debugger, renable basic rust lsp

This commit is contained in:
Slayter Teal 2024-11-16 10:43:13 -06:00
parent cbc09c11cb
commit 5e579db124
1 changed files with 123 additions and 123 deletions

246
init.lua
View File

@ -530,9 +530,9 @@ require('lazy').setup({
require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-tool-installer').setup { ensure_installed = ensure_installed }
-- Prevent mason from starting rust_analyzer -- Prevent mason from starting rust_analyzer
require('mason-lspconfig').setup_handlers { -- require('mason-lspconfig').setup_handlers {
['rust_analyzer'] = function() end, -- ['rust_analyzer'] = function() end,
} -- }
require('mason-lspconfig').setup { require('mason-lspconfig').setup {
handlers = { handlers = {
@ -540,9 +540,9 @@ require('lazy').setup({
local server = servers[server_name] or {} local server = servers[server_name] or {}
-- Don't let mason configure the rust lsp -> this is done later in rustaceanvim -- Don't let mason configure the rust lsp -> this is done later in rustaceanvim
if server_name == 'rust_analyzer' then -- if server_name == 'rust_analyzer' then
return -- return
end -- end
-- This handles overriding only values explicitly passed -- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling -- by the server configuration above. Useful when disabling
@ -710,123 +710,123 @@ require('lazy').setup({
} }
end, end,
}, },
{ --nvim-dap-- -- { --nvim-dap--
'mfussenegger/nvim-dap', -- 'mfussenegger/nvim-dap',
config = function() -- config = function()
-- local mason_registry = require 'mason-registry' -- local mason_registry = require 'mason-registry'
-- local codelldb = mason_registry.get_package 'codelldb' -- local codelldb = mason_registry.get_package 'codelldb'
-- local extension_path = codelldb:get_install_path() .. '/extensions/' -- local extension_path = codelldb:get_install_path() .. '/extensions/'
-- local codelldb_path = extension_path .. 'adapter/codelldb' -- local codelldb_path = extension_path .. 'adapter/codelldb'
-- --
-- local dap = require 'dap' -- local dap = require 'dap'
-- dap.adapters.codelldb = { -- dap.adapters.codelldb = {
-- type = 'server', -- type = 'server',
-- port = '${port}', -- port = '${port}',
-- executable = { -- executable = {
-- command = codelldb_path, -- command = codelldb_path,
-- args = { '--port', '${port}' }, -- args = { '--port', '${port}' },
-- }, -- },
-- } -- }
--
-- dap.configurations.rust = { -- dap.configurations.rust = {
-- { -- {
-- name = 'Launch file', -- name = 'Launch file',
-- type = 'codelldb', -- type = 'codelldb',
-- request = 'launch', -- request = 'launch',
-- program = function() -- program = function()
-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
-- end, -- end,
-- cwd = '${workspaceFolder}', -- cwd = '${workspaceFolder}',
-- stopOnEntry = false, -- stopOnEntry = false,
-- }, -- },
-- } -- }
end, -- end,
}, -- },
{ --nvim-dap-ui-- -- { --nvim-dap-ui--
'rcarriga/nvim-dap-ui', -- 'rcarriga/nvim-dap-ui',
dependencies = { -- dependencies = {
'mfussenegger/nvim-dap', -- 'mfussenegger/nvim-dap',
'nvim-neotest/nvim-nio', -- 'nvim-neotest/nvim-nio',
}, -- },
config = function() -- config = function()
local dapui = require 'dapui' -- local dapui = require 'dapui'
local dap = require 'dap' -- local dap = require 'dap'
dapui.setup() -- dapui.setup()
--
-- handle closing/opening the UI when debugger stops/starts -- -- -- handle closing/opening the UI when debugger stops/starts --
dap.listeners.after.event_initialized['dapui_config'] = function() -- dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open() -- dapui.open()
end -- end
dap.listeners.before.event_terminated['dapui_config'] = function() -- dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close() -- dapui.close()
end -- end
dap.listeners.before.event_exited['dapui_config'] = function() -- dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close() -- dapui.close()
end -- end
--
-- setup some nice keybindings -- -- -- setup some nice keybindings --
-- vim.keymap.set('n', '<Leader>dt', ':DapToggleBreakpoint<CR>', { desc = '[DEBUGGER] Toggle Breakpoint' }) -- -- vim.keymap.set('n', '<Leader>dt', ':DapToggleBreakpoint<CR>', { desc = '[DEBUGGER] Toggle Breakpoint' })
-- vim.keymap.set('n', '<Leader>dx', ':DapTerminate<CR>', { desc = '[DEBUGGER] Terminate Debugger' }) -- -- vim.keymap.set('n', '<Leader>dx', ':DapTerminate<CR>', { desc = '[DEBUGGER] Terminate Debugger' })
-- vim.keymap.set('n', '<Leader>so', ':DapStepOver<CR>', { desc = '[DEBUGGER] Step Over' }) -- -- vim.keymap.set('n', '<Leader>so', ':DapStepOver<CR>', { desc = '[DEBUGGER] Step Over' })
--
-- Nvim DAP Keybindings -- -- Nvim DAP Keybindings
local map = vim.keymap.set -- local map = vim.keymap.set
--
map('n', '<Leader>dl', "<cmd>lua require'dap'.step_into()<CR>", { desc = '[DEBUGGER] Step Into' }) -- map('n', '<Leader>dl', "<cmd>lua require'dap'.step_into()<CR>", { desc = '[DEBUGGER] Step Into' })
map('n', '<Leader>dj', "<cmd>lua require'dap'.step_over()<CR>", { desc = '[DEBUGGER] Step Over' }) -- map('n', '<Leader>dj', "<cmd>lua require'dap'.step_over()<CR>", { desc = '[DEBUGGER] Step Over' })
map('n', '<Leader>dk', "<cmd>lua require'dap'.step_out()<CR>", { desc = '[DEBUGGER] Step Out' }) -- map('n', '<Leader>dk', "<cmd>lua require'dap'.step_out()<CR>", { desc = '[DEBUGGER] Step Out' })
map('n', '<Leader>dc', "<cmd>lua require'dap'.continue()<CR>", { desc = '[DEBUGGER] Continue' }) -- map('n', '<Leader>dc', "<cmd>lua require'dap'.continue()<CR>", { desc = '[DEBUGGER] Continue' })
map('n', '<Leader>db', "<cmd>lua require'dap'.toggle_breakpoint()<CR>", { desc = '[DEBUGGER] Toggle Breakpoint' }) -- map('n', '<Leader>db', "<cmd>lua require'dap'.toggle_breakpoint()<CR>", { desc = '[DEBUGGER] Toggle Breakpoint' })
-- map( -- -- map(
-- 'n', -- -- 'n',
-- '<Leader>dd', -- -- '<Leader>dd',
-- "<cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>", -- -- "<cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>",
-- { desc = 'Debugger set conditional breakpoint' } -- -- { desc = 'Debugger set conditional breakpoint' }
-- ) -- -- )
map('n', '<Leader>de', "<cmd>lua require'dap'.terminate()<CR>", { desc = '[DEBUGGER] Reset' }) -- map('n', '<Leader>de', "<cmd>lua require'dap'.terminate()<CR>", { desc = '[DEBUGGER] Reset' })
map('n', '<Leader>dr', "<cmd>lua require'dap'.run_last()<CR>", { desc = '[DEBUGGER] Run Last' }) -- map('n', '<Leader>dr', "<cmd>lua require'dap'.run_last()<CR>", { desc = '[DEBUGGER] Run Last' })
--
-- rustaceanvim -- -- rustaceanvim
map('n', '<Leader>dt', "<cmd>lua vim.cmd('RustLsp testables')<CR>", { desc = '[DEBUGGER] Testables' }) -- map('n', '<Leader>dt', "<cmd>lua vim.cmd('RustLsp testables')<CR>", { desc = '[DEBUGGER] Testables' })
end, -- end,
}, -- },
{ -- {
'mrcjkb/rustaceanvim', -- 'mrcjkb/rustaceanvim',
version = '^5', -- version = '^5',
lazy = false, -- This plugin is already lazy -- lazy = false, -- This plugin is already lazy
config = function() -- config = function()
-- TODO: these paths are wrong for some fucking reason -- -- TODO: these paths are wrong for some fucking reason
-- local mason_registry = require 'mason-registry' -- -- local mason_registry = require 'mason-registry'
-- local codelldb = mason_registry.get_package 'codelldb' -- -- local codelldb = mason_registry.get_package 'codelldb'
-- local extension_path = codelldb:get_install_path() .. '/extensions/' -- -- local extension_path = codelldb:get_install_path() .. '/extensions/'
-- local codelldb_path = extension_path .. 'adapter/codelldb' -- -- local codelldb_path = extension_path .. 'adapter/codelldb'
-- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' -- -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so'
--
local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb' -- local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb'
-- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib) -- -- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib)
local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so' -- local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so'
local rustcfg = require 'rustaceanvim.config' -- local rustcfg = require 'rustaceanvim.config'
--
vim.g.rustaceanvim = { -- vim.g.rustaceanvim = {
-- Plugin configuration -- -- Plugin configuration
tools = {}, -- tools = {},
-- LSP configuration -- -- LSP configuration
server = { -- server = {
on_attach = function(client, bufnr) -- on_attach = function(client, bufnr)
-- you can also put keymaps in here -- -- you can also put keymaps in here
end, -- end,
default_settings = { -- default_settings = {
-- rust-analyzer language server configuration -- -- rust-analyzer language server configuration
['rust-analyzer'] = {}, -- ['rust-analyzer'] = {},
}, -- },
}, -- },
-- DAP configuration -- -- DAP configuration
dap = { -- dap = {
adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path), -- adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path),
}, -- },
} -- }
end, -- end,
}, -- },
-- ADD COLORSCHEMES HERE (or at least around here) -- ADD COLORSCHEMES HERE (or at least around here)
-- { -- {