typst_ide

Function autocomplete

source
pub fn autocomplete(
    world: &dyn World,
    document: Option<&Document>,
    source: &Source,
    cursor: usize,
    explicit: bool,
) -> Option<(usize, Vec<Completion>)>
Expand description

Autocomplete a cursor position in a source file.

Returns the position from which the completions apply and a list of completions.

When explicit is true, the user requested the completion by pressing control and space or something similar.

Passing a document (from a previous compilation) is optional, but enhances the autocompletions. Label completions, for instance, are only generated when the document is available.