Skip to content

Commit

Permalink
reduce "search everywhere" route target to be unique
Browse files Browse the repository at this point in the history
  • Loading branch information
Haehnchen committed May 20, 2024
1 parent b8cbd6c commit 19efeb1
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.HashSet;
import java.util.Set;

/**
* @author Daniel Espendiller <[email protected]>
*/
Expand Down Expand Up @@ -46,6 +49,8 @@ public void processElementsWithName(@NotNull String name, @NotNull Processor<? s
return;
}

Set<PsiElement> targets = new HashSet<>();

for (Pair<Route, PsiElement> entry : RouteHelper.getMethodsForPathWithPlaceholderMatchRoutes(project, name)) {
Route route = entry.getFirst();

Expand All @@ -54,8 +59,14 @@ public void processElementsWithName(@NotNull String name, @NotNull Processor<? s
continue;
}

PsiElement second = entry.getSecond();
if (targets.contains(second)) {
continue;
}

targets.add(second);
processor.process((NavigationItemPresentableOverwrite.create(
entry.getSecond(),
second,
route.getPathPresentable(),
Symfony2Icons.ROUTE,
"Symfony Route",
Expand Down

0 comments on commit 19efeb1

Please sign in to comment.