-- Minimal init.lua to test out nvim-dap (for Node.js, really NestJS) -- lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ "mfussenegger/nvim-dap", { "rcarriga/nvim-dap-ui", requires = "mfussenegger/nvim-dap" }, { "mxsdev/nvim-dap-vscode-js", requires = "mfussenegger/nvim-dap" }, { "microsoft/vscode-js-debug", opt = true, run = "npm install --legacy-peer-deps && npx gulp dapDebugServerBundle && mv dist out", }, "leoluz/nvim-dap-go", "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", }) --[[ mason Mason manages external editor plugins such as LSP servers, DAP servers, linters, and formatters. There are further recommended plugins for better integration. --]] require('mason').setup() require('mason-lspconfig').setup() -- setup adapters require('dap-vscode-js').setup({ node_path = 'node', debugger_path = vim.fn.stdpath('data') .. '/mason/packages/js-debug-adapter', debugger_cmd = { 'js-debug-adapter' }, adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, log_file_path = vim.fn.stdpath('cache') .. '/dap_vscode_js.log', log_file_level = 1, log_console_level = vim.log.levels.TRACE, }) local dap = require('dap') for _, language in ipairs({ "typescript", "javascript" }) do dap.configurations[language] = { { type = "pwa-node", request = "launch", name = "Launch file", program = "${file}", cwd = "${workspaceFolder}", }, --[[ { type = "pwa-node", request = "launch", name = "Debug Nest Framework", args = { "${workspaceFolder}/src/main.ts" }, runtimeArgs = { "--nolazy", "-r", "ts-node/register" }, sourceMaps = true, cwd = "${workspaceRoot}", protocol = "inspector", } --]] } end require('dap-go').setup() require('dapui').setup()