1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Pluggable preview-pane highlighter.
//!
//! `hjkl-picker` is intentionally agnostic about how preview content gets
//! syntax-coloured. Consumers implement [`PreviewHighlighter`] and pass it to
//! [`crate::preview_pane`]; the picker hands over the preview file's path and
//! raw bytes and renders whatever spans the consumer returns.
//!
//! Typical implementations:
//!
//! - **Tree-sitter / bonsai**: route through the consumer's grammar resolver
//! (see `apps/hjkl/src/app/syntax_glue.rs::App::preview_spans_for`).
//! - **LSP semantic tokens**: ask the language server.
//! - **Regex / hand-rolled**: produce spans directly.
//! - **None**: use [`PlainPreview`] for monochrome preview.
use Path;
use cratePreviewSpans;
/// Provides syntax-highlight spans for the preview pane.
///
/// Called once per preview refresh from [`crate::preview_pane`]. Implementations
/// should be cheap on cache-hit and may run grammar / LSP work asynchronously
/// in the background — return [`PreviewSpans::default()`] while in flight; the
/// next render pass will pick up the resolved spans.
/// No-op highlighter — returns empty spans, preview renders monochrome.
///
/// Useful for consumers that don't ship a syntax layer, for tests, and as a
/// drop-in default when the preview pane should explicitly skip highlighting.
;