function genMultiWordSugs(words: string[]): string[] { const snakeCase = words.join('_').toLowerCase(); const camelCase = Text.snakeToCamel(snakeCase); return [ snakeCase, Text.ucFirst(camelCase), Text.lcFirst(camelCase) ]; }
.forEach(sugWord => { commands.push(LangServer.Command.create(sugWord, 'cSpell.editText', uri, textDocument.version, [ replaceText(diag.range, sugWord) ] )); const words = sugWord.replace(/[ \-_.]/, '_').split('_'); if (words.length > 1) { if (Text.isUpperCase(word)) { const sug = words.join('_').toUpperCase(); commands.push(LangServer.Command.create(sug, 'cSpell.editText', uri, textDocument.version, [ replaceText(diag.range, sug) ] )); } else { genMultiWordSugs(words).forEach(sugWord => { commands.push(LangServer.Command.create(sugWord, 'cSpell.editText', uri, textDocument.version, [ replaceText(diag.range, sugWord) ] )); }); } } });
function textToWords(text: string): string[] { const setOfWords = new Set( Text.extractWordsFromCode(text) .map(t => t.text) .map(t => t.toLowerCase()) ); return [...setOfWords]; }
.map(sug => Text.matchCase(word, sug))