{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/dart_style/issues/551","repository_url":"https://api.github.com/repos/dart-lang/dart_style","labels_url":"https://api.github.com/repos/dart-lang/dart_style/issues/551/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/dart_style/issues/551/comments","events_url":"https://api.github.com/repos/dart-lang/dart_style/issues/551/events","html_url":"https://github.com/dart-lang/dart_style/issues/551","id":187180913,"number":551,"title":"Trailing comma changes format of named constructor arguments","user":{"login":"stevemessick","id":8518285,"avatar_url":"https://avatars.githubusercontent.com/u/8518285?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemessick","html_url":"https://github.com/stevemessick","followers_url":"https://api.github.com/users/stevemessick/followers","following_url":"https://api.github.com/users/stevemessick/following{/other_user}","gists_url":"https://api.github.com/users/stevemessick/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemessick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemessick/subscriptions","organizations_url":"https://api.github.com/users/stevemessick/orgs","repos_url":"https://api.github.com/users/stevemessick/repos","events_url":"https://api.github.com/users/stevemessick/events{/privacy}","received_events_url":"https://api.github.com/users/stevemessick/received_events","type":"User","site_admin":false},"labels":[{"id":182585567,"url":"https://api.github.com/repos/dart-lang/dart_style/labels/as%20designed","name":"as designed","color":"657b83","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-03T20:28:05Z","updated_at":"2016-11-04T18:25:46Z","closed_at":"2016-11-03T21:42:18Z","body":"Here's the output from dartfmt for identical constructor calls, modulo trailing comma. I expected both to have 2-space indentation. Not sure where the closing paren should go, but I think the first looks better.\r\n```dart\r\nmain() {\r\n  new Foo(\r\n    bar: \"1111111111111111111111111111111111111111111111111111111111111\",\r\n    baz: \"2222222222222222222222222222222222222222222222222222222222222\",\r\n  );\r\n  new Foo(\r\n      bar: \"1111111111111111111111111111111111111111111111111111111111111\",\r\n      baz: \"2222222222222222222222222222222222222222222222222222222222222\");\r\n}\r\n\r\nclass Foo {\r\n  Foo({bar: \"\", baz: \"\"}) {}\r\n}\r\n```\r\n@alexander-doroshko came up with this example. We're trying to update the IntelliJ formatter (which is not dartfmt) to better suit the needs of Flutter. We could use some guidance even if a patch was delayed.\r\n\r\nAlso see https://youtrack.jetbrains.com/issue/WEB-23958"},"comment":{"url":"https://api.github.com/repos/dart-lang/dart_style/issues/comments/258511130","html_url":"https://github.com/dart-lang/dart_style/issues/551#issuecomment-258511130","issue_url":"https://api.github.com/repos/dart-lang/dart_style/issues/551","id":258511130,"user":{"login":"munificent","id":46275,"avatar_url":"https://avatars.githubusercontent.com/u/46275?v=3","gravatar_id":"","url":"https://api.github.com/users/munificent","html_url":"https://github.com/munificent","followers_url":"https://api.github.com/users/munificent/followers","following_url":"https://api.github.com/users/munificent/following{/other_user}","gists_url":"https://api.github.com/users/munificent/gists{/gist_id}","starred_url":"https://api.github.com/users/munificent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munificent/subscriptions","organizations_url":"https://api.github.com/users/munificent/orgs","repos_url":"https://api.github.com/users/munificent/repos","events_url":"https://api.github.com/users/munificent/events{/privacy}","received_events_url":"https://api.github.com/users/munificent/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T18:25:46Z","updated_at":"2016-11-04T18:25:46Z","body":"Yes, I feel your pain. Note that that problem appears in lots of other places too, though, because the formatter globally optimizes the formatting. Say the user types:\r\n\r\n```dart\r\nsomeFunction(argument &&\r\n```\r\n\r\nThen hits enter and types:\r\n\r\n```dart\r\nsomeFunction(argument &&\r\n    argument\r\n```\r\n\r\nThat gets indented +4. Now they type:\r\n\r\n```dart\r\nsomeFunction(argument &&\r\n    argument ||\r\n```\r\n\r\nAnd hit enter. Then add:\r\n\r\n```dart\r\nsomeFunction(argument &&\r\n        argument ||\r\n    argument);\r\n```\r\n\r\nAt that point, the previous line should be indented another +4. In general, it's not possible to know the correct indentation for a piece of code given only a prefix of it.\r\n\r\nBut I agree the trailing comma case is particularly egregious. In practice, most other cases are rare."}}
{"actor":{"display_login":"munificent"}}