{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiant55qfihvoaj4xsiquzsjqzufcckwheprcslgtzilmzf7egsz3e",
    "uri": "at://did:plc:wszrgoqdwy3i2dfeub2mt3wf/app.bsky.feed.post/3mjps6satbth2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiash42xjj7kaex3pasxqgku7p6any6flttcqqkm65vchl77sgysnq"
    },
    "mimeType": "image/png",
    "size": 57009
  },
  "description": "How to use Neovim, nvim-dap, Mason and `js-debug-adapter` to add debugging capabilities for a Javascript/Typescript application.",
  "path": "/posts/2026/04/17/nvim-dap/",
  "publishedAt": "2026-04-17T20:36:14.000Z",
  "site": "https://www.jvt.me",
  "tags": [
    "blogumentation",
    "neovim",
    "Renovate",
    "mason.nvim",
    "nvim-dap",
    "js-debug-adapter (aka vscode-js-debug)"
  ],
  "textContent": "As I've been working more with Typescript - especially with Renovate - I've been feeling the need to _finally_ invest in getting a debugger set up. Although I've been a fan of either `console.log`s and/or using OpenTelemetry tracing for debugging how things have been working in the project, there's been a few things this week that would be more convenient if I could i.e. interactively check some of the combinations of arguments coming into functions.\n\nAs I'm trying to - where possible - stay in Neovim, I thought I'd finally take a look at the Debug Adapter Protocol (DAP) functionality, and see if I could get it working.\n\nThe below is the result of an hour this morning fighting various plugins, outdated Issue threads in GitHub, \"batteries included\" plugins that didn't work, and so I've found that this is the _minimal_ setup needed.\n\nThis is using:\n\n  * mason.nvim\n  * nvim-dap\n  * js-debug-adapter (aka vscode-js-debug)\n\n\n\n\n    require('lazy').setup({\n      {\n        \"mfussenegger/nvim-dap\",\n        config = function()\n          local dap = require(\"dap\")\n\n          dap.adapters[\"pwa-node\"] = {\n            type = \"server\",\n            host = \"127.0.0.1\",\n            port = \"${port}\",\n            executable = {\n              command = \"node\",\n              args = {\n                -- NOTE that we don't need to hardcode the path, but can instead use the location from the Mason-installed version via `:MasonInstall js-debug-adapter`\n                vim.fn.stdpath(\"data\") .. \"/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js\",\n                -- NOTE that there's an issue with nvim-dap calling this if you DO NOT specify a port and the host as `127.0.0.1`\n                \"${port}\",\n                \"127.0.0.1\",\n              },\n            },\n          }\n\n          for _, language in ipairs { 'typescript', 'javascript' } do\n            dap.configurations[language] = {\n              -- at a minimum, it's nice to be able to interactively pick the process\n              {\n                type = 'pwa-node',\n                request = 'attach',\n                name = 'Attach',\n                processId = require('dap.utils').pick_process,\n                cwd = '${workspaceFolder}',\n              },\n              -- ...\n            }\n          end\n        end\n      },\n    })\n\n\nWith these settings, you're then able to attach to a running Node process:",
  "title": "Setting up Neovim with the Debug Adapter Protocol for Javascript/Typescript",
  "updatedAt": "2026-04-17T20:36:14.000Z"
}