retab and cleanup
This commit is contained in:
+30
-28
@@ -8,43 +8,45 @@ vim.g.python3_host_prog = get_python_venv_path()
|
|||||||
|
|
||||||
-- POPULATE QFLIST ON ERROR {{{1
|
-- POPULATE QFLIST ON ERROR {{{1
|
||||||
do
|
do
|
||||||
local function full_trace()
|
local function full_trace()
|
||||||
local lines = {}
|
local lines = {}
|
||||||
|
|
||||||
local level = 2
|
local level = 2
|
||||||
while true do
|
while true do
|
||||||
local info = debug.getinfo(level, "Sln")
|
local info = debug.getinfo(level, "Sln")
|
||||||
if not info then break end
|
if not info then break end
|
||||||
|
|
||||||
local src = info.source or "?"
|
local src = info.source or "?"
|
||||||
local file = src:gsub("^@", "") -- remove @ prefix
|
local file = src:gsub("^@", "") -- remove @ prefix
|
||||||
|
|
||||||
local line = string.format(
|
local line = string.format(
|
||||||
"%s:%d: in %s",
|
"%s:%d: in %s",
|
||||||
file,
|
file,
|
||||||
info.currentline or 0,
|
info.currentline or 0,
|
||||||
info.name or "?"
|
info.name or "?"
|
||||||
)
|
)
|
||||||
|
|
||||||
table.insert(lines, line)
|
table.insert(lines, line)
|
||||||
level = level + 1
|
level = level + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return table.concat(lines, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
return table.concat(lines, "\n")
|
local orig = debug.traceback
|
||||||
end
|
|
||||||
|
|
||||||
local orig = debug.traceback
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
debug.traceback = function(...)
|
||||||
|
local trace = full_trace()
|
||||||
|
local orig_trace = orig(...) -- TODO remove. find message instead
|
||||||
|
|
||||||
debug.traceback = function(...)
|
vim.fn.setqflist({}, "a", {
|
||||||
local trace = full_trace()
|
title = "Traceback",
|
||||||
|
lines = vim.split(trace, "\n"),
|
||||||
|
})
|
||||||
|
|
||||||
vim.fn.setqflist({}, "a", {
|
return orig_trace
|
||||||
title = "Traceback",
|
end
|
||||||
lines = vim.split(trace, "\n"),
|
|
||||||
})
|
|
||||||
|
|
||||||
return trace
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- GENERAL SETTINGS {{{1
|
-- GENERAL SETTINGS {{{1
|
||||||
|
|||||||
Reference in New Issue
Block a user