Skip to main content

render

Function render 

Source
pub fn render(language: &LanguageSupport, hunks: &[Hunk]) -> Option<Payload>
Expand description

Render every hunk belonging to one file into a single payload.

The file path is taken from the hunks themselves rather than passed alongside them — they all carry it, and a separate argument would be a second copy for the caller to keep in sync with no way to check it. hunks must therefore all share a file_path; they are rendered in ascending new_start order. Returns None when hunks is empty.

The language arrives as a LanguageSupport, not a string: languages/ is the only place a language is named, and display_name is the name meant for the model. A bare &str here would let a caller pass the registry key ("rust") where the prompt wants "Rust", with nothing to catch it.