Skip to content

Commit

Permalink
Do not suggest .class .super .this suffix for types
Browse files Browse the repository at this point in the history
Those are only valid inside expresssions.
  • Loading branch information
mickaelistria committed Dec 19, 2024
1 parent b415e6b commit ab25bed
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}
Expand Down

0 comments on commit ab25bed

Please sign in to comment.