dap
This commit is contained in:
		
							
								
								
									
										0
									
								
								nvim/lua/dap/jsts.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								nvim/lua/dap/jsts.lua
									
									
									
									
									
										Normal file
									
								
							@@ -1,10 +1,12 @@
 | 
			
		||||
vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''})
 | 
			
		||||
vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''})
 | 
			
		||||
vim.fn.sign_define('DapBreakpoint', { text = '🟥', texthl = '', linehl = '', numhl = '' })
 | 
			
		||||
vim.fn.sign_define('DapStopped', { text = '⭐️', texthl = '', linehl = '', numhl = '' })
 | 
			
		||||
local dap = require('dap')
 | 
			
		||||
local dapui = require("dapui")
 | 
			
		||||
 | 
			
		||||
local M ={}
 | 
			
		||||
local M = {}
 | 
			
		||||
 | 
			
		||||
local  DEBUGGER_PATH = {os.getenv('HOME')..'/.local/share/nvim/mason/packages/js-debug-adapter'}
 | 
			
		||||
--local  DEBUGGER_PATH = {os.getenv('HOME')..'/.local/share/nvim/mason/packages/js-debug-adapter'}
 | 
			
		||||
local DEBUGGER_PATH = vim.fn.stdpath "data" .. "/site/pack/packer/opt/vscode-js-debug"
 | 
			
		||||
 | 
			
		||||
function M.setup()
 | 
			
		||||
  dap.adapters.lldb = {
 | 
			
		||||
@@ -19,7 +21,7 @@ function M.setup()
 | 
			
		||||
      type = 'lldb',
 | 
			
		||||
      request = 'launch',
 | 
			
		||||
      program = function()
 | 
			
		||||
        return vim.fn.input('Path to executable: ',vim.fn.getcwd() .. '/', 'file')
 | 
			
		||||
        return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
 | 
			
		||||
      end,
 | 
			
		||||
      cwd = '${workspaceFolder}',
 | 
			
		||||
      stopOnEntry = false,
 | 
			
		||||
@@ -31,40 +33,50 @@ function M.setup()
 | 
			
		||||
  require('dap-vscode-js').setup {
 | 
			
		||||
    node_path = "node",
 | 
			
		||||
    debugger_path = DEBUGGER_PATH,
 | 
			
		||||
    adapters = {"pwa-node","pwa-chrome","pwa-msedge","node-terminal", "pwa-extensionHost"}
 | 
			
		||||
    adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" }
 | 
			
		||||
  }
 | 
			
		||||
  for _, language in ipairs {"typescript", "javascript"} do
 | 
			
		||||
    dap.configurations[language] ={{
 | 
			
		||||
  for _, language in ipairs { "typescript", "javascript" } do
 | 
			
		||||
    dap.configurations[language] = { {
 | 
			
		||||
      type = "pwa-node",
 | 
			
		||||
      request = "launch",
 | 
			
		||||
      name = "Launch File",
 | 
			
		||||
      program = "${file}",
 | 
			
		||||
      cwd = "${workspacefolder}"
 | 
			
		||||
      cwd = "${workspaceFolder}"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      type = "pwa-node",
 | 
			
		||||
      request = "attach",
 | 
			
		||||
      name = "Attach",
 | 
			
		||||
      processId = require("dap.utils").pick_process,
 | 
			
		||||
      cwd = "${workspacefolder}"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      type = "pwa-node",
 | 
			
		||||
      request = "launch",
 | 
			
		||||
      name = "Debug Jest Tests",
 | 
			
		||||
      runtimeExecutable = "node",
 | 
			
		||||
      runtimeArgs = {
 | 
			
		||||
        "./node_modules/jest/bin/jestj",
 | 
			
		||||
        "--runInBand",
 | 
			
		||||
      {
 | 
			
		||||
        type = "pwa-node",
 | 
			
		||||
        request = "attach",
 | 
			
		||||
        name = "Attach",
 | 
			
		||||
        processId = require("dap.utils").pick_process,
 | 
			
		||||
        cwd = "${workspaceFolder}"
 | 
			
		||||
      },
 | 
			
		||||
      rootPath = "${workspaceFolder}",
 | 
			
		||||
      console = "integratedTerminal",
 | 
			
		||||
      internalConsoleOptions = "neverOpen",
 | 
			
		||||
      cwd = "${workspacefolder}"
 | 
			
		||||
    }}
 | 
			
		||||
      {
 | 
			
		||||
        type = "pwa-node",
 | 
			
		||||
        request = "launch",
 | 
			
		||||
        name = "Debug Jest Tests",
 | 
			
		||||
        runtimeExecutable = "node",
 | 
			
		||||
        runtimeArgs = {
 | 
			
		||||
          "./node_modules/jest/bin/jest.js",
 | 
			
		||||
          "--runInBand",
 | 
			
		||||
        },
 | 
			
		||||
        rootPath = "${workspaceFolder}",
 | 
			
		||||
        console = "integratedTerminal",
 | 
			
		||||
        internalConsoleOptions = "neverOpen",
 | 
			
		||||
        cwd = "${workspaceFolder}"
 | 
			
		||||
      } }
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
M.setup()
 | 
			
		||||
return M
 | 
			
		||||
require("dapui").setup()
 | 
			
		||||
 | 
			
		||||
M.setup()
 | 
			
		||||
dap.listeners.after.event_initialized["dapui_config"] = function()
 | 
			
		||||
  dapui.open()
 | 
			
		||||
end
 | 
			
		||||
dap.listeners.before.event_terminated["dapui_config"] = function()
 | 
			
		||||
  dapui.close()
 | 
			
		||||
end
 | 
			
		||||
dap.listeners.before.event_exited["dapui_config"] = function()
 | 
			
		||||
  dapui.close()
 | 
			
		||||
end
 | 
			
		||||
return M
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user