Polish bean completion items optics

This commit is contained in:
aboyko
2025-02-27 11:25:24 -05:00
parent 1630eb1f16
commit b8322a085a
3 changed files with 21 additions and 3 deletions

View File

@@ -16,6 +16,8 @@ import java.util.Optional;
import org.eclipse.lsp4j.Command;
import org.eclipse.lsp4j.CompletionItemKind;
import org.eclipse.lsp4j.CompletionItemLabelDetails;
import org.openrewrite.java.tree.JavaType;
import org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings;
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposalWithScore;
@@ -32,6 +34,8 @@ import org.springframework.ide.vscode.commons.util.text.IDocument;
*/
public class BeanCompletionProposal implements ICompletionProposalWithScore {
private static final String DETAIL = " - autowire bean";
private DocumentEdits edits;
private IDocument doc;
private String beanId;
@@ -54,12 +58,12 @@ public class BeanCompletionProposal implements ICompletionProposalWithScore {
@Override
public String getLabel() {
return this.beanId;
return beanId;
}
@Override
public CompletionItemKind getKind() {
return CompletionItemKind.Constructor;
return CompletionItemKind.Field;
}
@Override
@@ -71,6 +75,14 @@ public class BeanCompletionProposal implements ICompletionProposalWithScore {
public String getDetail() {
return "Autowire a bean";
}
@Override
public CompletionItemLabelDetails getLabelDetails() {
CompletionItemLabelDetails labelDetails = new CompletionItemLabelDetails();
labelDetails.setDetail(DETAIL);
labelDetails.setDescription(JavaType.ShallowClass.build(beanType).getClassName());
return labelDetails;
}
@Override
public Renderable getDocumentation() {