-
-
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
allow keeping the original line breaks/formatting in the TOML #112
Comments
I'm not sure about this. The comment situation is already a bit tricky (especially with sorting enabled) because they are not parsed by the toml parser itself. The comment can be seen as an annotation to an entry, while for whitespace this feels a but more fuzzy. As you mention this can be worked around now by using (empty) comments in stead of line breaks, or the whitespace removal can be reverted after updating the catalog when using vcs. |
@hvisser yeah, I get your point. From a "pure" perspective, implementing what I proposed directly would be a code abuse. Still, processing of metadata (including comments, whitespace, newlines, annotations etc.) in config files was always a tricky problem, and there is no real answer here (see e.g. marzer/tomlplusplus#28 , go-yaml/yaml#709 or the famous problem of JSON comments) - for a "purer" approach, renaming the
Even the https://toml.io/en/v1.0.0 doc uses newlines to pad the files extensively, especially before
Anyway, if this functionality was hidden behind a boolean config flag that would be |
That is unrelated to formatting, you should mark versions not used in dependencies with |
Thanks for update!
to
Which is used like this:
|
@Raenar4k yes, this is unrelated, please file a new issue. It could be that one of your dependencies is pulling in |
Alright, thanks! It would be nice to be able to use line breaks to make toml more readable and not have them deleted each time we run plugin. |
With big files, splitting into sections and using vertical space increases readability. The comment nodes are respected and left alone, so they can be used as a workaround, but would it be possible to just allow keeping the line breaks etc. also (as a config param probably)?
I guess that current approach of storing comments per key could be extended to store newlines as "comments" of a kind also?
data class Comments
looks like it could easily handle just\n
in its Strings, e.g.would then make
spring-boot-starter
store 3 comments,[ "# newline below", "\n", "# after the newline" ]
It could be handled just as another case in https://github.com/littlerobots/version-catalog-update-plugin/blob/main/catalog/src/main/kotlin/nl/littlerobots/vcu/VersionCatalogParser.kt#L60 , along the lines of
The text was updated successfully, but these errors were encountered: