fix tests sorry

(part of json schema based completion: complete array and object literals - WEB-20119)
This commit is contained in:
Irina.Chernushina
2018-03-29 15:59:58 +02:00
parent 5f46dd7513
commit 9cf3510e79
@@ -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