{"action":"closed","issue":{"url":"https://api.github.com/repos/prettier/prettier/issues/1981","repository_url":"https://api.github.com/repos/prettier/prettier","labels_url":"https://api.github.com/repos/prettier/prettier/issues/1981/labels{/name}","comments_url":"https://api.github.com/repos/prettier/prettier/issues/1981/comments","events_url":"https://api.github.com/repos/prettier/prettier/issues/1981/events","html_url":"https://github.com/prettier/prettier/issues/1981","id":233673141,"number":1981,"title":"--cursor-offset output is wrong sometimes","user":{"login":"josephfrazier","id":6473925,"avatar_url":"https://avatars0.githubusercontent.com/u/6473925?v=4","gravatar_id":"","url":"https://api.github.com/users/josephfrazier","html_url":"https://github.com/josephfrazier","followers_url":"https://api.github.com/users/josephfrazier/followers","following_url":"https://api.github.com/users/josephfrazier/following{/other_user}","gists_url":"https://api.github.com/users/josephfrazier/gists{/gist_id}","starred_url":"https://api.github.com/users/josephfrazier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephfrazier/subscriptions","organizations_url":"https://api.github.com/users/josephfrazier/orgs","repos_url":"https://api.github.com/users/josephfrazier/repos","events_url":"https://api.github.com/users/josephfrazier/events{/privacy}","received_events_url":"https://api.github.com/users/josephfrazier/received_events","type":"User","site_admin":false},"labels":[{"id":491115803,"url":"https://api.github.com/repos/prettier/prettier/labels/type:bug","name":"type:bug","color":"ee0701","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-06-05T18:38:26Z","updated_at":"2018-05-01T12:43:00Z","closed_at":"2018-05-01T12:43:00Z","author_association":"COLLABORATOR","body":"I just wanted to note that since the `cursorOffset` option (introduced in https://github.com/prettier/prettier/pull/1637) works by tracking the cursor position relative to an AST node (rather than a [CST](https://github.com/cst/cst) token), it can produce incorrect results. For example:\r\n\r\n```bash\r\n$ echo \"return         15\" | prettier --cursor-offset 15 # the cursor is positioned immediately before `15`\r\nreturn 15;\r\n15\r\n```\r\n\r\n(related to https://github.com/esbenp/prettier-vscode/issues/12#issuecomment-305913893)"}}
{"actor":{"display_login":"duailibe"}}