|
|
|
@ -20,6 +20,7 @@ return {
|
|
|
|
|
|
|
|
|
|
-- Add your own debuggers here
|
|
|
|
|
'leoluz/nvim-dap-go',
|
|
|
|
|
'mxsdev/nvim-dap-vscode-js'
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
local dap = require 'dap'
|
|
|
|
@ -39,6 +40,8 @@ return {
|
|
|
|
|
ensure_installed = {
|
|
|
|
|
-- Update this to ensure that you have the debuggers for the langs you want
|
|
|
|
|
'delve',
|
|
|
|
|
'typescript',
|
|
|
|
|
'typescriptreact',
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -83,5 +86,44 @@ return {
|
|
|
|
|
|
|
|
|
|
-- Install golang specific config
|
|
|
|
|
require('dap-go').setup()
|
|
|
|
|
|
|
|
|
|
require("dap-vscode-js").setup({
|
|
|
|
|
-- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
|
|
|
|
debugger_path = vim.fn.stdpath('data') .. "/lazy/vscode-js-debug", -- Path to vscode-js-debug installation.
|
|
|
|
|
-- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
|
|
|
|
|
adapters = { 'chrome', 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost', 'node', 'chrome' }, -- which adapters to register in nvim-dap
|
|
|
|
|
-- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging
|
|
|
|
|
-- log_file_level = false -- Logging level for output to file. Set to false to disable file logging.
|
|
|
|
|
-- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output.
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
local js_based_languages = { "typescript", "javascript", "typescriptreact" }
|
|
|
|
|
|
|
|
|
|
for _, language in ipairs(js_based_languages) do
|
|
|
|
|
require("dap").configurations[language] = {
|
|
|
|
|
{
|
|
|
|
|
type = "pwa-node",
|
|
|
|
|
request = "launch",
|
|
|
|
|
name = "Launch file",
|
|
|
|
|
program = "${file}",
|
|
|
|
|
cwd = "${workspaceFolder}",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type = "pwa-node",
|
|
|
|
|
request = "attach",
|
|
|
|
|
name = "Attach",
|
|
|
|
|
processId = require 'dap.utils'.pick_process,
|
|
|
|
|
cwd = "${workspaceFolder}",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type = "pwa-chrome",
|
|
|
|
|
request = "launch",
|
|
|
|
|
name = "Start Chrome with \"localhost\"",
|
|
|
|
|
url = "http://localhost:3000",
|
|
|
|
|
webRoot = "${workspaceFolder}",
|
|
|
|
|
userDataDir = "${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
}
|
|
|
|
|