Class EditorSearchProvider<T>Abstract

Search provider for editors.

Type Parameters

  • T extends CodeEditor.IModel = CodeEditor.IModel

Hierarchy

Implements

Constructors

Properties

_cmHandler: any
_inSelection: any
_isActive: any
_isDisposed: any
_stateChanged: Signal<IBaseSearchProvider, void>
currentIndex: number

Current match index

filters: IFilters

Current search filters

query: RegExp

Current search query

Accessors

  • get currentMatchIndex(): number
  • Current match index

    Returns number

  • get editor(): IEditor
  • Text editor

    Returns IEditor

  • get isActive(): boolean
  • Whether the cell search is active.

    This is used when applying search only on selected cells.

    Returns boolean

  • get isDisposed(): boolean
  • Whether the search provider is disposed or not.

    Returns boolean

  • get matchesCount(): number
  • Number of matches in the cell.

    Returns number

  • get model(): T
  • Editor content model

    Returns T

Methods

  • Dispose the search provider

    Returns void

  • Get the current match if it exists.

    Returns ISearchMatch

    The current match

  • Callback on source change

    Parameters

    Returns Promise<void>

  • Replace all matches in the cell source with the provided text

    Parameters

    Returns Promise<boolean>

    Whether a replace occurred.

  • Replace the currently selected match with the provided text.

    If no match is selected, it won't do anything.

    The caller of this method is expected to call highlightNext if after calling replaceCurrentMatch() attribute this.currentIndex is null. It is necessary to let the caller handle highlighting because this method is used in composition pattern (search engine of notebook cells) and highlighting on the composer (notebook) level needs to switch to next engine (cell) with matches.

    Parameters

    • newText: string

      The replacement text.

    • Optional loop: boolean
    • Optional options: IReplaceOptions

    Returns Promise<boolean>

    Whether a replace occurred.

  • Set isActive status.

    Notes

    It will start or end the search

    Parameters

    • v: boolean

      New value

    Returns Promise<void>

  • Set whether user selection should be protected from modifications.

    If disabled, the selection will be updated on search and on editor focus to cover the current match. We need to protect selection from modifications for both: search in text and search in cells; since setSearchSelection is only telling us about search in text, we need to have an additional way to signal that either search in text or in cells is active, or for any other reason selection range should be protected.

    Parameters

    • v: boolean

    Returns void

  • Set whether search should be limitted to specified text selection.

    Parameters

    • selection: IRange

    Returns Promise<void>

  • Initialize the search using the provided options. Should update the UI to highlight all matches and "select" the first match.

    Parameters

    • query: RegExp

      A RegExp to be use to perform the search

    • Optional filters: IFilters

      Filter parameters to pass to provider

    Returns Promise<void>

  • Update matches

    Parameters

    • content: string

    Returns Promise<void>

Generated using TypeDoc