Improve rendering of config

This commit is contained in:
CmdrKittens
2020-04-09 01:04:53 -04:00
parent 9a8538b844
commit 6d95eadf78
2 changed files with 1 additions and 14 deletions
@@ -80,11 +80,6 @@ abstract class ConfigString extends AbstractConfigValue implements Serializable
@Override
protected void render(StringBuilder sb, int indent, boolean atRoot, ConfigRenderOptions options) {
String rendered;
if (options.getJson())
rendered = ConfigImplUtil.renderJsonString(value);
else
rendered = ConfigImplUtil.renderStringUnquotedIfPossible(value);
sb.append(rendered);
sb.append(ConfigImplUtil.renderJsonString(value));
}
}
@@ -209,9 +209,7 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
sb.append("[");
if (options.getFormatted())
sb.append('\n');
int count = 0;
for (AbstractConfigValue v : value) {
count++;
if (options.getOriginComments()) {
String[] lines = v.origin().description().split("\n");
for (String l : lines) {
@@ -224,12 +222,6 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
}
}
if (options.getComments()) {
if (count > 1) {
sb.append('\n');
if (!v.origin().comments().isEmpty()) {
sb.append('\n');
}
}
for (String comment : v.origin().comments()) {
indent(sb, indent + 1, options);
sb.append("# ");