improved XML bean class content assist for improved matching, sorting, and performance
This commit is contained in:
@@ -66,10 +66,11 @@ public class SpringXMLCompletionEngine implements ICompletionEngine {
|
||||
DOMAttr attributeAt = dom.findAttrAt(offset);
|
||||
|
||||
if (attributeAt != null) {
|
||||
XMLCompletionProviderKey key = new XMLCompletionProviderKey(namespace, node.getNodeName(), attributeAt.getNodeName());
|
||||
XMLCompletionProviderKey key = new XMLCompletionProviderKey(namespace, node.getLocalName(), attributeAt.getNodeName());
|
||||
XMLCompletionProvider completionProvider = this.completionProviders.get(key);
|
||||
if (completionProvider != null) {
|
||||
return completionProvider.getCompletions(doc, namespace, node, attributeAt, scanner, offset);
|
||||
Collection<ICompletionProposal> completions = completionProvider.getCompletions(doc, namespace, node, attributeAt, scanner, offset);
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,27 +12,29 @@ package org.springframework.ide.vscode.boot.xml;
|
||||
|
||||
import org.eclipse.lsp4j.CompletionItemKind;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.ScoreableProposal;
|
||||
import org.springframework.ide.vscode.commons.util.Renderable;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public class TypeCompletionProposal implements ICompletionProposal {
|
||||
public class TypeCompletionProposal extends ScoreableProposal {
|
||||
|
||||
private final String label;
|
||||
private final CompletionItemKind kind;
|
||||
private final DocumentEdits edits;
|
||||
private final String detail;
|
||||
private final Renderable documentation;
|
||||
private final double score;
|
||||
|
||||
public TypeCompletionProposal(String label, CompletionItemKind kind, DocumentEdits edits, String detail, Renderable documentation) {
|
||||
public TypeCompletionProposal(String label, CompletionItemKind kind, DocumentEdits edits, String detail, Renderable documentation, double score) {
|
||||
super();
|
||||
this.label = label;
|
||||
this.kind = kind;
|
||||
this.edits = edits;
|
||||
this.detail = detail;
|
||||
this.documentation = documentation;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,4 +62,9 @@ public class TypeCompletionProposal implements ICompletionProposal {
|
||||
return this.documentation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseScore() {
|
||||
return this.score;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ public class TypeCompletionProposalProvider implements XMLCompletionProvider {
|
||||
prefix = prefix.substring(1);
|
||||
}
|
||||
|
||||
Flux<Tuple2<IType, Double>> types = project.getIndex().fuzzySearchTypes(prefix, true, true);
|
||||
// Flux<Tuple2<IType, Double>> types = project.getIndex().camelcaseSearchTypes(prefix, true, true);
|
||||
// Flux<Tuple2<IType, Double>> types = project.getIndex().fuzzySearchTypes(prefix, true, true);
|
||||
Flux<Tuple2<IType, Double>> types = project.getIndex().camelcaseSearchTypes(prefix, true, true);
|
||||
|
||||
return types
|
||||
.filter(result -> result.getT1() != null && result.getT1().getElementName() != null && result.getT1().getElementName().length() > 0)
|
||||
@@ -94,7 +94,7 @@ public class TypeCompletionProposalProvider implements XMLCompletionProvider {
|
||||
|
||||
Renderable renderable = null;
|
||||
|
||||
return new TypeCompletionProposal(label, kind, edits, type.getFullyQualifiedName(), renderable);
|
||||
return new TypeCompletionProposal(label, kind, edits, type.getFullyQualifiedName(), renderable, t.getT2());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user