fix(compiler): do not auto-open on one-shot compile

Problem: auto-open fired on :Preview compile, which is a one-shot
build. Users compiling to check for errors or rebuild with the viewer
already open got an unexpected browser/viewer window.

Solution: gate auto-open on not opts.oneshot so it only fires during
toggle/watch mode, where opening the viewer on first compile is the
intended behaviour.
This commit is contained in:
Barrett Ruth 2026-03-04 14:51:14 -05:00
parent a2ef9a828f
commit 454030ad78

View file

@ -162,6 +162,7 @@ function M.compile(bufnr, name, provider, ctx, opts)
if
provider.open
and not opts.oneshot
and not opened[bufnr]
and output_file ~= ''
and vim.uv.fs_stat(output_file)
@ -240,6 +241,7 @@ function M.compile(bufnr, name, provider, ctx, opts)
end
if
provider.open
and not opts.oneshot
and not opened[bufnr]
and output_file ~= ''
and vim.uv.fs_stat(output_file)