JS Debug using obsolete vscode-chrome-debug lib
This commit is contained in:
parent
80b4d0176b
commit
07d3bcb177
8
init.lua
8
init.lua
|
@ -651,7 +651,9 @@ require('lazy').setup({
|
|||
capabilities = lsp_capabilities,
|
||||
filetypes = { 'typescript', 'html', 'angular', 'htmlangular' },
|
||||
root_dir = function(fname)
|
||||
return require('lspconfig.util').root_pattern('angular.json', 'workspace.json', 'nx.json', 'package.json', 'tsconfig.base.json')(fname)
|
||||
return require('lspconfig.util').root_pattern('angular.json', 'workspace.json', 'nx.json', 'package.json', 'tsconfig.base.json', 'project.json')(
|
||||
fname
|
||||
)
|
||||
end,
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
new_config.cmd = {
|
||||
|
@ -913,7 +915,7 @@ require('lazy').setup({
|
|||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
config = function()
|
||||
require('everforest').setup {
|
||||
background = 'medium',
|
||||
background = 'hard',
|
||||
ui_contrast = 'low',
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1036,7 @@ require('lazy').setup({
|
|||
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||
--
|
||||
-- require 'kickstart.plugins.debug',
|
||||
require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
require 'kickstart.plugins.autopairs',
|
||||
|
|
|
@ -23,37 +23,52 @@ return {
|
|||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
|
||||
-- Web
|
||||
{
|
||||
'microsoft/vscode-chrome-debug',
|
||||
version = '1.x',
|
||||
build = 'npm i && npm run build',
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
{
|
||||
'<F5>',
|
||||
'<F8>',
|
||||
function()
|
||||
require('dap').continue()
|
||||
end,
|
||||
desc = 'Debug: Start/Continue',
|
||||
},
|
||||
{
|
||||
'<F1>',
|
||||
'<F10>',
|
||||
function()
|
||||
require('dap').step_into()
|
||||
end,
|
||||
desc = 'Debug: Step Into',
|
||||
},
|
||||
{
|
||||
'<F2>',
|
||||
'<F9>',
|
||||
function()
|
||||
require('dap').step_over()
|
||||
end,
|
||||
desc = 'Debug: Step Over',
|
||||
},
|
||||
{
|
||||
'<F3>',
|
||||
'<F11>',
|
||||
function()
|
||||
require('dap').step_out()
|
||||
end,
|
||||
desc = 'Debug: Step Out',
|
||||
},
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
{
|
||||
'<F6>',
|
||||
function()
|
||||
require('dapui').toggle()
|
||||
end,
|
||||
desc = 'Debug: See last session result.',
|
||||
},
|
||||
{
|
||||
'<leader>b',
|
||||
function()
|
||||
|
@ -68,14 +83,6 @@ return {
|
|||
end,
|
||||
desc = 'Debug: Set Breakpoint',
|
||||
},
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
{
|
||||
'<F7>',
|
||||
function()
|
||||
require('dapui').toggle()
|
||||
end,
|
||||
desc = 'Debug: See last session result.',
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
|
@ -136,6 +143,29 @@ return {
|
|||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
dap.adapters.chrome = {
|
||||
type = 'executable',
|
||||
command = 'node',
|
||||
args = { vim.fn.stdpath 'data' .. '/lazy/vscode-chrome-debug/out/src/chromeDebug.js' }, -- TODO adjust
|
||||
}
|
||||
|
||||
-- TODO: Figure out how to launch chrome automatically
|
||||
-- TODO: Figure out why I have two additional configurations when starting debugger: "Launch Chrome Debugger", "Debug App Two"
|
||||
-- now I have to do "open -a "Google Chrome" --args --remote-debugging-port=9222"
|
||||
dap.configurations.typescript = {
|
||||
{
|
||||
name = 'Attach to Chrome',
|
||||
type = 'chrome',
|
||||
request = 'attach',
|
||||
program = '${file}',
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
port = 9222,
|
||||
webRoot = '${workspaceFolder}',
|
||||
},
|
||||
}
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
|
|
Loading…
Reference in New Issue