From 7fe3ac5aa98e7ff12bcc160c00546cf45ea8160c Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 24 Oct 2017 10:46:31 +0200 Subject: [PATCH] SSR: can't put elements not present in source in search results --- .../intellij/structuralsearch/plugin/ui/SearchCommand.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java index f4e2d1df5b33..d33bc26e125a 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java @@ -148,7 +148,12 @@ public class SearchCommand { info = new UsageInfo(parent, startOffset, end - parentStart); } else { - info = new UsageInfo(StructuralSearchUtil.getPresentableElement(result.getMatch())); + final PsiElement match = StructuralSearchUtil.getPresentableElement(result.getMatch()); + if (!match.isPhysical()) { + // e.g. lambda parameter anonymous type element + return; + } + info = new UsageInfo(match); } Usage usage = new UsageInfo2UsageAdapter(info);