{"action":"created","issue":{"url":"https://api.github.com/repos/benjamn/recast/issues/186","labels_url":"https://api.github.com/repos/benjamn/recast/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/benjamn/recast/issues/186/comments","events_url":"https://api.github.com/repos/benjamn/recast/issues/186/events","html_url":"https://github.com/benjamn/recast/pull/186","id":88277978,"number":186,"title":"Attempt to guess whether or not to use tabs","user":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-15T00:55:13Z","updated_at":"2015-06-15T19:26:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/benjamn/recast/pulls/186","html_url":"https://github.com/benjamn/recast/pull/186","diff_url":"https://github.com/benjamn/recast/pull/186.diff","patch_url":"https://github.com/benjamn/recast/pull/186.patch"},"body":"Attempting to fix #185. Unfortunately that's not happening just yet. New statements start with no indentation, then get spaces added despite the file having been guessed as `{ useTabs: true }`.\r\n\r\nCould use some help debugging this, to be honest. I definitely feel like I'm on the right track, but I'm just missing something in the recursive (and hard to trace) print flow. But if anyone has a better approach, I'm open to suggestions."},"comment":{"url":"https://api.github.com/repos/benjamn/recast/issues/comments/112180357","html_url":"https://github.com/benjamn/recast/pull/186#issuecomment-112180357","issue_url":"https://api.github.com/repos/benjamn/recast/issues/186","id":112180357,"user":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T19:26:00Z","updated_at":"2015-06-15T19:26:00Z","body":"> \r\n\r\nWhat I mean is: guessing both options.useTabs and options.tabWidth is a deceptively difficult problem, which might be why text editors like TextMate and Sublime require the user to specify the tab width manually.\r\n\r\nYou're probably not wrong about that... That said, we do tend to know/infer `options.tabWidth`, so maybe `Lines.prototype.indent` could take in an extra argument for tab width and (if that argument is specified) convert to tabs accordingly?\r\n\r\nOr, something else to think about, could the `Lines` instances themselves store a tabWidth and/or useTabs value and just retain that? Then calls to `indent`/`indentTail`/similar wouldn't need to know if tabs are on or off."}}