wip: dap
This commit is contained in:
parent
524bdc33ca
commit
56c94d00db
@ -7,13 +7,34 @@ 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'}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
|
dap.adapters.lldb = {
|
||||||
|
type = 'executable',
|
||||||
|
command = '/usr/bin/lldb-vscode',
|
||||||
|
name = 'lldb'
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = 'Launch',
|
||||||
|
type = 'lldb',
|
||||||
|
request = 'launch',
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to executable: ',vim.fn.getcwd() .. '/', 'file')
|
||||||
|
end,
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
stopOnEntry = false,
|
||||||
|
args = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dap.configurations.c = dap.configurations.cpp
|
||||||
|
dap.configurations.rust = dap.configurations.cpp
|
||||||
require('dap-vscode-js').setup {
|
require('dap-vscode-js').setup {
|
||||||
node_path = "node",
|
node_path = "node",
|
||||||
debugger_path = DEBUGGER_PATH,
|
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
|
for _, language in ipairs {"typescript", "javascript"} do
|
||||||
dap.configurations[language] = {
|
dap.configurations[language] ={{
|
||||||
type = "pwa-node",
|
type = "pwa-node",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
name = "Launch File",
|
name = "Launch File",
|
||||||
@ -40,40 +61,10 @@ function M.setup()
|
|||||||
console = "integratedTerminal",
|
console = "integratedTerminal",
|
||||||
internalConsoleOptions = "neverOpen",
|
internalConsoleOptions = "neverOpen",
|
||||||
cwd = "${workspacefolder}"
|
cwd = "${workspacefolder}"
|
||||||
}
|
}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function configure_debuggers()
|
M.setup()
|
||||||
require("config.dap.javascript").setup()
|
|
||||||
require("config.dap.typescript").setup()
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--dap.adapters.node2 = {
|
|
||||||
-- type = 'executable',
|
|
||||||
-- command = 'node',
|
|
||||||
-- args = {os.getenv('HOME') .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js'},
|
|
||||||
--}
|
|
||||||
--dap.configurations.javascript = {
|
|
||||||
-- {
|
|
||||||
-- 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,
|
|
||||||
-- },
|
|
||||||
--}
|
|
||||||
|
@ -42,3 +42,12 @@ nmap("<leader>n",":NvimTreeToggle<cr>")
|
|||||||
nmap("<leader>zn","zf%")
|
nmap("<leader>zn","zf%")
|
||||||
nmap("<leader>y",'\"+y')
|
nmap("<leader>y",'\"+y')
|
||||||
vmap("<leader>y",'\"+y')
|
vmap("<leader>y",'\"+y')
|
||||||
|
|
||||||
|
nmap("<F5>",":lua require'dap'.continue()<CR>")
|
||||||
|
nmap("<F10>",":lua require'dap'.step_over()<CR>")
|
||||||
|
nmap("<F11>",":lua require'dap'.step_into()<CR>")
|
||||||
|
nmap("<F12>",":lua require'dap'.step_out()<CR>")
|
||||||
|
nmap("<leader>b",":lua require'dap'.toggle_breakpoint()<CR>")
|
||||||
|
nmap("<leader>B",":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>")
|
||||||
|
nmap("<leader>lp",":lua require'dap'.set_breakpoint(nil,nil,vim.fn.input('Log point message: '))<CR>")
|
||||||
|
nmap("<leader>lp",":lua require'dap'.repl.open()<CR>")
|
||||||
|
@ -36,7 +36,9 @@ local lsp_flags = {
|
|||||||
-- This is the default in Nvim 0.7+
|
-- This is the default in Nvim 0.7+
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
}
|
}
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(
|
local capabilities = require('cmp_nvim_lsp').default_capabilities(
|
||||||
|
|
||||||
vim.lsp.protocol.make_client_capabilities()
|
vim.lsp.protocol.make_client_capabilities()
|
||||||
)
|
)
|
||||||
require('mason-lspconfig').setup_handlers {
|
require('mason-lspconfig').setup_handlers {
|
||||||
@ -52,8 +54,8 @@ require('mason-lspconfig').setup_handlers {
|
|||||||
tools = {
|
tools = {
|
||||||
inlay_hints = {
|
inlay_hints = {
|
||||||
auto = true,
|
auto = true,
|
||||||
only_current_line = false,
|
only_current_line = true,
|
||||||
show_parameter_hints = true,
|
show_parameter_hints = false,
|
||||||
parameter_hints_prefix = "<-",
|
parameter_hints_prefix = "<-",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -71,16 +73,6 @@ require('mason-lspconfig').setup_handlers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
require('rust-tools').setup(rustToolsOpts)
|
require('rust-tools').setup(rustToolsOpts)
|
||||||
--on_attach = on_attach,
|
|
||||||
--flags = lsp_flags,
|
|
||||||
require('lspconfig')['rust_analyzer'].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
flags = lsp_flags,
|
|
||||||
-- server-specific settings...
|
|
||||||
settings = {
|
|
||||||
["rust-analyzer"] = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
['sumneko_lua'] = function()
|
['sumneko_lua'] = function()
|
||||||
require('lspconfig')["sumneko_lua"].setup {
|
require('lspconfig')["sumneko_lua"].setup {
|
||||||
|
@ -13,7 +13,7 @@ require("packer").startup(function(use)
|
|||||||
"mfussenegger/nvim-dap-python",
|
"mfussenegger/nvim-dap-python",
|
||||||
"nvim-telescope/telescope-dap.nvim",
|
"nvim-telescope/telescope-dap.nvim",
|
||||||
{ "jbyuki/one-small-step-for-vimkind", module = "osv" },
|
{ "jbyuki/one-small-step-for-vimkind", module = "osv" },
|
||||||
{ "mxsdev/nvim-dap-vscode-js" },
|
"mxsdev/nvim-dap-vscode-js",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
use("jose-elias-alvarez/null-ls.nvim")
|
use("jose-elias-alvarez/null-ls.nvim")
|
||||||
|
Loading…
Reference in New Issue
Block a user