Trying to get debugging going for JS/TS
This commit is contained in:
parent
938ff36c6b
commit
9d71ab4be4
2 changed files with 117 additions and 27 deletions
78
neovim/init-dap.lua
Normal file
78
neovim/init-dap.lua
Normal file
|
@ -0,0 +1,78 @@
|
|||
-- 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()
|
|
@ -457,14 +457,26 @@ require('dap-vscode-js').setup({
|
|||
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.ERROR,
|
||||
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 = "Debug Nest Framework",
|
||||
args = { "${workspaceFolder}/src/main.ts" },
|
||||
runtimeArgs = { "--nolazy", "-r", "ts-node/register" },
|
||||
sourceMaps = true,
|
||||
cwd = "${workspaceRoot}",
|
||||
protocol = "inspector",
|
||||
}
|
||||
}
|
||||
end
|
||||
--[[
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
|
@ -493,13 +505,13 @@ for _, language in ipairs({ "typescript", "javascript" }) do
|
|||
console = "integratedTerminal",
|
||||
internalConsoleOptions = "neverOpen",
|
||||
},
|
||||
}
|
||||
end
|
||||
--]]
|
||||
|
||||
--[[
|
||||
local types_to_filetypes_table = {}
|
||||
types_to_filetypes_table['pwa-node'] = { 'javascript', 'typescript' }
|
||||
require('dap.ext.vscode').load_launchjs(nil, types_to_filetypes_table)
|
||||
--]]
|
||||
|
||||
-- Tweak GitSigns blame color
|
||||
-- This differentiates the cursorline from the git blame text
|
||||
|
|
Loading…
Reference in a new issue