feat(api): let custom providers define failure summaries #82

Closed
opened 2026-04-25 21:38:54 +00:00 by barrettruth · 1 comment
barrettruth commented 2026-04-25 21:38:54 +00:00

Follow-up to #70.

Problem

preview.nvim aims to be extensible, but custom providers currently have no first-class way to participate in failure-summary UX. They can control compilation, output paths, diagnostics, quickfix behavior, cleaning, and reload/open behavior, but not the short message users see on failure.

Today the only escape hatch is global user glue via PreviewCompileFailed + preview.result(). That works, but it makes custom providers second-class if built-in presets gain provider-specific summaries.

Direction

Add an optional provider-level hook for short failure summaries.

Conceptually, something in the shape of failure_summary(result, ctx) would be enough.

Important constraints:

  • Keep this separate from error_parser; diagnostics and summaries are different concerns.
  • Pass the full result object instead of low-level stream toggles like stdout = true / stderr = true.
  • Returning nil should fall back to the generic compilation failed behavior.
  • Preserve :Preview output and preview.result() as the raw inspection path.

This keeps the core minimal while making custom providers first-class for failure UX.

Follow-up to #70. ## Problem `preview.nvim` aims to be extensible, but custom providers currently have no first-class way to participate in failure-summary UX. They can control compilation, output paths, diagnostics, quickfix behavior, cleaning, and reload/open behavior, but not the short message users see on failure. Today the only escape hatch is global user glue via `PreviewCompileFailed` + `preview.result()`. That works, but it makes custom providers second-class if built-in presets gain provider-specific summaries. ## Direction Add an optional provider-level hook for short failure summaries. Conceptually, something in the shape of `failure_summary(result, ctx)` would be enough. Important constraints: - Keep this separate from `error_parser`; diagnostics and summaries are different concerns. - Pass the full result object instead of low-level stream toggles like `stdout = true` / `stderr = true`. - Returning `nil` should fall back to the generic `compilation failed` behavior. - Preserve `:Preview output` and `preview.result()` as the raw inspection path. This keeps the core minimal while making custom providers first-class for failure UX.
barrettruth commented 2026-04-26 02:08:05 +00:00

Implemented in #86.

Implemented in #86.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/preview.nvim#82
No description provided.