Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CodeMirrorSearchProvider

Hierarchy

  • CodeMirrorSearchProvider

Implements

Index

Constructors

constructor

Properties

Private _changed

_changed: any

Private _cm

_cm: any

Private _currentMatch

_currentMatch: any

Private _currentMatchIsSelected

_currentMatchIsSelected: any

Private _findNext

_findNext: any

Private _getSearchOverlay

_getSearchOverlay: any

Private _matchState

_matchState: any

Private _onDocChanged

_onDocChanged: any

Private _overlay

_overlay: any

Private _parseMatchesFromState

_parseMatchesFromState: any

Private _query

_query: any

Private _refreshOverlay

_refreshOverlay: any

Private _setInitialMatches

_setInitialMatches: any

Do a full search on the entire document.

This manually constructs the initial match state across the whole document. This must be done manually because the codemirror overlay is lazy-loaded, so it will only tokenize lines that are in or near the viewport. This is sufficient for efficiently maintaining the state when changes are made to the document, as changes occur in or near the viewport, but to scan the whole document, a manual search across the entire content is required.

param

The search term

Private _startQuery

_startQuery: any

Private _toEditorPos

_toEditorPos: any

Readonly isReadOnly

isReadOnly: false = false

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.

isSubProvider

isSubProvider: boolean

Set whether or not the CodemirrorSearchProvider will wrap to the beginning or end of the document on invocations of highlightNext or highlightPrevious, respectively

Accessors

changed

  • get changed(): ISignal<this, void>
  • Signal indicating that something in the search has changed, so the UI should update

    Returns ISignal<this, void>

currentMatch

  • Returns ISearchMatch

currentMatchIndex

  • get currentMatchIndex(): number
  • The current index of the selected match.

    Returns number

editor

  • Returns CodeMirrorEditor

matches

  • The same list of matches provided by the startQuery promise resolution

    Returns ISearchMatch[]

Methods

clearSelection

  • clearSelection(): void
  • Returns void

endQuery

  • endQuery(removeOverlay?: boolean): Promise<void>
  • Clears state of a search provider to prepare for startQuery to be called in order to start a new query or refresh an existing one.

    Parameters

    • Optional removeOverlay: boolean

    Returns Promise<void>

    A promise that resolves when the search provider is ready to begin a new search.

endSearch

  • endSearch(): Promise<void>
  • Resets UI state, removes all matches.

    Returns Promise<void>

    A promise that resolves when all state has been cleaned up.

getInitialQuery

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

    Parameters

    Returns any

    Initial value used to populate the search box.

highlightNext

  • Move the current match indicator to the next match.

    Returns Promise<ISearchMatch>

    A promise that resolves once the action has completed.

highlightPrevious

  • Move the current match indicator to the previous match.

    Returns Promise<ISearchMatch>

    A promise that resolves once the action has completed.

refreshOverlay

  • refreshOverlay(): void
  • Returns void

replaceAllMatches

  • replaceAllMatches(newText: string): Promise<boolean>
  • Replace all matches in the notebook with the provided text

    Parameters

    • newText: string

    Returns Promise<boolean>

    A promise that resolves with a boolean indicating whether a replace occurred.

replaceCurrentMatch

  • replaceCurrentMatch(newText: string): Promise<boolean>
  • Replace the currently selected match with the provided text

    Parameters

    • newText: string

    Returns Promise<boolean>

    A promise that resolves with a boolean indicating whether a replace occurred.

startQuery

  • startQuery(query: RegExp, searchTarget: Widget, filters?: {}): Promise<ISearchMatch[]>
  • Initialize the search using the provided options. Should update the UI to highlight all matches and "select" whatever the first match should be.

    Parameters

    • query: RegExp

      A RegExp to be use to perform the search

    • searchTarget: Widget

      The widget to be searched

    • Optional filters: {}

    Returns Promise<ISearchMatch[]>

    A promise that resolves with a list of all matches

startQueryCodeMirror

  • Initialize the search using a CodeMirrorEditor object.

    Parameters

    Returns Promise<ISearchMatch[]>

Static canSearchOn

  • Report whether or not this provider has the ability to search on the given object

    Parameters

    • domain: Widget

    Returns domain is CMMainAreaWidget

Generated using TypeDoc