fix: stream stderr for long-running providers, clear errors on success (#40)

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:58 -05:00 committed by GitHub
parent 239f8a4769
commit c8e3a88434
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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,
}