Open daniellam258 opened 2 years ago
I'm not sure if this is the correct way, but I got mine to work with this. Basically it loads defaults for jsnode
and then configure typescript to use node2
.
-- From the instruction on this repo
local dap_install = require("dap-install")
dap_install.config("jsnode", {})
-- From github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#Javascript
local dap = require("dap")
dap.configurations.typescript = {
{
name = 'Launch',
type = 'node2',
request = 'launch',
program = '${file}',
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = 'inspector',
console = 'integratedTerminal',
},
{
-- For this to work you need to make sure the node process is started with the `--inspect` flag.
name = 'Attach to process',
type = 'node2',
request = 'attach',
processId = require'dap.utils'.pick_process,
},
}
I think the fix applied to #38 (340cb26c3733a78864487e9ff6f6ec0f517cdd20) can also be done for this issue
I'm not sure if this is the correct way, but I got mine to work with this. Basically it loads defaults for
jsnode
and then configure typescript to usenode2
.-- From the instruction on this repo local dap_install = require("dap-install") dap_install.config("jsnode", {}) -- From github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#Javascript local dap = require("dap") dap.configurations.typescript = { { name = 'Launch', type = 'node2', request = 'launch', program = '${file}', cwd = vim.fn.getcwd(), sourceMaps = true, protocol = 'inspector', console = 'integratedTerminal', }, { -- For this to work you need to make sure the node process is started with the `--inspect` flag. name = 'Attach to process', type = 'node2', request = 'attach', processId = require'dap.utils'.pick_process, }, }
I think the fix applied to #38 (340cb26) can also be done for this issue
Not having much luck with this, :lua require"dap".continue()
seems to just fail silently now (was having the same issue as OP before)
Was able to get typescript working after running DIInstall jsnode
, adding outFiles
to the above config (see below), and running tsc -p .
in the project root. Not sure if dap is supposed to build .ts files itself, but this is trivial to do from vim anyway. Full config:
local dap_install = require('dap-install')
dap_install.config('jsnode', {})
local dap = require('dap')
dap.configurations.typescript = {
{
name = 'Run',
type = 'node2',
request = 'launch',
program = '${file}',
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = 'inspector',
console = 'integratedTerminal',
outFiles = {"${workspaceFolder}/build/**/*.js"},
},
{
name = 'Attach to process',
type = 'node2',
request = 'attach',
processId = require'dap.utils'.pick_process,
},
}
I'm new to neovim. It seems that typescript is not supported for jsnode?