use of org.springframework.ide.vscode.boot.metadata.hints.HintProvider in project sts4 by spring-projects.
the class CommonLanguageTools method getValueHints.
public static Collection<StsValueHint> getValueHints(FuzzyMap<PropertyInfo> index, TypeUtil typeUtil, String query, String propertyName, EnumCaseMode caseMode) {
Type type = getValueType(index, typeUtil, propertyName);
if (TypeUtil.isSequencable(type)) {
// It is useful to provide content assist for the values in the list when entering a list
type = TypeUtil.getDomainType(type);
}
List<StsValueHint> allHints = new ArrayList<>();
{
Collection<StsValueHint> hints = typeUtil.getHintValues(type, query, caseMode);
if (CollectionUtil.hasElements(hints)) {
allHints.addAll(hints);
}
}
{
PropertyInfo prop = index.findLongestCommonPrefixEntry(propertyName);
if (prop != null) {
HintProvider hintProvider = prop.getHints(typeUtil, false);
if (!HintProviders.isNull(hintProvider)) {
allHints.addAll(hintProvider.getValueHints(query));
}
}
}
return allHints;
}
use of org.springframework.ide.vscode.boot.metadata.hints.HintProvider in project sts4 by spring-projects.
the class PropertiesCompletionProposalsCalculator method getKeyHintProposals.
private Collection<ICompletionProposal> getKeyHintProposals(PropertyInfo prop, int navOffset) {
HintProvider hintProvider = prop.getHints(typeUtil, false);
if (!HintProviders.isNull(hintProvider)) {
String query = textBetween(doc, navOffset + 1, offset);
List<TypedProperty> hintProperties = hintProvider.getPropertyHints(query);
if (CollectionUtil.hasElements(hintProperties)) {
return createPropertyProposals(TypeParser.parse(prop.getType()), navOffset, query, hintProperties);
}
}
return ImmutableList.of();
}
Aggregations