Trilium Frontend API
    Preparing search index...

    Interface Completion

    Objects type used to represent individual completions.

    interface Completion {
        apply?:
            | string
            | (
                (
                    view: EditorView,
                    completion: Completion,
                    from: number,
                    to: number,
                ) => void
            );
        boost?: number;
        commitCharacters?: readonly string[];
        detail?: string;
        displayLabel?: string;
        info?:
            | string
            | ((completion: Completion) => CompletionInfo | Promise<CompletionInfo>);
        label: string;
        section?: string | CompletionSection;
        sortText?: string;
        type?: string;
    }
    Index

    Properties

    apply?:
        | string
        | (
            (
                view: EditorView,
                completion: Completion,
                from: number,
                to: number,
            ) => void
        )

    How to apply the completion. The default is to replace it with its label. When this holds a string, the completion range is replaced by that string. When it is a function, that function is called to perform the completion. If it fires a transaction, it is responsible for adding the pickedCompletion annotation to it.

    boost?: number

    When given, should be a number from -99 to 99 that adjusts how this completion is ranked compared to other completions that match the input as well as this one. A negative number moves it down the list, a positive number moves it up.

    commitCharacters?: readonly string[]

    When this option is selected, and one of these characters is typed, insert the completion before typing the character.

    detail?: string

    An optional short piece of information to show (with a different style) after the label.

    displayLabel?: string

    An optional override for the completion's visible label. When using this, matched characters will only be highlighted if you provide a getMatch function.

    info?:
        | string
        | ((completion: Completion) => CompletionInfo | Promise<CompletionInfo>)

    Additional info to show when the completion is selected. Can be a plain string or a function that'll render the DOM structure to show when invoked.

    label: string

    The label to show in the completion picker. This is what input is matched against to determine whether a completion matches (and how well it matches).

    section?: string | CompletionSection

    Can be used to divide the completion list into sections. Completions in a given section (matched by name) will be grouped together, with a heading above them. Options without section will appear above all sections. A string value is equivalent to a {name} object.

    sortText?: string

    Overrides the text that is used to sort completions. Will default to label if not given.

    type?: string

    The type of the completion. This is used to pick an icon to show for the completion. Icons are styled with a CSS class created by appending the type name to "cm-completionIcon-". You can define or restyle icons by defining these selectors. The base library defines simple icons for class, constant, enum, function, interface, keyword, method, namespace, property, text, type, and variable.

    Multiple types can be provided by separating them with spaces.