diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java index fefbdcb3e3bb..81707851c993 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java @@ -183,7 +183,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware { @NotNull @Override protected Set filter(@NotNull Set elements) { - return super.filter(model.sortItems(elements)); + return super.filter(model.filterAndSortItems(elements)); } @Override diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java index 32859bd6a92e..85abddde01fa 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java @@ -35,6 +35,7 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.MinusculeMatcher; @@ -406,14 +407,29 @@ public class GotoActionModel implements ChooseByNameModel, Comparator, D } @NotNull - public SortedSet sortItems(@NotNull Set elements) { + public SortedSet filterAndSortItems(@NotNull Set elements) { List toUpdate = getActionsToUpdate(elements); if (!toUpdate.isEmpty()) { updateActions(toUpdate); } TreeSet objects = ContainerUtilRt.newTreeSet(this); - objects.addAll(elements); + if (Registry.is("goto.action.skip.disabled")) { + for (Object o : elements) { + if (o instanceof MatchedValue) { + Comparable v = ((MatchedValue)o).value; + if (!(v instanceof ActionWrapper) || ((ActionWrapper)v).isAvailable()) { + objects.add(o); + } + } + else { + objects.add(o); + } + } + } + else { + objects.addAll(elements); + } return objects; } diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 21487dc79741..ac9001595343 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -1169,5 +1169,8 @@ ESLint.Language.Service.full.log.description=ESLint: include source code fragmen goto.action.skip.tophits.and.options=false goto.action.skip.tophits.and.options.description=Skip top hits and options in go to action +goto.action.skip.disabled=true +goto.action.skip.disabled.description=Show only enabled actions in Go to Action + dsm.show.cycle.count.in.tooltip=false dsm.show.cycle.count.in.tooltip.description=Shows number of cycles found in the tooltip of the Toggle Cycles toolbar button after some calculation time