mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix tests sorry
(part of json schema based completion: complete array and object literals - WEB-20119)
This commit is contained in:
@@ -238,7 +238,7 @@ public class JsonSchemaCompletionContributor extends CompletionContributor {
|
||||
builder = builder.withTypeText(StringUtil.removeHtmlTags(typeText), true);
|
||||
}
|
||||
|
||||
if (variants.size() <= 1) {
|
||||
if (hasSameType(variants)) {
|
||||
final JsonSchemaType type = jsonSchemaObject.getType();
|
||||
final List<Object> values = jsonSchemaObject.getEnum();
|
||||
if (type != null || !ContainerUtil.isEmpty(values) || jsonSchemaObject.getDefault() != null) {
|
||||
@@ -251,6 +251,10 @@ public class JsonSchemaCompletionContributor extends CompletionContributor {
|
||||
myVariants.add(builder);
|
||||
}
|
||||
|
||||
private static boolean hasSameType(@NotNull Collection<JsonSchemaObject> variants) {
|
||||
return variants.stream().map(JsonSchemaObject::getType).filter(Objects::nonNull).distinct().count() <= 1;
|
||||
}
|
||||
|
||||
private static InsertHandler<LookupElement> createArrayOrObjectLiteralInsertHandler() {
|
||||
return new InsertHandler<LookupElement>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user