Add nvim-dap

This commit is contained in:
Amanda Graven 2022-08-18 12:15:48 +02:00
parent bbd2fb70f4
commit 3d9cd7098a
Signed by: amanda
GPG key ID: F747582C5608F4CB

118
init.lua
View file

@ -245,7 +245,7 @@ require'packer'.startup(function(use)
vim.g['test#neovim#term_position'] = 'vert' vim.g['test#neovim#term_position'] = 'vert'
vim.g['test#strategy'] = 'neovim' vim.g['test#strategy'] = 'neovim'
end} end}
use {'julian/vim-textobj-variable-segment', requires = {'kana/vim-textobj-user'}} use {'julian/vim-textobj-variable-segment', requires = {'kana/vim-textobj-user'}, branch = 'main'}
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
use 'hrsh7th/vim-vsnip' use 'hrsh7th/vim-vsnip'
@ -274,6 +274,97 @@ require'packer'.startup(function(use)
use {'MattesGroeger/vim-bookmarks', config = function() use {'MattesGroeger/vim-bookmarks', config = function()
vim.g.bookmark_save_per_working_dir = 1 vim.g.bookmark_save_per_working_dir = 1
end} end}
use {'mfussenegger/nvim-dap', config = function()
local dap = require'dap'
dap.adapters.codelldb = {
type = 'server',
port = '${port}',
executable = {
command = vim.fn.stdpath('data') .. '/mason/packages/codelldb/extension/adapter/codelldb',
args = {'--port', '${port}'},
},
}
dap.configurations.cpp = {
{
name = 'Launch file',
type = 'codelldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = true,
},
}
dap.configurations.rust = dap.configurations.cpp
dap.configurations.c = dap.configurations.c
require'which-key'.register {
['<Leader>d'] = {
name = 'Debug',
c = {dap.continue, 'Continue/start'},
s = {dap.terminate, 'Stop'},
b = {dap.toggle_breakpoint, 'Breakpoint'},
o = {dap.step_over, 'Step over'},
i = {dap.step_into, 'Step into'},
O = {dap.step_out, 'Step out'},
r = {dap.step_back, 'Step back'},
R = {dap.reverse_continue, 'Continue backwards'},
C = {dap.run_to_cursor, 'Continue to cursor'},
p = {dap.paise, 'Pause execution'}
}
}
end}
use {'rcarriga/nvim-dap-ui', config = function()
require'dapui'.setup()
require'which-key'.register {
['<Leader>dd'] = {require'dapui'.toggle, 'Debug'}
}
end}
use {'theHamsta/nvim-dap-virtual-text', config = function()
require'nvim-dap-virtual-text'.setup{}
end}
use {'mxsdev/nvim-dap-vscode-js', requires = {'mfussenegger/nvim-dap'}, config = function()
require'dap-vscode-js'.setup {
adapters = {'pwa-node', 'node-terminal'},
}
for _, language in ipairs({'javascript', 'typescript'}) do
require'dap'.configurations[language] = {
{
type = 'pwa-node',
request = 'launch',
name = 'Launch file',
program = '${file}',
cwd = '${workspaceFolder}',
},
{
type = 'pwa-node',
request = 'attach',
name = 'Attach',
processId = require'dap.utils'.pick_process,
cwd = '${workspaceFolder}',
},
{
type = 'pwa-node',
request = 'launch',
name = 'Debug Mocha Tests',
-- trace = true, -- include debugger info
runtimeExecutable = 'node',
runtimeArgs = {
'./node_modules/mocha/bin/mocha',
},
rootPath = '${workspaceFolder}',
cwd = '${workspaceFolder}',
console = 'integratedTerminal',
internalConsoleOptions = 'neverOpen',
}
}
end
end}
use {
'microsoft/vscode-js-debug',
opt = true,
run = 'npm install --legacy-peer-deps && npm run compile'
}
use {'stevearc/dressing.nvim', config = function() use {'stevearc/dressing.nvim', config = function()
vim.cmd'highlight link FloatTitle TelescopeBorder' vim.cmd'highlight link FloatTitle TelescopeBorder'
require'dressing'.setup { require'dressing'.setup {
@ -297,6 +388,14 @@ require'packer'.startup(function(use)
require'lsp_lines'.setup() require'lsp_lines'.setup()
vim.diagnostic.config { virtual_text = false } vim.diagnostic.config { virtual_text = false }
end} end}
use {'williamboman/mason.nvim', config = function()
require'mason'.setup()
end}
use {'williamboman/mason-lspconfig.nvim', config = function()
require'mason-lspconfig'.setup {
automatic_installation = true,
}
end}
use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function () use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function ()
require'notify'.setup { require'notify'.setup {
stages = 'fade' stages = 'fade'
@ -372,6 +471,9 @@ require'packer'.startup(function(use)
use {'nvim-telescope/telescope-ui-select.nvim', config = function () use {'nvim-telescope/telescope-ui-select.nvim', config = function ()
require'telescope'.load_extension('ui-select') require'telescope'.load_extension('ui-select')
end} end}
use {'nvim-telescope/telescope-dap.nvim', after = 'telescope.nvim', config = function()
require'telescope'.load_extension'dap'
end}
use 'kyazdani42/nvim-tree.lua' use 'kyazdani42/nvim-tree.lua'
use 'simrat39/symbols-outline.nvim' use 'simrat39/symbols-outline.nvim'
use {'folke/which-key.nvim', config = function() require'which-key'.setup() end} use {'folke/which-key.nvim', config = function() require'which-key'.setup() end}
@ -672,10 +774,16 @@ require'rust-tools'.setup {
procMacro = { procMacro = {
-- Enable proc macro support -- Enable proc macro support
enable = true, enable = true,
} },
} },
} },
} },
dap = {
adapter = require'rust-tools.dap'.get_codelldb_adapter(
vim.fn.stdpath('data') .. '/mason/packages/codelldb/extension/adapter/codelldb',
vim.fn.stdpath('data') .. '/mason/packages/codelldb/extension/lldb/lib/liblldb.so'
)
},
} }