Skip to content

Instantly share code, notes, and snippets.

@myypo
Created November 29, 2023 13:24
Show Gist options
  • Save myypo/c51fef8f3ae32ed4f44eec9d691123ad to your computer and use it in GitHub Desktop.
Save myypo/c51fef8f3ae32ed4f44eec9d691123ad to your computer and use it in GitHub Desktop.
return {
"mxsdev/nvim-dap-vscode-js",
ft = { "typescript", "javascript" },
dependencies = {
{
"microsoft/vscode-js-debug",
version = "1.x",
build = "npm i && npm run compile vsDebugServerBundle && mv dist out",
},
},
config = function()
require("dap-vscode-js").setup({
debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug",
})
end,
}
return {
"mfussenegger/nvim-dap",
keys = {
{ "<F1>", "<cmd>lua require('dapui').toggle()<CR>", desc = "dapui_toggle" },
},
config = function()
local dap = require("dap")
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 = {},
},
}
dap.configurations.c = dap.configurations.cpp
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",
port = function()
return vim.fn.input("Select port: ", 9229)
end,
name = "Attach",
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,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment