{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1988","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1988/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1988/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1988/events","html_url":"https://github.com/Microsoft/TypeScript/issues/1988","id":57071673,"number":1988,"title":"Support column limit in formatter","user":{"login":"alexeagle","id":47395,"avatar_url":"https://avatars.githubusercontent.com/u/47395?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeagle","html_url":"https://github.com/alexeagle","followers_url":"https://api.github.com/users/alexeagle/followers","following_url":"https://api.github.com/users/alexeagle/following{/other_user}","gists_url":"https://api.github.com/users/alexeagle/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeagle/subscriptions","organizations_url":"https://api.github.com/users/alexeagle/orgs","repos_url":"https://api.github.com/users/alexeagle/repos","events_url":"https://api.github.com/users/alexeagle/events{/privacy}","received_events_url":"https://api.github.com/users/alexeagle/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Needs%20Proposal","name":"Needs Proposal","color":"556b75"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Suggestion","name":"Suggestion","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-09T18:43:03Z","updated_at":"2015-02-09T21:30:49Z","closed_at":null,"body":"Currently, running the formatter\r\n(eg via the compiler API: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#pretty-printer-using-the-ls-formatter)\r\nproduces code which is arbitrarily wide, for statements which are nested, complex, etc.\r\n\r\nOur style guide requires a maximum columns, which means the formatter should take a configuration for how wide this is.\r\nLine breaks should probably be added at the highest point in the AST on the long line."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/73594292","html_url":"https://github.com/Microsoft/TypeScript/issues/1988#issuecomment-73594292","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1988","id":73594292,"user":{"login":"alexeagle","id":47395,"avatar_url":"https://avatars.githubusercontent.com/u/47395?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeagle","html_url":"https://github.com/alexeagle","followers_url":"https://api.github.com/users/alexeagle/followers","following_url":"https://api.github.com/users/alexeagle/following{/other_user}","gists_url":"https://api.github.com/users/alexeagle/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeagle/subscriptions","organizations_url":"https://api.github.com/users/alexeagle/orgs","repos_url":"https://api.github.com/users/alexeagle/repos","events_url":"https://api.github.com/users/alexeagle/events{/privacy}","received_events_url":"https://api.github.com/users/alexeagle/received_events","type":"User","site_admin":false},"created_at":"2015-02-09T21:30:49Z","updated_at":"2015-02-09T21:30:49Z","body":"Indeed, it does preserve the lines from the input. In my case, the input violates the style guide, and I'd like to use the formatter to fix that.\r\n\r\nreminder about the context: I'm working in the Closure Compiler to insert TypeScript syntax, so in general most lines become longer. In bad cases, we use a union of several types like \r\n```javascript\r\ngoog.string.compareElements_ = function(left: string | number | boolean, right: string | number | boolean): number {\r\n```\r\n\r\nif we want to convert chunks of Google javascript code to this syntax, we need to be able to style the generated result.\r\n\r\nI imagine this also is the case in IDE support, for example if you do a refactoring that inlines some code."}}