static void complete(Project project, PsiModuleName name, @NotNull CompletionResultSet resultSet) { // Get the correct module Collection<PsiModule> modules = StubIndex.getElements(IndexKeys.MODULES, name.getName(), project, GlobalSearchScope.allScope(project), PsiModule.class); if (!modules.isEmpty()) { for (PsiModule module : modules) { Collection<PsiNamedElement> expressions = module.getExpressions(); for (PsiNamedElement expression : expressions) { resultSet.addElement( LookupElementBuilder.create(expression). withIcon(PsiIconUtil.getProvidersIcon(expression, 0)). withTypeText(PsiInferredTypeUtil.getTypeInfo(expression)) ); } } } }
@Override @Nullable public Icon getIcon(@NotNull final VirtualFile file, final int flags, final Project project) { if (project == null) return null; final PsiFileSystemItem psiFile = file.isDirectory() ? PsiManager.getInstance(project).findDirectory(file) : PsiManager.getInstance(project).findFile(file); return psiFile == null ? null : PsiIconUtil.getProvidersIcon(psiFile, flags); }
@Override @Nullable public Icon getIcon(@NotNull final VirtualFile file, final int flags, final Project project) { if(project == null) return null; final PsiFile psiFile = PsiManager.getInstance(project).findFile(file); return psiFile == null ? null : PsiIconUtil.getProvidersIcon(psiFile, flags); }