{"action":"created","issue":{"url":"https://api.github.com/repos/chrmarti/testissues/issues/19843","repository_url":"https://api.github.com/repos/chrmarti/testissues","labels_url":"https://api.github.com/repos/chrmarti/testissues/issues/19843/labels{/name}","comments_url":"https://api.github.com/repos/chrmarti/testissues/issues/19843/comments","events_url":"https://api.github.com/repos/chrmarti/testissues/issues/19843/events","html_url":"https://github.com/chrmarti/testissues/issues/19843","id":323909819,"number":19843,"title":"Auto organize imports removes import which is being used","user":{"login":"vscodebot[bot]","id":28792856,"avatar_url":"https://avatars2.githubusercontent.com/in/2406?v=4","gravatar_id":"","url":"https://api.github.com/users/vscodebot%5Bbot%5D","html_url":"https://github.com/apps/vscodebot","followers_url":"https://api.github.com/users/vscodebot%5Bbot%5D/followers","following_url":"https://api.github.com/users/vscodebot%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/vscodebot%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/vscodebot%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vscodebot%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/vscodebot%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/vscodebot%5Bbot%5D/repos","events_url":"https://api.github.com/users/vscodebot%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/vscodebot%5Bbot%5D/received_events","type":"Bot","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-17T07:53:15Z","updated_at":"2018-05-17T07:53:19Z","closed_at":null,"author_association":"NONE","body":"- VSCode Version: 1.23.1\r\n- OS Version: Windows Server 2012 R2 (x64)\r\n\r\nI have a piece of JavaScript code. The code looks like this:\r\n```JavaScript\r\nimport { form } from \"../../components/__tests__/form\";\r\n\r\nfunction foo ()\r\n{\r\n    const obj = {\r\n        form,\r\n    }\r\n}\r\n```\r\nThe `form` import which is used in the `obj ` object is being removed when I hit save (with organize imports on save enabled). The work around for this is to create a variable and pass it through:\r\n\r\n```JavaScript\r\nimport { form } from \"../../components/__tests__/form\";\r\n\r\nfunction foo ()\r\n{\r\nconst xyzzy= form;\r\n    const obj = {\r\n        xyzzy,\r\n    }\r\n}\r\n```\r\nSeems to me that the import should not be removed in the first example.\r\n\r\n<!-- Launch with `code --disable-extensions` to check. -->\r\nDoes this issue occur when all extensions are disabled?: Yes\r\n"},"comment":{"url":"https://api.github.com/repos/chrmarti/testissues/issues/comments/389777962","html_url":"https://github.com/chrmarti/testissues/issues/19843#issuecomment-389777962","issue_url":"https://api.github.com/repos/chrmarti/testissues/issues/19843","id":389777962,"user":{"login":"vscodetestbot[bot]","id":29067401,"avatar_url":"https://avatars2.githubusercontent.com/in/2665?v=4","gravatar_id":"","url":"https://api.github.com/users/vscodetestbot%5Bbot%5D","html_url":"https://github.com/apps/vscodetestbot","followers_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/followers","following_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/repos","events_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/vscodetestbot%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-05-17T07:53:18Z","updated_at":"2018-05-17T07:53:18Z","author_association":"NONE","body":"Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:\n- [Organize imports remove imports in usage (#18263)](https://www.github.com/chrmarti/testissues/issues/18263) <!-- score: 0.502 -->\n- [TypeScript and JavaScript organize imports  (#15259)](https://www.github.com/chrmarti/testissues/issues/15259) <!-- score: 0.467 -->\n- [Typescript organize imports unwanted removal (#17739)](https://www.github.com/chrmarti/testissues/issues/17739) <!-- score: 0.446 -->\n<!-- potential_duplicates_comment -->"}}
{"actor":{"display_login":"vscodetestbot"}}