From ba67bab414d351b5eeb5ff8c99d4b8940a6d9208 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 20 Dec 2018 21:23:04 +0100 Subject: [PATCH] mad testing: don't expect web references to be completed --- .../intellij/java/propertyBased/JavaCompletionPolicy.java | 2 +- .../testFramework/propertyBased/CompletionPolicy.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java b/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java index e961bcbae8e6..60ee493f0c50 100644 --- a/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java +++ b/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java @@ -85,7 +85,7 @@ class JavaCompletionPolicy extends CompletionPolicy { return false; // IDEA-178629 } } - return true; + return super.shouldSuggestReferenceText(ref, target); } private static boolean isAdoptedOrphanPsiAfterClassEnd(PsiElement element) { diff --git a/platform/testFramework/src/com/intellij/testFramework/propertyBased/CompletionPolicy.java b/platform/testFramework/src/com/intellij/testFramework/propertyBased/CompletionPolicy.java index 6c532c7fc39d..921b46cf82c7 100644 --- a/platform/testFramework/src/com/intellij/testFramework/propertyBased/CompletionPolicy.java +++ b/platform/testFramework/src/com/intellij/testFramework/propertyBased/CompletionPolicy.java @@ -17,6 +17,7 @@ package com.intellij.testFramework.propertyBased; import com.intellij.codeInsight.TargetElementUtil; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.paths.WebReference; import com.intellij.psi.*; import com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference; import com.intellij.psi.util.PsiTreeUtil; @@ -67,7 +68,7 @@ public class CompletionPolicy { if (ref instanceof PsiMultiReference) { for (PsiReference ref1 : ((PsiMultiReference)ref).getReferences()) { - if (target == ref1.resolve() && !shouldSuggestReferenceText(ref1, target)) return null; + if (target.getClass().isInstance(ref1.resolve()) && !shouldSuggestReferenceText(ref1, target)) return null; } } } @@ -113,6 +114,6 @@ public class CompletionPolicy { } protected boolean shouldSuggestReferenceText(@NotNull PsiReference ref, @NotNull PsiElement target) { - return true; + return !(ref instanceof WebReference); } }