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
|
|
@ -29,7 +29,10 @@ require("terminal")
|
||||||
require("window_management").setup()
|
require("window_management").setup()
|
||||||
|
|
||||||
-- Set configs for servers and enable them in the Neovim LSP Client
|
-- Set configs for servers and enable them in the Neovim LSP Client
|
||||||
require("lsp")
|
require("lsp/setup")
|
||||||
|
|
||||||
|
-- Set configs for nvim-dap so we can debug
|
||||||
|
require("dap/setup")
|
||||||
|
|
||||||
-- See ":help vim.highlight.on_yank()"
|
-- See ":help vim.highlight.on_yank()"
|
||||||
setup_yank_highlight()
|
setup_yank_highlight()
|
||||||
|
|
|
||||||
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
|
||||||
"cmake-language-server",
|
"cmake-language-server",
|
||||||
"cmakelang",
|
"cmakelang",
|
||||||
|
|
||||||
|
-- Python
|
||||||
|
"debugpy",
|
||||||
|
"pyright",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,30 @@ return {
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
|
|
||||||
|
-- Special adapters
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
"mfussenegger/nvim-dap-python",
|
||||||
|
|
||||||
{ "nvim-neotest/nvim-nio", lazy = true },
|
{ "nvim-neotest/nvim-nio", lazy = true },
|
||||||
"LiadOz/nvim-dap-repl-highlights",
|
"LiadOz/nvim-dap-repl-highlights",
|
||||||
"theHamsta/nvim-dap-virtual-text",
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
"Weissle/persistent-breakpoints.nvim",
|
"Weissle/persistent-breakpoints.nvim",
|
||||||
{
|
|
||||||
"LarssonMartin1998/nvim-dap-profiles",
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
"leoluz/nvim-dap-go",
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
|
|
||||||
dapui.setup()
|
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 {
|
require("persistent-breakpoints").setup {
|
||||||
load_breakpoints_event = { "BufReadPost" }
|
load_breakpoints_event = { "BufReadPost" }
|
||||||
}
|
}
|
||||||
require("dap-go").setup()
|
|
||||||
|
|
||||||
local stepping_keymaps = {
|
local stepping_keymaps = {
|
||||||
n = {
|
n = {
|
||||||
|
|
@ -46,6 +46,7 @@ return {
|
||||||
"regex",
|
"regex",
|
||||||
"dap_repl",
|
"dap_repl",
|
||||||
"muttrc",
|
"muttrc",
|
||||||
|
"python",
|
||||||
},
|
},
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
-- This can be updated to a list of languages instead of defaulting to true
|
-- 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