{"action":"created","issue":{"url":"https://api.github.com/repos/typesafehub/config/issues/149","labels_url":"https://api.github.com/repos/typesafehub/config/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/typesafehub/config/issues/149/comments","events_url":"https://api.github.com/repos/typesafehub/config/issues/149/events","html_url":"https://github.com/typesafehub/config/issues/149","id":29354319,"number":149,"title":"Preserve comments across newlines?","user":{"login":"cprice404","id":1341071,"avatar_url":"https://avatars.githubusercontent.com/u/1341071?v=3","gravatar_id":"","url":"https://api.github.com/users/cprice404","html_url":"https://github.com/cprice404","followers_url":"https://api.github.com/users/cprice404/followers","following_url":"https://api.github.com/users/cprice404/following{/other_user}","gists_url":"https://api.github.com/users/cprice404/gists{/gist_id}","starred_url":"https://api.github.com/users/cprice404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cprice404/subscriptions","organizations_url":"https://api.github.com/users/cprice404/orgs","repos_url":"https://api.github.com/users/cprice404/repos","events_url":"https://api.github.com/users/cprice404/events{/privacy}","received_events_url":"https://api.github.com/users/cprice404/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/typesafehub/config/labels/feature%20request","name":"feature request","color":"5319e7"},{"url":"https://api.github.com/repos/typesafehub/config/labels/need%20help%20/%20info%20/%20volunteers%20welcome","name":"need help / info / volunteers welcome","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2014-03-13T14:26:24Z","updated_at":"2015-02-28T05:29:34Z","closed_at":null,"body":"Hi,\r\n\r\nI've been hacking a bit on porting this library to Ruby ( https://github.com/cprice404/ruby-typesafe-config/blob/master/README.md ).  One of the features I'm interested in is the ability to load a config file, modify the data programatically, and write the file back out to disk.  It's fine if the formatting changes a bit during the round trip, but retaining as many comments as possible is a huge win and a big part of why I am a fan of the Java library.\r\n\r\nHowever, I'm a bit confused as to the expected behavior for comments that are separated by a newline.  Here's an example config file:\r\n\r\n```\r\n# These are some opening comments\r\n\r\n# These are some additional opening comments\r\nfoo.bar {\r\n  baz = 42\r\n}\r\n```\r\n\r\nNow, if I load this via ConfigFactory.parseFile, and then render it back to a string (with render options +formatted, +comments, -json, -origincomments), I get this:\r\n\r\n```\r\nfoo {\r\n    # These are some additional opening comments\r\n    bar {\r\n        baz=42\r\n    }\r\n}\r\n```\r\n\r\nI understand why the comment got moved from the top of the file and is instead attached directly to \"bar\", but, I was a bit surprised that the very first comment line that had been at the beginning of the file just disappeared entirely.  Reading some of the comments in the source code, it sounded like there was some expectation that these comments would be grouped together despite the newline and would all be attached to \"bar\".\r\n\r\nIs the current behavior expected?  Would it be possible to make it save comments across newlines?\r\n\r\nFailing that, might it be worth considering any comments that appear at the very beginning of the file (followed by a blank line) to be \"header\" comments that would always be rendered at the top of the output during a render operation?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/typesafehub/config/issues/comments/76511785","html_url":"https://github.com/typesafehub/config/issues/149#issuecomment-76511785","issue_url":"https://api.github.com/repos/typesafehub/config/issues/149","id":76511785,"user":{"login":"havocp","id":218689,"avatar_url":"https://avatars.githubusercontent.com/u/218689?v=3","gravatar_id":"","url":"https://api.github.com/users/havocp","html_url":"https://github.com/havocp","followers_url":"https://api.github.com/users/havocp/followers","following_url":"https://api.github.com/users/havocp/following{/other_user}","gists_url":"https://api.github.com/users/havocp/gists{/gist_id}","starred_url":"https://api.github.com/users/havocp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/havocp/subscriptions","organizations_url":"https://api.github.com/users/havocp/orgs","repos_url":"https://api.github.com/users/havocp/repos","events_url":"https://api.github.com/users/havocp/events{/privacy}","received_events_url":"https://api.github.com/users/havocp/received_events","type":"User","site_admin":false},"created_at":"2015-02-28T05:29:34Z","updated_at":"2015-02-28T05:29:34Z","body":"no, it doesn't make any difference. we may as well keep it in one place :-)"}}