From ae7fd0d27a72fa3088e84992eb5040853164dad6 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 29 Sep 2020 22:52:38 -0400 Subject: feat: Add status, better debug, and some associated refactors * [WIP]: Mon 28 Sep 2020 01:08:24 PM EDT * add much much better tracking. so much less hax * status updates, oneshot job updates, etc. * remove temp function * add status function * asdfasdfasdf --- scratch/old_perf_debug | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scratch/old_perf_debug (limited to 'scratch/old_perf_debug') diff --git a/scratch/old_perf_debug b/scratch/old_perf_debug new file mode 100644 index 0000000..3561a98 --- /dev/null +++ b/scratch/old_perf_debug @@ -0,0 +1,36 @@ + + +-- Until I have better profiling stuff, this will have to do. +PERF = function(...) end +PERF_DEBUG = PERF_DEBUG or nil +START = nil + +if PERF_DEBUG then + PERF = function(...) + local new_time = (vim.loop.hrtime() - START) / 1E9 + if select('#', ...) == 0 then + vim.schedule(function() + vim.api.nvim_buf_set_lines(PERF_DEBUG, -1, -1, false, { '' }) + end) + return + end + + local to_insert = '' + if START then + to_insert = tostring(new_time) .. ' | ' + end + + for _, v in ipairs({...}) do + if type(v) == 'table' then + to_insert = to_insert .. tostring(#v) .. ' | ' + else + to_insert = to_insert .. tostring(v) .. ' | ' + end + end + + vim.schedule(function() + vim.api.nvim_buf_set_lines(PERF_DEBUG, -1, -1, false, { to_insert }) + end) + end +end + -- cgit v1.2.3