SearchAPI
Defined in: extensions/search/search.ts:25
Object with methods useful for performing a search and highlighting the matches.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”container
Section titled “container”
readonlycontainer:HTMLDivElement
Defined in: extensions/search/search.ts:50
Container that all the search results are appended to.
matches
Section titled “matches”
readonlymatches: [number,number][]
Defined in: extensions/search/search.ts:54
Array of positions of all the matches.
readonlyregex:RegExp
Defined in: extensions/search/search.ts:52
Current regex used for searching.
Methods
Section titled “Methods”search()
Section titled “search()”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.
Parameters
Section titled “Parameters”string
String to search for.
caseSensitive?
Section titled “caseSensitive?”boolean
Whether or not the search is case sensetive.
wholeWord?
Section titled “wholeWord?”boolean
Whether or not matches must be surrounded by word boundaries.
useRegExp?
Section titled “useRegExp?”boolean
If true, special characters won’t be escaped when creating the RegExp.
selection?
Section titled “selection?”[number, number]
Boundaries to search between. If excluded, all the code is searched.
filter?
Section titled “filter?”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.
wholeWordBoundry?
Section titled “wholeWordBoundry?”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.
Returns
Section titled “Returns”string | void
An error message if the RegExp was invalid.
stopSearch()
Section titled “stopSearch()”stopSearch():
void
Defined in: extensions/search/search.ts:56
Removes the search container and all matches.
Returns
Section titled “Returns”void