Went back to single script for luadebug
This commit is contained in:
31
init.lua
31
init.lua
@ -153,19 +153,30 @@ local function get_selected_target()
|
||||
end
|
||||
|
||||
-- ---------- run target & pipe stdout/stderr into the view ----------
|
||||
local function ensure_debug_view()
|
||||
if active_view then
|
||||
return active_view
|
||||
end
|
||||
|
||||
local node = core.root_view:get_active_node()
|
||||
local view = JPDebugView()
|
||||
|
||||
-- Defer the add until the node is unlocked (next tick).
|
||||
core.add_thread(function()
|
||||
-- Wait until the layout is safe to mutate
|
||||
while node.locked do coroutine.yield(0) end
|
||||
node:add_view(view)
|
||||
core.redraw = true
|
||||
end)
|
||||
|
||||
active_view = view
|
||||
return view
|
||||
end
|
||||
|
||||
local function run_target(target, name)
|
||||
-- Create/get view to push text to
|
||||
-- TODO fix this, it throws a node is locked error once in a while
|
||||
local view = nil
|
||||
if active_view then
|
||||
-- If there is already a view use that one
|
||||
view = active_view
|
||||
else
|
||||
-- Otherwhise lets make one
|
||||
view = JPDebugView()
|
||||
core.root_view:get_active_node():add_view(view)
|
||||
active_view = view
|
||||
end
|
||||
local view = ensure_debug_view()
|
||||
|
||||
-- Check if we have a runner
|
||||
for runner_name,runner in pairs(core.jpdebug.runners) do
|
||||
|
||||
Reference in New Issue
Block a user