Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async genSuggestions(doc: DocInfo, word: string): Promise {
const { settings, dictionary } = await this.getSettings(doc);
const { numSuggestions = defaultNumSuggestions } = settings;
if (word.length > maxWordLengthForSuggestions) {
return [];
}
const numSugs = word.length > wordLengthForLimitingSuggestions ? maxNumberOfSuggestionsForLongWords : numSuggestions;
const options: SuggestOptions = {
numChanges: maxEdits,
numSuggestions: numSugs,
// Turn off compound suggestions for now until it works a bit better.
compoundMethod: CompoundWordsMethod.NONE,
ignoreCase: !settings.caseSensitive,
};
return dictionary.suggest(word, options).map(s => ({...s, word: s.word.replace(regexJoinedWords, '')}));
}