1

Auto reloader

This commit is contained in:
Alex Yatskov 2025-01-18 20:36:32 -08:00
parent 655663cb6f
commit 3d3f9bfcdf
3 changed files with 12 additions and 7 deletions

View File

@ -33,6 +33,7 @@ local function reflow()
builder:output(range.start_cursor.row, range.stop_cursor.row) builder:output(range.start_cursor.row, range.stop_cursor.row)
local new_range = Range.find_at_cursor(range.start_cursor) local new_range = Range.find_at_cursor(range.start_cursor)
assert(new_range)
new_range:hit_search(trace, 1):set_current() new_range:hit_search(trace, 1):set_current()
return true return true
@ -43,11 +44,7 @@ local function inspect()
if range then if range then
local trace = range:hit_test(Cursor.get_current()) local trace = range:hit_test(Cursor.get_current())
assert(trace) assert(trace)
print('--- range start ---')
dump(trace) dump(trace)
print('--- range stop ---')
else
print('no range found!')
end end
end end
@ -55,4 +52,5 @@ return {
inspect = inspect, inspect = inspect,
reflow = reflow, reflow = reflow,
setup = Options.setup, setup = Options.setup,
query = Options.query,
} }

View File

@ -1,5 +1,6 @@
local options_current = { local options_current = {
default = { default = {
auto_reload = false,
brace_last_indent = false, brace_last_indent = false,
brace_last_wrap = true, brace_last_wrap = true,
brace_pad = false, brace_pad = false,

View File

@ -7,13 +7,19 @@ if not vim.g.argonaut_loaded then
end end
end end
local function argonaut_reflow() local function argonaut_auto_reload()
if require('argonaut').query('auto_reload') then
argonaut_reload() argonaut_reload()
end
end
local function argonaut_reflow()
argonaut_auto_reload()
require('argonaut').reflow() require('argonaut').reflow()
end end
local function argonaut_inspect() local function argonaut_inspect()
argonaut_reload() argonaut_auto_reload()
require('argonaut').inspect() require('argonaut').inspect()
end end