{"action":"created","issue":{"url":"https://api.github.com/repos/avh4/elm-format/issues/139","repository_url":"https://api.github.com/repos/avh4/elm-format","labels_url":"https://api.github.com/repos/avh4/elm-format/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/avh4/elm-format/issues/139/comments","events_url":"https://api.github.com/repos/avh4/elm-format/issues/139/events","html_url":"https://github.com/avh4/elm-format/issues/139","id":137851161,"number":139,"title":"Insert newlines for excessively long imports and type annotation","user":{"login":"danyx23","id":2772449,"avatar_url":"https://avatars.githubusercontent.com/u/2772449?v=3","gravatar_id":"","url":"https://api.github.com/users/danyx23","html_url":"https://github.com/danyx23","followers_url":"https://api.github.com/users/danyx23/followers","following_url":"https://api.github.com/users/danyx23/following{/other_user}","gists_url":"https://api.github.com/users/danyx23/gists{/gist_id}","starred_url":"https://api.github.com/users/danyx23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danyx23/subscriptions","organizations_url":"https://api.github.com/users/danyx23/orgs","repos_url":"https://api.github.com/users/danyx23/repos","events_url":"https://api.github.com/users/danyx23/events{/privacy}","received_events_url":"https://api.github.com/users/danyx23/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/avh4/elm-format/labels/discussion","name":"discussion","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/avh4/elm-format/milestones/1","html_url":"https://github.com/avh4/elm-format/milestones/1.0.0%20public%20release","labels_url":"https://api.github.com/repos/avh4/elm-format/milestones/1/labels","id":1365483,"number":1,"title":"1.0.0 public release","description":"","creator":{"login":"avh4","id":1222,"avatar_url":"https://avatars.githubusercontent.com/u/1222?v=3","gravatar_id":"","url":"https://api.github.com/users/avh4","html_url":"https://github.com/avh4","followers_url":"https://api.github.com/users/avh4/followers","following_url":"https://api.github.com/users/avh4/following{/other_user}","gists_url":"https://api.github.com/users/avh4/gists{/gist_id}","starred_url":"https://api.github.com/users/avh4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avh4/subscriptions","organizations_url":"https://api.github.com/users/avh4/orgs","repos_url":"https://api.github.com/users/avh4/repos","events_url":"https://api.github.com/users/avh4/events{/privacy}","received_events_url":"https://api.github.com/users/avh4/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":27,"state":"open","created_at":"2015-10-20T05:19:39Z","updated_at":"2016-03-08T21:54:19Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-03-02T11:41:40Z","updated_at":"2016-03-08T21:59:44Z","closed_at":null,"body":"I have a few places where either the list of imported types/functions or the type annotations of a function get very long (in my most extreme case 300+ characters). When I format these things by hand, I insert a newline at every comma in the list of imports or at the arrows of the type annotation, like so:\r\n```elm\r\nimport Tasks exposing ( loadPhotoData\r\n                      , loadAudioData\r\n                      , getSlideshowFromServer\r\n                      , downloadAudioFromServer\r\n                      , saveSlideshowToServer\r\n                      , uploadAssetFile\r\n                      , notifyServerOfSuccessfulUpload\r\n                      , resultToString\r\n                      , resultToStringString\r\n                      , slideshowErrorToString\r\n                      , usernameErrorToString\r\n                      , dummyErrorToString\r\n                      , createSlideshowAtServer\r\n                      , registerUsername\r\n                      , createDownloadAudioDataEffect)\r\n\r\nnotifyServerOfSuccessfulUpload : SlideshowMetadata \r\n                                 -> AuthToken \r\n                                 -> Json.Decode.Decoder (Result (RichError c) d) \r\n                                 -> (Asset a b -> Result (RichError c) d -> EditorAction) \r\n                                 -> Maybe (Asset a b) \r\n                                 -> Effects EditorAction\r\n```\r\n\r\nRight now, elm-format removes the newlines and creates one long line in both of these cases.\r\n\r\nWould it be possible to change elm-format to either \r\n\r\n1. keep the newlines in this case or \r\n2. introduce (as an option?) the possibility to insert newlines in these two cases if the line length exceeds a threshold\r\n\r\nI don't really care about variations of this style (e.g. to keep the arrows with the previous line instead of starting the next line with them), but either of the two options would make elm-format significantly nicer for me :)."},"comment":{"url":"https://api.github.com/repos/avh4/elm-format/issues/comments/193985953","html_url":"https://github.com/avh4/elm-format/issues/139#issuecomment-193985953","issue_url":"https://api.github.com/repos/avh4/elm-format/issues/139","id":193985953,"user":{"login":"avh4","id":1222,"avatar_url":"https://avatars.githubusercontent.com/u/1222?v=3","gravatar_id":"","url":"https://api.github.com/users/avh4","html_url":"https://github.com/avh4","followers_url":"https://api.github.com/users/avh4/followers","following_url":"https://api.github.com/users/avh4/following{/other_user}","gists_url":"https://api.github.com/users/avh4/gists{/gist_id}","starred_url":"https://api.github.com/users/avh4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avh4/subscriptions","organizations_url":"https://api.github.com/users/avh4/orgs","repos_url":"https://api.github.com/users/avh4/repos","events_url":"https://api.github.com/users/avh4/events{/privacy}","received_events_url":"https://api.github.com/users/avh4/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T21:59:44Z","updated_at":"2016-03-08T21:59:44Z","body":"The rule I'd like to implement here is that if the `exposing` clause contains any newlines, then it will put each list item on a separate line, otherwise keep it all on one line.  This would be consistent with most other formatting in elm-format.\r\n\r\nAlso, I think the style choice that makes the most sense is\r\n\r\n```elm\r\nimport Tasks\r\n  exposing\r\n    ( loadPhotoData\r\n    , loadAudioData\r\n    , getSlideshowFromServer\r\n    , downloadAudioFromServer\r\n    , saveSlideshowToServer\r\n    , uploadAssetFile\r\n    , notifyServerOfSuccessfulUpload\r\n    , resultToString\r\n    , resultToStringString\r\n    , slideshowErrorToString\r\n    , usernameErrorToString\r\n    , dummyErrorToString\r\n    , createSlideshowAtServer\r\n    , registerUsername\r\n    , createDownloadAudioDataEffect\r\n    )\r\n```"}}