Expand description
Virtual text rendering infrastructure
Provides a system for rendering virtual text that doesn’t exist in the buffer. Used for inlay hints (type annotations, parameter names), git blame headers, etc.
Two types of virtual text are supported:
- Inline: Text inserted before/after a character (e.g.,
: i32type hints) - Line: Full lines inserted above/below a position (e.g., git blame headers)
Virtual text is rendered during the render phase by reading from VirtualTextManager. The buffer content remains unchanged - we just inject extra styled text during rendering.
§Architecture
This follows an Emacs-like model where:
- Plugins add virtual text in response to buffer changes (async, fire-and-forget)
- Virtual text is stored persistently with marker-based position tracking
- Render loop reads virtual text synchronously from memory (no async waiting)
This ensures frame coherence: render always sees a consistent snapshot of virtual text.
Structs§
- Virtual
Text - A piece of virtual text to render at a specific position
- Virtual
Text Id - Unique identifier for a virtual text entry
- Virtual
Text Manager - Manages virtual text entries for a buffer
- Virtual
Text Namespace - Namespace for grouping virtual texts (for efficient bulk removal). Similar to OverlayNamespace - plugins create a namespace once and use it for all their virtual texts.
Enums§
- Virtual
Text Position - Position relative to the character at the marker position