This commit is contained in:
Martin Lippert
2025-03-20 21:27:20 +01:00
parent 161276dbd6
commit eb74a5dc82
2 changed files with 6 additions and 14 deletions

View File

@@ -54,14 +54,16 @@ public abstract class AbstractScoreableProposal implements ICompletionProposalWi
return p1.getLabel().compareTo(p2.getLabel());
}
};
public abstract double getBaseScore();
public final double getScore() {
return getBaseScore() - deemphasizedBy;
}
@Override
public AbstractScoreableProposal deemphasize(double howmuch) {
Assert.isLegal(howmuch>=0.0);
deemphasizedBy+= howmuch*DEEMP_VALUE;
Assert.isLegal(howmuch >= 0.0);
deemphasizedBy += howmuch * DEEMP_VALUE;
return this;
}
public boolean isDeemphasized() {

View File

@@ -35,6 +35,7 @@ import org.springframework.ide.vscode.boot.java.Annotations;
import org.springframework.ide.vscode.boot.java.annotations.AnnotationHierarchies;
import org.springframework.ide.vscode.boot.java.handlers.CompletionProvider;
import org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings;
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
@@ -93,7 +94,7 @@ public class BeanCompletionProvider implements CompletionProvider {
}
IJavaProject project = optionalProject.get();
TypeDeclaration topLevelClass = findParentClass(node);
TypeDeclaration topLevelClass = ASTUtils.findDeclaringType(node);
if (topLevelClass == null) {
return;
}
@@ -136,17 +137,6 @@ public class BeanCompletionProvider implements CompletionProvider {
}
}
private static TypeDeclaration findParentClass(ASTNode node) {
ASTNode current = node;
while (current != null) {
if (current instanceof TypeDeclaration) {
return (TypeDeclaration) current;
}
current = current.getParent();
}
return null;
}
private static String getFullyQualifiedName(TypeDeclaration typeDecl) {
ITypeBinding binding = typeDecl.resolveBinding();
if (binding != null) {