Search in sources :

Example 1 with FindUsagesProvider

use of com.intellij.lang.findUsages.FindUsagesProvider in project intellij-community by JetBrains.

the class VariableArrayTypeFix method formatType.

private static String formatType(@NotNull PsiVariable variable) {
    FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(variable.getLanguage());
    final String type = provider.getType(variable);
    if (StringUtil.isNotEmpty(type)) {
        return type;
    }
    return TypePresentationService.getService().getTypePresentableName(variable.getClass());
}
Also used : FindUsagesProvider(com.intellij.lang.findUsages.FindUsagesProvider)

Example 2 with FindUsagesProvider

use of com.intellij.lang.findUsages.FindUsagesProvider in project intellij-community by JetBrains.

the class IdTableBuilding method getFileTypeIndexer.

@Nullable
public static FileTypeIdIndexer getFileTypeIndexer(FileType fileType) {
    final FileTypeIdIndexer idIndexer = ourIdIndexers.get(fileType);
    if (idIndexer != null) {
        return idIndexer;
    }
    final FileTypeIdIndexer extIndexer = IdIndexers.INSTANCE.forFileType(fileType);
    if (extIndexer != null) {
        return extIndexer;
    }
    final WordsScanner customWordsScanner = CacheBuilderRegistry.getInstance().getCacheBuilder(fileType);
    if (customWordsScanner != null) {
        return new WordsScannerFileTypeIdIndexerAdapter(customWordsScanner);
    }
    if (fileType instanceof LanguageFileType) {
        final Language lang = ((LanguageFileType) fileType).getLanguage();
        final FindUsagesProvider findUsagesProvider = LanguageFindUsages.INSTANCE.forLanguage(lang);
        WordsScanner scanner = findUsagesProvider == null ? null : findUsagesProvider.getWordsScanner();
        if (scanner == null) {
            scanner = new SimpleWordsScanner();
        }
        return new WordsScannerFileTypeIdIndexerAdapter(scanner);
    }
    if (fileType instanceof CustomSyntaxTableFileType) {
        return new WordsScannerFileTypeIdIndexerAdapter(createCustomFileTypeScanner(((CustomSyntaxTableFileType) fileType).getSyntaxTable()));
    }
    return null;
}
Also used : FindUsagesProvider(com.intellij.lang.findUsages.FindUsagesProvider) LanguageFileType(com.intellij.openapi.fileTypes.LanguageFileType) Language(com.intellij.lang.Language) CustomSyntaxTableFileType(com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FindUsagesProvider (com.intellij.lang.findUsages.FindUsagesProvider)2 Language (com.intellij.lang.Language)1 LanguageFileType (com.intellij.openapi.fileTypes.LanguageFileType)1 CustomSyntaxTableFileType (com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType)1 Nullable (org.jetbrains.annotations.Nullable)1