dap and dap ui + live-command and rust-tools updates
- setup signs for dap - improved dap and dapmode keybindings - live-command preview pluginmaster
parent
fba0ef8038
commit
b0ca1ac78d
@ -0,0 +1,10 @@
|
||||
-- local dap = require("dap")
|
||||
|
||||
local M = {}
|
||||
local opts = {
|
||||
|
||||
}
|
||||
|
||||
M.setup = function()
|
||||
end
|
||||
return M
|
@ -0,0 +1,82 @@
|
||||
local dapui = require('dapui')
|
||||
|
||||
local M = {}
|
||||
local opts = {
|
||||
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
||||
mappings = {
|
||||
-- Use a table to apply multiple mappings
|
||||
expand = { "<CR>", "<2-LeftMouse>" },
|
||||
open = "o",
|
||||
remove = "d",
|
||||
edit = "e",
|
||||
repl = "r",
|
||||
toggle = "t",
|
||||
},
|
||||
-- Expand lines larger than the window
|
||||
-- Requires >= 0.7
|
||||
expand_lines = vim.fn.has("nvim-0.7") == 1,
|
||||
-- Layouts define sections of the screen to place windows.
|
||||
-- The position can be "left", "right", "top" or "bottom".
|
||||
-- The size specifies the height/width depending on position. It can be an Int
|
||||
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
|
||||
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
|
||||
-- Elements are the elements shown in the layout (in order).
|
||||
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
-- Elements can be strings or table with id and size keys.
|
||||
{ id = "scopes", size = 0.25 },
|
||||
"breakpoints",
|
||||
"stacks",
|
||||
-- "watches",
|
||||
},
|
||||
size = 40, -- 40 columns
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"watches"
|
||||
-- "console",
|
||||
},
|
||||
size = 0.25, -- 25% of total lines
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
controls = {
|
||||
-- Requires Neovim nightly (or 0.8 when released)
|
||||
enabled = true,
|
||||
-- Display controls in this element
|
||||
element = "repl",
|
||||
icons = {
|
||||
pause = "",
|
||||
play = "",
|
||||
step_into = "",
|
||||
step_over = "",
|
||||
step_out = "",
|
||||
step_back = "",
|
||||
run_last = "↻",
|
||||
terminate = "",
|
||||
},
|
||||
},
|
||||
floating = {
|
||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
windows = { indent = 1 },
|
||||
render = {
|
||||
max_type_length = nil, -- Can be integer or nil.
|
||||
max_value_lines = 100, -- Can be integer or nil.
|
||||
}
|
||||
}
|
||||
|
||||
M.setup = function()
|
||||
dapui.setup(opts)
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,42 @@
|
||||
local M = {}
|
||||
|
||||
|
||||
local opts = {
|
||||
defaults = {
|
||||
enable_highlighting = true,
|
||||
inline_highlighting = true,
|
||||
hl_groups = {
|
||||
insertion = "DiffAdd",
|
||||
deletion = "DiffDelete",
|
||||
change = "DiffChange",
|
||||
},
|
||||
},
|
||||
|
||||
debug = true,
|
||||
commands = {
|
||||
Norm = { cmd = "norm" },
|
||||
Reg = {
|
||||
cmd = "norm",
|
||||
-- This will transform ":5Reg a" into ":norm 5@a"
|
||||
args = function(opts)
|
||||
return (opts.count == -1 and "" or opts.count) .. "@" .. opts.args
|
||||
end,
|
||||
range = "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function M.get_cmds()
|
||||
local cmds = {}
|
||||
for cmd, _ in pairs(opts.commands) do
|
||||
table.insert(cmds, cmd)
|
||||
end
|
||||
|
||||
return cmds
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
require("live-command").setup(opts)
|
||||
end
|
||||
|
||||
return M
|
@ -1,33 +0,0 @@
|
||||
local dapmode = require("spike.dapmode")
|
||||
|
||||
local M = {}
|
||||
|
||||
local function register_listeners()
|
||||
local present, dap = pcall(require, "dap")
|
||||
if not present then
|
||||
print("nvim-dap missing !")
|
||||
return
|
||||
end
|
||||
|
||||
dap.listeners.before['event_initialized']['spike-dap'] = function(session, body)
|
||||
dapmode.start()
|
||||
end
|
||||
|
||||
dap.listeners.after['event_terminated']['spike-dap'] = function(session, body)
|
||||
-- print("dap session ended")
|
||||
dapmode.stop()
|
||||
end
|
||||
end
|
||||
|
||||
function M.go_debug()
|
||||
local present, gdap = pcall(require, "go.dap")
|
||||
if not present then return end
|
||||
gdap.run()
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
dapmode.setup({})
|
||||
register_listeners()
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,70 @@
|
||||
local dapmode = require("spike.dap.dapmode")
|
||||
local daputils = require('spike.dap.utils')
|
||||
local dapui = require("dapui")
|
||||
|
||||
local M = {}
|
||||
M.signs = {
|
||||
DapBreakpoint = {
|
||||
icon = '',
|
||||
hl = 'DapBreakpoint'
|
||||
},
|
||||
DapLogPoint = {
|
||||
icon = 'ﳁ',
|
||||
hl = 'DapLogPoint',
|
||||
},
|
||||
DapStopped = {
|
||||
icon = '',
|
||||
hl = 'DapStopped',
|
||||
},
|
||||
DapBreakpointCondition = {
|
||||
icon = '',
|
||||
hl = 'DapBreakpointCondition',
|
||||
},
|
||||
DapBreakpointRejected = {
|
||||
icon = '',
|
||||
hl = 'DapBreakpointRejected'
|
||||
}
|
||||
}
|
||||
|
||||
local function register_listeners()
|
||||
local present, dap = pcall(require, "dap")
|
||||
if not present then
|
||||
print("nvim-dap missing !")
|
||||
return
|
||||
end
|
||||
|
||||
dap.listeners.before['event_initialized']['spike-dap'] = function(session, body)
|
||||
dapmode.start()
|
||||
dapui.open()
|
||||
end
|
||||
|
||||
dap.listeners.after['event_terminated']['spike-dap'] = function(session, body)
|
||||
-- print("dap session ended")
|
||||
dapmode.stop()
|
||||
dapui.close()
|
||||
end
|
||||
end
|
||||
|
||||
function M.go_debug()
|
||||
local present, gdap = pcall(require, "go.dap")
|
||||
if not present then return end
|
||||
gdap.run()
|
||||
end
|
||||
|
||||
local function set_signs()
|
||||
for sign, conf in pairs(M.signs) do
|
||||
vim.fn.sign_define(sign, {text = conf.icon, texthl=conf.hl})
|
||||
end
|
||||
end
|
||||
|
||||
function M.prepare_launch()
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
dapmode.setup({})
|
||||
register_listeners()
|
||||
set_signs()
|
||||
end
|
||||
|
||||
|
||||
return M
|
@ -0,0 +1,35 @@
|
||||
local ok, dap = pcall(require, 'dap')
|
||||
if not ok then
|
||||
vim.notify('dap module missing')
|
||||
end
|
||||
local M = {}
|
||||
|
||||
M.disconnect_dap = function()
|
||||
local has_dap, dap = pcall(require, 'dap')
|
||||
if has_dap then
|
||||
dap.disconnect()
|
||||
dap.repl.close()
|
||||
vim.cmd('sleep 100m') -- allow cleanup
|
||||
else
|
||||
vim.notify('dap not found')
|
||||
end
|
||||
end
|
||||
|
||||
M.dap_logpoint = function()
|
||||
vim.ui.input({ prompt = 'Logpoint message> '}, function (input)
|
||||
dap.set_breakpoint(nil,nil,input)
|
||||
end)
|
||||
end
|
||||
|
||||
-- if there are no breakpoints in the project set a breakpoint on the current
|
||||
-- line
|
||||
M.init_breakpoints = function()
|
||||
-- see https://github.com/rcarriga/nvim-dap-ui/blob/master/lua/dapui/state.lua
|
||||
-- for a reference to access dap breakpoint details
|
||||
local breakpoints = require('dap.breakpoints').get() or {}
|
||||
if #breakpoints == 0 then
|
||||
dap.set_breakpoint()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
Loading…
Reference in New Issue