* refactor(compiler): replace 7 state tables with unified `BufState` Problem: `compiler.lua` tracked per-buffer state across 7 separate module-level tables, causing scattered cleanup, triplicated error-handling blocks, accumulating `BufUnload` autocmds on every compile, and a race condition where `active[bufnr]` (cleared asynchronously on process exit) was used as the toggle on/off gate. Solution: Consolidate all per-buffer state into a single `state` table holding a `preview.BufState` record per buffer. Extract `handle_errors` and `clear_errors` helpers. Move `BufUnload` lifecycle entirely into `M.toggle` with `unload_autocmd` tracking to prevent accumulation. Toggle now gates on `s.watching` (synchronous boolean) and reopens a closed viewer when watching is active rather than stopping. * fix(compiler): split nil guard in `M.stop` for type narrowing * ci: typing |
||
|---|---|---|
| .. | ||
| commands_spec.lua | ||
| compiler_spec.lua | ||
| diagnostic_spec.lua | ||
| helpers.lua | ||
| init_spec.lua | ||
| minimal_init.lua | ||
| presets_spec.lua | ||
| reload_spec.lua | ||