microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
165.18k stars 29.62k forks source link

Organize imports command removes non-alias import #49724

Closed alejandroiglesias closed 6 years ago

alejandroiglesias commented 6 years ago

Issue Type: Bug

I know this seems a duplicate issue, but running the Organize Imports command removes this import:

import CodeMirror from 'codemirror';

The other reports I saw were related to aliasing an import (import {a as b} from 'a';), so this seems something different. Also, the import is being used.

VS Code version: Code 1.23.1 (d0182c3417d225529c6d5ad24b7572815d0de9ac, 2018-05-10T16:03:31.083Z) OS version: Darwin x64 16.7.0

Extensions (22) Extension|Author (truncated)|Version ---|---|--- EditorConfig|Edi|0.12.1 vscode-github|Kni|0.28.1 vscode-eslint|dba|1.4.8 tslint|eg2|1.0.28 prettier-vscode|esb|1.3.1 Angular1|joh|0.2.0 rainbow-csv|mec|0.2.1 dotenv|mik|1.0.1 ecdc|mit|0.12.0 vscode-attrs-sorter|mrm|2.1.0 vscode-doiuse|mrm|1.5.0 vscode-lebab|mrm|2.5.0 vscode-postcss-sorting|mrm|3.0.1 vscode-scss|mrm|0.6.2 vscode-cosmosdb|ms-|0.7.1 azure-account|ms-|0.4.0 debugger-for-chrome|msj|4.4.3 vscode-sort-json|ric|1.11.0 annotator|ryu|0.11.0 linter-xo|sam|2.1.3 language-stylus|sys|1.9.2 vscode-meteor|vuh|0.1.1
vscodebot[bot] commented 6 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

mjbvz commented 6 years ago

Please show how the import is being used in your file

alejandroiglesias commented 6 years ago

@mjbvz a few lines below the import:

Object.assign(window, { CodeMirror });

The parser may be failing to detect the new property value shorthand.

mjbvz commented 6 years ago

Thanks. This is a duplicate of #49193

It is fixed in vscode insiders

alejandroiglesias commented 6 years ago

@mjbvz thank you for the update.