Exemplo n.º 1
0
 function genMultiWordSugs(words: string[]): string[] {
     const snakeCase = words.join('_').toLowerCase();
     const camelCase = Text.snakeToCamel(snakeCase);
     return [
         snakeCase,
         Text.ucFirst(camelCase),
         Text.lcFirst(camelCase)
     ];
 }
Exemplo n.º 2
0
 .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) ]
                 ));
             });
         }
     }
 });
Exemplo n.º 3
0
 function textToWords(text: string): string[] {
     const setOfWords = new Set(
         Text.extractWordsFromCode(text)
             .map(t => t.text)
             .map(t => t.toLowerCase())
         );
     return [...setOfWords];
 }
Exemplo n.º 4
0
 .map(sug => Text.matchCase(word, sug))