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());
}
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;
}
Aggregations