Add dap support

This commit is contained in:
Alexander Gehrke 2025-09-19 16:49:25 +02:00
parent e5f3edd8c8
commit c56438c44b
5 changed files with 70 additions and 6 deletions

View file

@ -23,7 +23,7 @@ return {
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set up format-on-save
format_on_save = { timeout_ms = 500, lsp_fallback = true },
--format_on_save = { timeout_ms = 500, lsp_fallback = true },
-- Customize formatters
formatters = {
shfmt = {

60
lua/plugins/dap.lua Normal file
View file

@ -0,0 +1,60 @@
return {
{
"mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
dap.adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "js-debug-adapter",
args = { "${port}" },
}
}
dap.configurations.javascript = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = 'pwa-node',
request = 'attach',
name = 'Attach to Node app',
address = 'localhost',
port = 9229,
cwd = '${workspaceFolder}',
restart = true,
},
}
end
},
{
"rcarriga/nvim-dap-ui",
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
config = function(opts)
local dap, dapui = require("dap"), require("dapui")
dapui.setup(opts)
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
end,
},
{
"theHamsta/nvim-dap-virtual-text",
dependencies = { "mfussenegger/nvim-dap", "nvim-treesitter/nvim-treesitter" }
}
}

View file

@ -7,6 +7,7 @@ return {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
"nvim-dap-ui"
},
},
},
@ -46,9 +47,9 @@ return {
completion = {
documentation = { auto_show = false },
list = { selection = { preselect = false, auto_insert = true } },
ghost_text = { enabled = true },
},
fuzzy = { implementation = "prefer_rust_with_warning" },
ghost_text = { enabled = true },
},
opts_extend = { "sources.default" },
},

View file

@ -23,22 +23,22 @@ return {
--},
config = function()
local highlightLines = {
"RainbowRed",
"RainbowCyan",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
"RainbowRed",
}
local highlightDimLines = {
"RainbowDimRed",
"RainbowDimCyan",
"RainbowDimYellow",
"RainbowDimBlue",
"RainbowDimOrange",
"RainbowDimGreen",
"RainbowDimViolet",
"RainbowDimCyan",
"RainbowDimRed",
}
local hooks = require 'ibl.hooks'