A renderer for completer widget nodes.

interface IRenderer<T> {
    createCompletionItemNode(item, orderedTypes): HTMLLIElement;
    createDocumentationNode?(activeItem): HTMLElement;
    createLoadingDocsIndicator?(): HTMLElement;
    itemWidthHeuristic?(a): number;
}

Type Parameters

Implemented by

Methods

  • Create an item node (an li element) from a ICompletionItem for a text completer menu.

    Notes

    The item provided to renderer is already pre-processed by the model:

    • the label is escaped to ensure that no user-generated HTML is included; if insertText was not originally provided, it is set to raw label (prior to escaping) if needed,
    • if there were any matches against the query the label has them highlighted with <mark>s.

    Parameters

    • item: T
    • orderedTypes: string[]

    Returns HTMLLIElement

  • Get a heuristic for the width of an item.

    As a performance optimization completer will infer the hover box width from the widest item node which will be rendered before all other nodes. By default the widest item is selected based on label length heuristic; renderers which customize item rendering can use this method to provide a custom heuristic.

    Parameters

    Returns number