You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.5 KiB
70 lines
1.5 KiB
local M = require('module'):new()
|
|
local get_visual_selection = require('lib/get_visual_selection')
|
|
|
|
function M:boot()
|
|
vim.g.vdebug_options = {
|
|
break_on_open = 0,
|
|
path_maps = {
|
|
-- This is only evaluated on startup so will work if the editor is
|
|
-- started inside the project (I think vim-rooter will have run by
|
|
-- now) but not if you've navigated into a project like I do basically
|
|
-- every single time.
|
|
-- ["/var/www/html"] = getcwd()
|
|
},
|
|
marker_default = '*',
|
|
marker_closed_tree = '>',
|
|
marker_open_tree = 'v',
|
|
}
|
|
end
|
|
|
|
function M:setBreakpoint()
|
|
vim.cmd(":Breakpoint")
|
|
end
|
|
|
|
function M:setConditionalBreakpoint()
|
|
eval = vim.ui.input({
|
|
prompt = "Enter condition"
|
|
}, function(expression)
|
|
if (expression ~= nil) then
|
|
vim.cmd(":Breakpoint conditional " .. expression)
|
|
end
|
|
end)
|
|
end
|
|
|
|
function M:startTrace()
|
|
selected = get_visual_selection()
|
|
|
|
if (selected == nil) then
|
|
vim.ui.input({
|
|
prompt = "Enter trace expression"
|
|
}, function(expression)
|
|
if (expression ~= nil) then
|
|
vim.cmd(":VdebugTrace " .. expression)
|
|
end
|
|
end)
|
|
else
|
|
vim.cmd(":VdebugTrace " .. selected)
|
|
end
|
|
end
|
|
|
|
function M:eval()
|
|
selected = get_visual_selection()
|
|
|
|
if (selected == nil) then
|
|
vim.ui.input({
|
|
prompt = "Enter eval expression"
|
|
}, function(expression)
|
|
if (expression ~= nil) then
|
|
vim.cmd(":VdebugEval " .. expression)
|
|
end
|
|
end)
|
|
else
|
|
vim.cmd(":VdebugEval " .. selected)
|
|
end
|
|
end
|
|
|
|
function M:showBreakpoints()
|
|
vim.cmd(":BreakpointWindow")
|
|
end
|
|
|
|
return M
|
|
|