mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java mad testing: skip some scenarios
This commit is contained in:
+1
-1
@@ -796,7 +796,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static HighlightInfo checkIllegalModifierCombination(@NotNull PsiKeyword keyword, @NotNull PsiModifierList modifierList) {
|
||||
public static HighlightInfo checkIllegalModifierCombination(@NotNull PsiKeyword keyword, @NotNull PsiModifierList modifierList) {
|
||||
@PsiModifier.ModifierConstant String modifier = keyword.getText();
|
||||
String incompatible = getIncompatibleModifier(modifier, modifierList);
|
||||
if (incompatible != null) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.java.propertyBased;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.java.lexer.JavaLexer;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -44,7 +45,7 @@ class JavaCompletionPolicy extends CompletionPolicy {
|
||||
|
||||
// a language where there are bugs in completion which maintainers of this Java-specific test can't or don't want to fix
|
||||
private static boolean isBuggyInjection(@NotNull PsiFile file) {
|
||||
return Arrays.asList("XML", "HTML", "PointcutExpression").contains(file.getLanguage().getID());
|
||||
return Arrays.asList("XML", "HTML", "PointcutExpression", "HQL").contains(file.getLanguage().getID());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,7 +157,8 @@ class JavaCompletionPolicy extends CompletionPolicy {
|
||||
return false;
|
||||
}
|
||||
if (parent instanceof PsiModifierList) {
|
||||
if (Arrays.stream(parent.getNode().getChildren(null)).filter(e -> leaf.textMatches(e.getText())).count() > 1) {
|
||||
if (Arrays.stream(parent.getNode().getChildren(null)).filter(e -> leaf.textMatches(e.getText())).count() > 1 ||
|
||||
HighlightUtil.checkIllegalModifierCombination((PsiKeyword)leaf, (PsiModifierList)parent) != null) {
|
||||
return false;
|
||||
}
|
||||
if (parent.getParent() instanceof PsiModifierListOwner && PsiTreeUtil.getParentOfType(parent.getParent(), PsiCodeBlock.class, true, PsiClass.class) != null) {
|
||||
|
||||
+5
-4
@@ -59,7 +59,7 @@ public class CompletionPolicy {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isDeclarationName(editor, file, leaf)) return null;
|
||||
if (isDeclarationName(editor, file, leaf, ref)) return null;
|
||||
|
||||
if (ref != null) {
|
||||
PsiElement target = getValidResolveResult(ref);
|
||||
@@ -99,12 +99,13 @@ public class CompletionPolicy {
|
||||
return ref.resolve();
|
||||
}
|
||||
|
||||
private static boolean isDeclarationName(Editor editor, PsiFile file, PsiElement leaf) {
|
||||
private static boolean isDeclarationName(Editor editor, PsiFile file, PsiElement leaf, @Nullable PsiReference ref) {
|
||||
PsiElement target = TargetElementUtil.findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
|
||||
if (target != null) target = target.getNavigationElement();
|
||||
PsiFile targetFile = target != null ? target.getContainingFile() : null;
|
||||
return targetFile != null && targetFile.getViewProvider() == file.getViewProvider() &&
|
||||
target.getTextOffset() == leaf.getTextRange().getStartOffset();
|
||||
return targetFile != null && targetFile.getViewProvider() == file.getViewProvider() &&
|
||||
(target.getTextOffset() == leaf.getTextRange().getStartOffset() ||
|
||||
ref != null && target.getTextOffset() == ref.getElement().getTextRange().getStartOffset() + ref.getRangeInElement().getStartOffset());
|
||||
}
|
||||
|
||||
protected boolean shouldSuggestNonReferenceLeafText(@NotNull PsiElement leaf) {
|
||||
|
||||
Reference in New Issue
Block a user