Setup debug adapters for codelldb, debugpy and gopls. Also remove
nvim-dap-profiles :( Apparently there is a way to do the same thing using launch.json built into dap, much better than my solution.
This commit is contained in:
parent
b7796e9a5e
commit
472208ea95
8 changed files with 95 additions and 7 deletions
8
home/.config/nvim/lua/dap/adapters/codelldb.lua
Normal file
8
home/.config/nvim/lua/dap/adapters/codelldb.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = vim.fn.exepath("codelldb"), -- Update with your codelldb binary path
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
0
home/.config/nvim/lua/dap/adapters/debugpy.lua
Normal file
0
home/.config/nvim/lua/dap/adapters/debugpy.lua
Normal file
45
home/.config/nvim/lua/dap/setup.lua
Normal file
45
home/.config/nvim/lua/dap/setup.lua
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
local utils = require("utils")
|
||||
local dap = require("dap")
|
||||
|
||||
--[[
|
||||
.vscode/launch.json:
|
||||
----------------------------
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "name_of_adapter",
|
||||
"request": "launch/attach",
|
||||
"name": "Friendly name",
|
||||
"program": "${workspaceFolder}/path/to/executable",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": [],
|
||||
"stopOnEntry": false,
|
||||
"environment": []
|
||||
}
|
||||
]
|
||||
}
|
||||
----------------------------
|
||||
]]
|
||||
|
||||
local dir_path = "dap/adapters"
|
||||
utils.foreach(utils.get_file_names_in_dir(dir_path, "*.lua", true), function(adapter)
|
||||
dap.adapters[adapter] = require(dir_path .. "/" .. adapter)
|
||||
end)
|
||||
|
||||
-- Do not define default fallbacks until I have a better way of handling a default selected configuration.
|
||||
-- I never want to be prompted for a configuration, we should have ae serialized active config which is always run unless changed.
|
||||
-- -- Define configurations
|
||||
-- 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 = false,
|
||||
-- args = {},
|
||||
-- },
|
||||
-- }
|
||||
21
home/.config/nvim/lua/lsp/servers/pyright.lua
Normal file
21
home/.config/nvim/lua/lsp/servers/pyright.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
cmd = { "pyright-langserver", "--stdio" },
|
||||
filetypes = { "python", "py" },
|
||||
root_markers = {
|
||||
"pyproject.toml",
|
||||
"setup.py",
|
||||
"setup.cfg",
|
||||
"requirements.txt",
|
||||
"Pipfile",
|
||||
"pyrightconfig.json",
|
||||
},
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = "openFilesOnly",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -26,6 +26,10 @@ return {
|
|||
-- CMake
|
||||
"cmake-language-server",
|
||||
"cmakelang",
|
||||
|
||||
-- Python
|
||||
"debugpy",
|
||||
"pyright",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,24 +5,30 @@ return {
|
|||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
|
||||
-- Special adapters
|
||||
"leoluz/nvim-dap-go",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
|
||||
{ "nvim-neotest/nvim-nio", lazy = true },
|
||||
"LiadOz/nvim-dap-repl-highlights",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"Weissle/persistent-breakpoints.nvim",
|
||||
{
|
||||
"LarssonMartin1998/nvim-dap-profiles",
|
||||
opts = {},
|
||||
},
|
||||
"leoluz/nvim-dap-go",
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
dapui.setup()
|
||||
-- Special adapters
|
||||
require("dap-go").setup()
|
||||
require("dap-python").setup("python3")
|
||||
-- Special adapters
|
||||
|
||||
require("dap.ext.vscode").load_launchjs()
|
||||
require("persistent-breakpoints").setup {
|
||||
load_breakpoints_event = { "BufReadPost" }
|
||||
}
|
||||
require("dap-go").setup()
|
||||
|
||||
local stepping_keymaps = {
|
||||
n = {
|
||||
|
|
@ -46,6 +46,7 @@ return {
|
|||
"regex",
|
||||
"dap_repl",
|
||||
"muttrc",
|
||||
"python",
|
||||
},
|
||||
sync_install = false,
|
||||
-- This can be updated to a list of languages instead of defaulting to true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue