Search in sources :

Example 1 with TokenConsumer

use of com.intellij.spellchecker.tokenizer.TokenConsumer in project intellij-community by JetBrains.

the class SpellCheckerDictionaryGenerator method processLeafsNames.

protected void processLeafsNames(@NotNull final PsiElement leafElement, @NotNull final HashSet<String> seenNames) {
    final Language language = leafElement.getLanguage();
    SpellCheckingInspection.tokenize(leafElement, language, new TokenConsumer() {

        @Override
        public void consumeToken(PsiElement element, final String text, boolean useRename, int offset, TextRange rangeToCheck, Splitter splitter) {
            splitter.split(text, rangeToCheck, textRange -> {
                final String word = textRange.substring(text);
                addSeenWord(seenNames, word, language);
            });
        }
    });
}
Also used : TokenConsumer(com.intellij.spellchecker.tokenizer.TokenConsumer) Language(com.intellij.lang.Language) java.util(java.util) VirtualFile(com.intellij.openapi.vfs.VirtualFile) NamesValidator(com.intellij.lang.refactoring.NamesValidator) SpellCheckingInspection(com.intellij.spellchecker.inspections.SpellCheckingInspection) PsiManager(com.intellij.psi.PsiManager) PsiTreeUtil(com.intellij.psi.util.PsiTreeUtil) PsiElement(com.intellij.psi.PsiElement) Project(com.intellij.openapi.project.Project) PsiFile(com.intellij.psi.PsiFile) FileUtil(com.intellij.openapi.util.io.FileUtil) Logger(com.intellij.openapi.diagnostic.Logger) MultiMap(com.intellij.util.containers.MultiMap) ProgressManager(com.intellij.openapi.progress.ProgressManager) VfsUtilCore(com.intellij.openapi.vfs.VfsUtilCore) TokenConsumer(com.intellij.spellchecker.tokenizer.TokenConsumer) FileWriter(java.io.FileWriter) IOException(java.io.IOException) TextRange(com.intellij.openapi.util.TextRange) LanguageNamesValidation(com.intellij.lang.LanguageNamesValidation) File(java.io.File) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) VirtualFileVisitor(com.intellij.openapi.vfs.VirtualFileVisitor) Splitter(com.intellij.spellchecker.inspections.Splitter) NotNull(org.jetbrains.annotations.NotNull) SpellCheckerManager(com.intellij.spellchecker.SpellCheckerManager) Consumer(com.intellij.util.Consumer) Splitter(com.intellij.spellchecker.inspections.Splitter) Language(com.intellij.lang.Language) TextRange(com.intellij.openapi.util.TextRange) PsiElement(com.intellij.psi.PsiElement)

Aggregations

Language (com.intellij.lang.Language)1 LanguageNamesValidation (com.intellij.lang.LanguageNamesValidation)1 NamesValidator (com.intellij.lang.refactoring.NamesValidator)1 Logger (com.intellij.openapi.diagnostic.Logger)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Project (com.intellij.openapi.project.Project)1 TextRange (com.intellij.openapi.util.TextRange)1 FileUtil (com.intellij.openapi.util.io.FileUtil)1 VfsUtilCore (com.intellij.openapi.vfs.VfsUtilCore)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 VirtualFileVisitor (com.intellij.openapi.vfs.VirtualFileVisitor)1 PsiElement (com.intellij.psi.PsiElement)1 PsiFile (com.intellij.psi.PsiFile)1 PsiManager (com.intellij.psi.PsiManager)1 PsiTreeUtil (com.intellij.psi.util.PsiTreeUtil)1 SpellCheckerManager (com.intellij.spellchecker.SpellCheckerManager)1 SpellCheckingInspection (com.intellij.spellchecker.inspections.SpellCheckingInspection)1 Splitter (com.intellij.spellchecker.inspections.Splitter)1 TokenConsumer (com.intellij.spellchecker.tokenizer.TokenConsumer)1