Skip to content

Commit

Permalink
Fix some relevance for member dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelistria committed Jan 21, 2025
1 parent d957e11 commit 1c41af7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,7 @@ private CompletionProposal toProposal(IBinding binding, String completion) {
res.completionEngine = this.nestedEngine;
res.nameLookup = this.nameEnvironment.nameLookup;

boolean isInQualifiedName = this.toComplete.getLocationInParent() == QualifiedName.NAME_PROPERTY || this.toComplete.getLocationInParent() == FieldAccess.NAME_PROPERTY;
res.setRelevance(CompletionEngine.computeBaseRelevance() +
CompletionEngine.computeRelevanceForResolution() +
this.nestedEngine.computeRelevanceForInterestingProposal() +
Expand All @@ -2272,7 +2273,7 @@ private CompletionProposal toProposal(IBinding binding, String completion) {
binding instanceof IMethodBinding methodBinding ? methodBinding.getReturnType() :
binding instanceof IVariableBinding variableBinding ? variableBinding.getType() :
this.toComplete.getAST().resolveWellKnownType(Object.class.getName())) +
(res.getRequiredProposals() != null || inJavadoc ? 0 : computeRelevanceForQualification(false)) +
(isInQualifiedName || res.getRequiredProposals() != null || inJavadoc ? 0 : computeRelevanceForQualification(false)) +
CompletionEngine.computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE) + //no access restriction for class field
((insideQualifiedReference() && !staticOnly() && !Modifier.isStatic(binding.getModifiers())) || (inJavadoc && !res.isConstructor) ? RelevanceConstants.R_NON_STATIC : 0) +
(!staticOnly() || inheritedValue ? 0 : RelevanceConstants.R_NON_INHERITED) + // TODO: when is this active?
Expand Down

0 comments on commit 1c41af7

Please sign in to comment.