From 2e0a90a168100b72082cab8ee2e4d65941716124 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 30 Jul 2021 15:27:35 +0200 Subject: [PATCH] SSR: remove unnecessary profile method GitOrigin-RevId: 64cf62260e366c9e6b58d3c7067a4aec3f1b92d1 --- .../structuralsearch/JavaStructuralSearchProfile.java | 9 --------- .../source/com/intellij/structuralsearch/Matcher.java | 6 ++---- .../structuralsearch/StructuralSearchProfile.java | 7 +------ 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java index b3b5ba91bd8c..c61f27201cd7 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java @@ -195,15 +195,6 @@ public final class JavaStructuralSearchProfile extends StructuralSearchProfile { return targetNode; } - @Override - public @NotNull PsiElement extendMatchOnePsiFile(@NotNull PsiElement file) { - if (file instanceof PsiIdentifier) { - // Searching in previous results - file = file.getParent(); - } - return file; - } - @NotNull @Override public PsiElement getPresentableElement(@NotNull PsiElement element) { diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java b/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java index f93215b005f8..ce2134350a8a 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.structuralsearch; import com.intellij.dupLocator.iterators.NodeIterator; @@ -547,9 +547,7 @@ public class Matcher { ReadAction.nonBlocking( () -> { if (!file.isValid()) return; - final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(file); - if (profile == null) return; - match(profile.extendMatchOnePsiFile(file)); + match(file); } ).inSmartMode(project).executeSynchronously(); } diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java index 983bbbd06b2f..a59adb720fd1 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.structuralsearch; import com.intellij.codeInsight.template.TemplateContextType; @@ -286,11 +286,6 @@ public abstract class StructuralSearchProfile { return node; } - @NotNull - public PsiElement extendMatchOnePsiFile(@NotNull PsiElement file) { - return file; - } - public LanguageFileType getDefaultFileType(@Nullable LanguageFileType fileType) { return fileType; }