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,
 | 
					          capabilities = lsp_capabilities,
 | 
				
			||||||
          filetypes = { 'typescript', 'html', 'angular', 'htmlangular' },
 | 
					          filetypes = { 'typescript', 'html', 'angular', 'htmlangular' },
 | 
				
			||||||
          root_dir = function(fname)
 | 
					          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,
 | 
					          end,
 | 
				
			||||||
          on_new_config = function(new_config, new_root_dir)
 | 
					          on_new_config = function(new_config, new_root_dir)
 | 
				
			||||||
            new_config.cmd = {
 | 
					            new_config.cmd = {
 | 
				
			||||||
| 
						 | 
					@ -913,7 +915,7 @@ require('lazy').setup({
 | 
				
			||||||
    priority = 1000, -- Make sure to load this before all the other start plugins.
 | 
					    priority = 1000, -- Make sure to load this before all the other start plugins.
 | 
				
			||||||
    config = function()
 | 
					    config = function()
 | 
				
			||||||
      require('everforest').setup {
 | 
					      require('everforest').setup {
 | 
				
			||||||
        background = 'medium',
 | 
					        background = 'hard',
 | 
				
			||||||
        ui_contrast = 'low',
 | 
					        ui_contrast = 'low',
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1034,7 +1036,7 @@ require('lazy').setup({
 | 
				
			||||||
  --  Here are some example plugins that I've included in the Kickstart repository.
 | 
					  --  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).
 | 
					  --  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.indent_line',
 | 
				
			||||||
  -- require 'kickstart.plugins.lint',
 | 
					  -- require 'kickstart.plugins.lint',
 | 
				
			||||||
  require 'kickstart.plugins.autopairs',
 | 
					  require 'kickstart.plugins.autopairs',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,37 +23,52 @@ return {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    -- Add your own debuggers here
 | 
					    -- Add your own debuggers here
 | 
				
			||||||
    'leoluz/nvim-dap-go',
 | 
					    'leoluz/nvim-dap-go',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    -- Web
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      'microsoft/vscode-chrome-debug',
 | 
				
			||||||
 | 
					      version = '1.x',
 | 
				
			||||||
 | 
					      build = 'npm i && npm run build',
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  keys = {
 | 
					  keys = {
 | 
				
			||||||
    -- Basic debugging keymaps, feel free to change to your liking!
 | 
					    -- Basic debugging keymaps, feel free to change to your liking!
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      '<F5>',
 | 
					      '<F8>',
 | 
				
			||||||
      function()
 | 
					      function()
 | 
				
			||||||
        require('dap').continue()
 | 
					        require('dap').continue()
 | 
				
			||||||
      end,
 | 
					      end,
 | 
				
			||||||
      desc = 'Debug: Start/Continue',
 | 
					      desc = 'Debug: Start/Continue',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      '<F1>',
 | 
					      '<F10>',
 | 
				
			||||||
      function()
 | 
					      function()
 | 
				
			||||||
        require('dap').step_into()
 | 
					        require('dap').step_into()
 | 
				
			||||||
      end,
 | 
					      end,
 | 
				
			||||||
      desc = 'Debug: Step Into',
 | 
					      desc = 'Debug: Step Into',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      '<F2>',
 | 
					      '<F9>',
 | 
				
			||||||
      function()
 | 
					      function()
 | 
				
			||||||
        require('dap').step_over()
 | 
					        require('dap').step_over()
 | 
				
			||||||
      end,
 | 
					      end,
 | 
				
			||||||
      desc = 'Debug: Step Over',
 | 
					      desc = 'Debug: Step Over',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      '<F3>',
 | 
					      '<F11>',
 | 
				
			||||||
      function()
 | 
					      function()
 | 
				
			||||||
        require('dap').step_out()
 | 
					        require('dap').step_out()
 | 
				
			||||||
      end,
 | 
					      end,
 | 
				
			||||||
      desc = 'Debug: Step Out',
 | 
					      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',
 | 
					      '<leader>b',
 | 
				
			||||||
      function()
 | 
					      function()
 | 
				
			||||||
| 
						 | 
					@ -68,14 +83,6 @@ return {
 | 
				
			||||||
      end,
 | 
					      end,
 | 
				
			||||||
      desc = 'Debug: Set Breakpoint',
 | 
					      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()
 | 
					  config = function()
 | 
				
			||||||
    local dap = require 'dap'
 | 
					    local dap = require 'dap'
 | 
				
			||||||
| 
						 | 
					@ -136,6 +143,29 @@ return {
 | 
				
			||||||
    dap.listeners.before.event_terminated['dapui_config'] = dapui.close
 | 
					    dap.listeners.before.event_terminated['dapui_config'] = dapui.close
 | 
				
			||||||
    dap.listeners.before.event_exited['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
 | 
					    -- Install golang specific config
 | 
				
			||||||
    require('dap-go').setup {
 | 
					    require('dap-go').setup {
 | 
				
			||||||
      delve = {
 | 
					      delve = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue