Skip to content

SearchAPI

Defined in: extensions/search/search.ts:25

Object with methods useful for performing a search and highlighting the matches.

readonly container: HTMLDivElement

Defined in: extensions/search/search.ts:50

Container that all the search results are appended to.


readonly matches: [number, number][]

Defined in: extensions/search/search.ts:54

Array of positions of all the matches.


readonly regex: RegExp

Defined in: extensions/search/search.ts:52

Current regex used for searching.

search(str, caseSensitive?, wholeWord?, useRegExp?, selection?, filter?, wholeWordBoundry?): string | void

Defined in: extensions/search/search.ts:40

Unhides the search container and highlights all matches of the specified string in the editor.

string

String to search for.

boolean

Whether or not the search is case sensetive.

boolean

Whether or not matches must be surrounded by word boundries.

boolean

If true, special characters won’t be escaped when creating the RegExp.

[number, number]

Boundries to search between. If excluded, all the code is searched.

SearchFilter

A function called for each match with the start and end positions of the match. If it returns false, the match won’t be included.

RegExp

Pattern controlling the behavior of whole word search. Best left undefined unless you know what you’re doing. Does nothing if wholeWord isn’t set to true. Defaults to /[_\p{N}\p{L}]{2}/u.

string | void

An error message if the RegExp was invalid.


stopSearch(): void

Defined in: extensions/search/search.ts:56

Hides the search container and removes all the matches.

void