fix: stream stderr for long-running providers, clear errors on success

Problem: Long-running providers (e.g. `typst watch`) never exit on
compile error, so the exit callback never fired and diagnostics/quickfix
were never populated. The `typst watch` `reload` command also lacked
`--diagnostic-format short`, producing unparseable verbose output.

Solution: Add a `stderr` streaming callback to the long-running
`vim.system` call that accumulates chunks and re-parses on each new
chunk, populating diagnostics or quickfix in real time. When the
fs_event fires (successful compile), clear `stderr_acc` and the
reported errors. Add `--diagnostic-format short` to the typst `reload`
command to match the one-shot `args` format.
This commit is contained in:
Barrett Ruth 2026-03-04 16:33:02 -05:00
parent 239f8a4769
commit 2edeef478d
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 44 additions and 1 deletions

View file

@ -133,7 +133,7 @@ M.typst = {
end,
open = true,
reload = function(ctx)
return { 'typst', 'watch', ctx.file }
return { 'typst', 'watch', '--diagnostic-format', 'short', ctx.file }
end,
}