Skip to content

findWords

findWords(context, editor, filter, pattern, init?, tokensOnly?): Set<string>

Defined in: extensions/autocomplete/utils.ts:63

Utility that searches the editor’s TokenStream for strings. This utility will only search parts of the document whose language has the same completion definition registered.

CompletionContext

Current completion context.

PrismEditor

Editor to search in.

(type, start) => boolean

Function used to filter tokens you want to search in. Is called with the type of the token and its starting position. If the filter returns true, the token will be searched.

RegExp

Pattern used to search for words. Must have the g flag.

Iterable<string, any, any>

Words that should be completed even if they’re not found in the document.

boolean

If true only the text of tokens whose content is a string will be searched. If false, any string inside the TokenStream can be searched.

Set<string>

A set with found identifers/words.