-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add options for ConfigFactory to handle customConfig properly #2588
base: main
Are you sure you want to change the base?
Conversation
val config = ConfigFactory.parseString(text).resolve() | ||
val config = JsonParser.parseString(text).asJsonObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfigFactory does not render json. The rendered config contained the comment with # instead of //. Using JsonParser fixes the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other option would be adding .setComments(false)
in the current code.
I thought Lightened Config was a bit more forgiving when parsing e.g. additional commas.
Maybe we can write simple test for that and check how those corner cases looks in case of both approaches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
95ac480
to
6264807
Compare
additionalProperties.forEach { (key, value) -> | ||
config.withValue(key, ConfigValueFactory.fromAnyRef(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a bug 😄 configs are immutable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, we ignored "foldingRanges": "indentation-based" - how important for us is this option?
parsed | ||
.get("cody") | ||
.asJsonObject | ||
.get("experimental") | ||
.asJsonObject | ||
.get("foldingRanges") | ||
.asString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withValue
adds the field as
"cody": {
"experimental": {
"foldingRanges": "indentation-based"
}
}
instead of
"cody.experimental.foldingRanges": "indentation-based"
Is it a problem? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO It is not, those are equivalent in VSC config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes https://linear.app/sourcegraph/issue/CODY-4264/a-comment-in-cody-settingsjson-breaks-cody-initialization-stuck-at.
Test plan