From ab25bed7748f80191722092e822f1ec4907336ca Mon Sep 17 00:00:00 2001 From: Mickael Istria Date: Thu, 19 Dec 2024 13:23:15 +0100 Subject: [PATCH] Do not suggest .class .super .this suffix for types Those are only valid inside expresssions. --- .../codeassist/DOMCompletionEngine.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java index 078d6a50700..34e65d3b22e 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java @@ -507,14 +507,16 @@ public void run() { endPos = startPos + qualifiedName.getName().getLength(); } - if (!isFailedMatch(this.prefix.toCharArray(), Keywords.THIS)) { - this.requestor.accept(createKeywordProposal(Keywords.THIS, startPos, endPos)); - } - if (!isFailedMatch(this.prefix.toCharArray(), Keywords.SUPER)) { - this.requestor.accept(createKeywordProposal(Keywords.SUPER, startPos, endPos)); - } - if (!isFailedMatch(this.prefix.toCharArray(), Keywords.CLASS)) { - this.requestor.accept(createClassKeywordProposal(qualifierTypeBinding, startPos, endPos)); + if (!(this.toComplete instanceof Type)) { + if(!isFailedMatch(this.prefix.toCharArray(), Keywords.THIS)) { + this.requestor.accept(createKeywordProposal(Keywords.THIS, startPos, endPos)); + } + if (!isFailedMatch(this.prefix.toCharArray(), Keywords.SUPER)) { + this.requestor.accept(createKeywordProposal(Keywords.SUPER, startPos, endPos)); + } + if (!isFailedMatch(this.prefix.toCharArray(), Keywords.CLASS)) { + this.requestor.accept(createClassKeywordProposal(qualifierTypeBinding, startPos, endPos)); + } } suggestDefaultCompletions = false; @@ -584,7 +586,7 @@ public void run() { startPos = qualifiedName.getName().getStartPosition(); endPos = startPos + qualifiedName.getName().getLength(); } - if (!isFailedMatch(this.prefix.toCharArray(), Keywords.CLASS)) { + if (!(this.toComplete instanceof Type) && !isFailedMatch(this.prefix.toCharArray(), Keywords.CLASS)) { this.requestor.accept(createClassKeywordProposal(qualifierTypeBinding, startPos, endPos)); } }