Flesh out schema for stemcells block
This commit is contained in:
@@ -162,23 +162,27 @@ public class YTypeAssistContext extends AbstractYamlAssistContext {
|
||||
* in theory they would be free to define the properties in any order they want.
|
||||
*/
|
||||
protected List<List<YTypedProperty>> sortIntoTiers(List<YTypedProperty> properties) {
|
||||
if (properties.isEmpty()) {
|
||||
//Nothing to sort
|
||||
return ImmutableList.of();
|
||||
} else {
|
||||
ImmutableList.Builder<YTypedProperty> primary = ImmutableList.builder();
|
||||
ImmutableList.Builder<YTypedProperty> required = ImmutableList.builder();
|
||||
ImmutableList.Builder<YTypedProperty> other = ImmutableList.builder();
|
||||
for (YTypedProperty p : properties) {
|
||||
if (p.isPrimary()) {
|
||||
primary.add(p);
|
||||
} else if (p.isRequired()) {
|
||||
required.add(p);
|
||||
} else {
|
||||
other.add(p);
|
||||
if (typeUtil.isEnabledTieredProposals()) {
|
||||
if (properties.isEmpty()) {
|
||||
//Nothing to sort
|
||||
return ImmutableList.of();
|
||||
} else {
|
||||
ImmutableList.Builder<YTypedProperty> primary = ImmutableList.builder();
|
||||
ImmutableList.Builder<YTypedProperty> required = ImmutableList.builder();
|
||||
ImmutableList.Builder<YTypedProperty> other = ImmutableList.builder();
|
||||
for (YTypedProperty p : properties) {
|
||||
if (p.isPrimary()) {
|
||||
primary.add(p);
|
||||
} else if (p.isRequired()) {
|
||||
required.add(p);
|
||||
} else {
|
||||
other.add(p);
|
||||
}
|
||||
}
|
||||
return ImmutableList.of(primary.build(), required.build(), other.build());
|
||||
}
|
||||
return ImmutableList.of(primary.build(), required.build(), other.build());
|
||||
} else {
|
||||
return ImmutableList.of(properties);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,11 @@ import reactor.core.publisher.Flux;
|
||||
*/
|
||||
public class YTypeFactory {
|
||||
|
||||
/**
|
||||
* Configuration option for the type-based completion engine.
|
||||
*/
|
||||
private boolean enableTieredProposals = true;
|
||||
|
||||
private static class Deprecation {
|
||||
final String errorMsg;
|
||||
final String replacement;
|
||||
@@ -154,6 +159,11 @@ public class YTypeFactory {
|
||||
*/
|
||||
public final YTypeUtil TYPE_UTIL = new YTypeUtil() {
|
||||
|
||||
@Override
|
||||
public boolean isEnabledTieredProposals() {
|
||||
return enableTieredProposals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSequencable(YType type) {
|
||||
return ((AbstractType)type).isSequenceable();
|
||||
@@ -901,5 +911,9 @@ public class YTypeFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
public YTypeFactory enableTieredProposals(boolean enable) {
|
||||
this.enableTieredProposals = enable;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,4 +49,11 @@ public interface YTypeUtil {
|
||||
List<Constraint> getConstraints(YType type);
|
||||
|
||||
ISubCompletionEngine getCustomContentAssistant(YType type);
|
||||
|
||||
/**
|
||||
* Config option for type-based completion engine. This enables the
|
||||
* 'tiered' proposals feature (so that optional properties are not
|
||||
* suggested until required ones are all defined)
|
||||
*/
|
||||
boolean isEnabledTieredProposals();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user