From 66eba8e34d22b4b396f614dac87eeeab7f81b468 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Mon, 19 Jan 2015 14:24:48 +0100 Subject: [PATCH] can't find Kotlin top-level function in SE --- .../intellij/ide/actions/SearchEverywhereAction.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java index 9924625c86f5..6ce52a5ab56e 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java @@ -1682,7 +1682,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA myProgressIndicator, new Processor() { @Override public boolean process(Object o) { - if (o instanceof PsiElement && !(((PsiElement)o).getParent() instanceof PsiFile)) { + if (isSymbol(o)) { final PsiElement element = (PsiElement)o; final PsiFile file = element.getContainingFile(); if (!myListModel.contains(o) && !symbols.contains(o) && @@ -1698,6 +1698,16 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA return symbols; } + protected boolean isSymbol(Object o) { + if (o instanceof PsiElement) { + final PsiElement e = (PsiElement)o; + //todo[kb] need a better way to avoid mixing java classes with symbols. Same to other languages where + //todo[kb] symbol provider returns classes. We need kind of suppressor API & EP here. + return !e.getLanguage().is(Language.findLanguageByID("JAVA")) || !(e.getParent() instanceof PsiFile); + } + return false; + } + private SearchResult getClasses(String pattern, boolean includeLibs, final int max, ChooseByNamePopup chooseByNamePopup) { final SearchResult classes = new SearchResult(); if (chooseByNamePopup == null) {