Skip to content

Commit

Permalink
Merge pull request #2375 from Haehnchen/feature/search-everywhere-fil…
Browse files Browse the repository at this point in the history
…ter-route

reduce "search everywhere" route target to be unique
  • Loading branch information
Haehnchen authored May 20, 2024
2 parents b8cbd6c + 19efeb1 commit a57e124
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 a57e124

Please sign in to comment.