Skip to content
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

Toml comments are not saved inside arrays #29

Open
ruckustboom opened this issue Aug 9, 2017 · 2 comments
Open

Toml comments are not saved inside arrays #29

ruckustboom opened this issue Aug 9, 2017 · 2 comments

Comments

@ruckustboom
Copy link

ruckustboom commented Aug 9, 2017

I found one more place where comments are not being kept, but I'm honestly not sure where they would be kept. The following

hosts = [
  "alpha", # Where does this comment go?
  "omega"
]

loses its comment and becomes

hosts = ["alpha", "omega"]

Tested in 3.0.1

(Sorry for all the issues, but I really do like your library)

@TheElectronWill
Copy link
Owner

This is because the comments are stored per config value, not for the value's content. So the comments inside the array are ignored.

They could be kept by changing the comments' storage to a slightly more complicated one. In particular, getComment(path) would return a CommentInfos object instead of a String, and this object would contain the comments of the array's elements.

@ruckustboom
Copy link
Author

ruckustboom commented Aug 11, 2017

Makes sense. This (along with the related issues) aren't a deal breaker, so it's probably not worth implementing if the comment storage would be too complex.

They are just comments after all :)

@TheElectronWill TheElectronWill self-assigned this Sep 1, 2017
@TheElectronWill TheElectronWill changed the title TOML Comment disappearing Toml comments are not saved inside arrays Mar 6, 2018
@TheElectronWill TheElectronWill added this to the v3.1 milestone Mar 6, 2018
@TheElectronWill TheElectronWill modified the milestones: v3.1, Backlog May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants