Search provider interface

interface ISearchProvider {
    currentMatchIndex: null | number;
    filtersChanged?: ISignal<ISearchProvider, void>;
    isDisposed: boolean;
    isReadOnly: boolean;
    matchesCount: null | number;
    replaceOptionsSupport?: IReplaceOptionsSupport;
    stateChanged: ISignal<IBaseSearchProvider, void>;
    clearHighlight(): Promise<void>;
    dispose(): void;
    endQuery(): Promise<void>;
    getFilters?(): {
        [key: string]: IFilter;
    };
    getInitialQuery(): string;
    getSelectionState?(): SelectionState;
    highlightNext(loop?): Promise<undefined | ISearchMatch>;
    highlightPrevious(loop?): Promise<undefined | ISearchMatch>;
    replaceAllMatches(newText, options?): Promise<boolean>;
    replaceCurrentMatch(newText, loop?, options?): Promise<boolean>;
    startQuery(query, filters): Promise<void>;
    validateFilter?(name, value): Promise<boolean>;
}

Hierarchy (view full)

Implemented by

Properties

currentMatchIndex: null | number

The current index of the selected match.

filtersChanged?: ISignal<ISearchProvider, void>

Signal emitted when filter definition changed.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

isReadOnly: boolean

Set to true if the widget under search is read-only, false if it is editable. Will be used to determine whether to show the replace option.

matchesCount: null | number

The number of matches.

replaceOptionsSupport?: IReplaceOptionsSupport

Specifies which replace options are supported by provider.

stateChanged: ISignal<IBaseSearchProvider, void>

Signal indicating that something in the search has changed, so the UI should update

Methods

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Get an initial query value if applicable so that it can be entered into the search box as an initial query

    Returns string

    Initial value used to populate the search box.

  • Is there one or more objects selected?

    The selection can be made of one or more lines, notebook cells, or other objects (e.g. spreadsheet cells). The provider can decide whether it counts multiple characters (as opposed to lines) as multiple selection or not, which will influence the heuristic auto-enabling "search in selection" mode.

    Returns SelectionState