1
0

setup dap debugger

This commit is contained in:
Rokas Puzonas 2023-05-11 17:30:35 +03:00
parent 3faea0912f
commit 9efae9f0f4
3 changed files with 61 additions and 21 deletions

36
lua/config/dap.lua Normal file
View File

@ -0,0 +1,36 @@
local dap = require('dap')
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode',
name = 'lldb'
}
dap.configurations.cpp = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
-- 💀
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
-- runInTerminal = false,
},
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp

View File

@ -1,5 +1,5 @@
local lspconfig_config = require 'config.lspconfig' local lspconfig_config = require 'config.lspconfig'
local lsp_instller = require 'nvim-lsp-installer' local lsp_installer = require 'nvim-lsp-installer'
local lsp_installer_servers = require'nvim-lsp-installer.servers' local lsp_installer_servers = require'nvim-lsp-installer.servers'
local M = {} local M = {}
@ -14,12 +14,8 @@ end
local capabilities = lspconfig_config.get_capabilities() local capabilities = lspconfig_config.get_capabilities()
lsp_instller.on_server_ready(function(server) for _, server in ipairs(lsp_installer.get_installed_servers()) do
local opts = {
-- print(server.name)
-- print(vim.inspect(lspconfig_config.get_server_settings(server.name)))
server:setup{
root_dir = function() root_dir = function()
return vim.fn.getcwd() return vim.fn.getcwd()
end, end,
@ -30,18 +26,17 @@ lsp_instller.on_server_ready(function(server)
capabilities = capabilities, capabilities = capabilities,
settings = lspconfig_config.get_server_settings(server.name) settings = lspconfig_config.get_server_settings(server.name)
} }
end)
require("lspconfig").gdscript.setup{ if server.name == "rust_analyzer" then
root_dir = function() local has_rust_tools, rust_tools = pcall(require, "rust-tools")
return vim.fn.getcwd() if has_rust_tools then
end, rust_tools.setup({ server = opts })
init_options = lspconfig_config.get_server_init_options("godot"), goto continue
on_attach = lspconfig_config.on_attach, end
on_init = lspconfig_config.on_init, end
flags = lspconfig_config.flags,
capabilities = capabilities, server:setup(opts)
settings = lspconfig_config.get_server_settings("godot") ::continue::
} end
return M return M

View File

@ -3,9 +3,18 @@
---@diagnostic disable-next-line: unused-local ---@diagnostic disable-next-line: unused-local
local function usePlugins(use, use_rocks) local function usePlugins(use, use_rocks)
-- Toggle terminal
use {'akinsho/toggleterm.nvim', tag = '*', config=[[require('toggleterm').setup()]]}
-- Debugger -- Debugger
use { 'puremourning/vimspector', config = [[require 'config.vimspector']] } use { 'mfussenegger/nvim-dap', config=[[require('config.dap')]]}
use 'puuuuh/vimspector-rust' use { "rcarriga/nvim-dap-ui", requires = "mfussenegger/nvim-dap", config=[[require('dapui').setup()]] }
use 'simrat39/rust-tools.nvim'
use {
'theHamsta/nvim-dap-virtual-text',
requires = {"mfussenegger/nvim-dap", "nvim-treesitter/nvim-treesitter"},
config=[[require('nvim-dap-virtual-text')]]
}
-- Seemless pane switching betwen tmux and vim -- Seemless pane switching betwen tmux and vim
use 'christoomey/vim-tmux-navigator' use 'christoomey/vim-tmux-navigator'