add dap for rust

This commit is contained in:
Fabian Schmidt 2023-04-03 12:40:26 +02:00
parent afcce108f7
commit b2f02b5c13
2 changed files with 34 additions and 0 deletions

17
lua/plugins/dap.lua Normal file
View File

@ -0,0 +1,17 @@
return {
{
'mfussenegger/nvim-dap',
dependencies = { 'nvim-lua/plenary.nvim' }
},
{
'rcarriga/nvim-dap-ui',
config = function()
require("dapui").setup()
end,
dependencies = { 'mfussenegger/nvim-dap' }
},
{
'theHamsta/nvim-dap-virtual-text',
config = true
}
}

View File

@ -20,6 +20,14 @@ local lsp_attach = function(client, buf)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
end
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/")
local codelldb_path = mason_path .. "adapter/codelldb"
local liblldb_path = mason_path .. "lldb/lib/liblldb.so"
if vim.fn.has "mac" == 1 then
liblldb_path = mason_path .. "lldb/lib/liblldb.dylib"
end
return {
-- lsp
{
@ -52,6 +60,7 @@ return {
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
}
},
@ -74,6 +83,10 @@ return {
capabilities = capabilities,
on_attach = lsp_attach,
standalone = false
},
dap = {
adapter = require('rust-tools.dap').get_codelldb_adapter(
codelldb_path, liblldb_path)
}
})
lspconfig.bashls.setup {
@ -96,6 +109,10 @@ return {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.phpactor.setup({
capabilities = capabilities,
on_attach = lsp_attach
})
capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.emmet_ls.setup({
capabilities = capabilities,