setup dap debugger
This commit is contained in:
parent
3faea0912f
commit
9efae9f0f4
36
lua/config/dap.lua
Normal file
36
lua/config/dap.lua
Normal 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
|
@ -1,5 +1,5 @@
|
||||
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 M = {}
|
||||
|
||||
@ -14,12 +14,8 @@ end
|
||||
|
||||
local capabilities = lspconfig_config.get_capabilities()
|
||||
|
||||
lsp_instller.on_server_ready(function(server)
|
||||
|
||||
-- print(server.name)
|
||||
-- print(vim.inspect(lspconfig_config.get_server_settings(server.name)))
|
||||
|
||||
server:setup{
|
||||
for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
||||
local opts = {
|
||||
root_dir = function()
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
@ -30,18 +26,17 @@ lsp_instller.on_server_ready(function(server)
|
||||
capabilities = capabilities,
|
||||
settings = lspconfig_config.get_server_settings(server.name)
|
||||
}
|
||||
end)
|
||||
|
||||
require("lspconfig").gdscript.setup{
|
||||
root_dir = function()
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
init_options = lspconfig_config.get_server_init_options("godot"),
|
||||
on_attach = lspconfig_config.on_attach,
|
||||
on_init = lspconfig_config.on_init,
|
||||
flags = lspconfig_config.flags,
|
||||
capabilities = capabilities,
|
||||
settings = lspconfig_config.get_server_settings("godot")
|
||||
}
|
||||
if server.name == "rust_analyzer" then
|
||||
local has_rust_tools, rust_tools = pcall(require, "rust-tools")
|
||||
if has_rust_tools then
|
||||
rust_tools.setup({ server = opts })
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
server:setup(opts)
|
||||
::continue::
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -3,9 +3,18 @@
|
||||
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
local function usePlugins(use, use_rocks)
|
||||
-- Toggle terminal
|
||||
use {'akinsho/toggleterm.nvim', tag = '*', config=[[require('toggleterm').setup()]]}
|
||||
|
||||
-- Debugger
|
||||
use { 'puremourning/vimspector', config = [[require 'config.vimspector']] }
|
||||
use 'puuuuh/vimspector-rust'
|
||||
use { 'mfussenegger/nvim-dap', config=[[require('config.dap')]]}
|
||||
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
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
|
Loading…
Reference in New Issue
Block a user