Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize Imports Doesn't Respect "Groups" #78553

Closed
chriszwickerocteris opened this issue Aug 6, 2019 · 3 comments
Closed

Organize Imports Doesn't Respect "Groups" #78553

chriszwickerocteris opened this issue Aug 6, 2019 · 3 comments
Assignees
Labels
*extension-candidate Issue identified as good extension implementation

Comments

@chriszwickerocteris
Copy link

chriszwickerocteris commented Aug 6, 2019

Versions:

  • VSCode Version: 1.37.0-Insider
  • OS Version:Darwin x64 18.6.0

Description:

  • When using "Organize Imports", import "groups" are ignored. Instead, each group should be treated individually, retaining import grouping.
  • Comments separating groups are removed if the import following the comment is removed (it seems as if comments were assumed to be associated with the following import - that may be how some / many people work, but others use lines with only a comment as a "section title" and would add comments behind the code related to. Maybe this should be a setting?)

Steps to Reproduce:

  1. In a TS source with a few imports, create 2+ groups of imports (separating them by an empty line)
  2. Add a comment on the line above an unused import (add one if there is none)
  3. Run "Organize Imports"

Does this issue occur when all extensions are disabled?: Yes

@mjbvz mjbvz added the *extension-candidate Issue identified as good extension implementation label Aug 11, 2019
@vscodebot
Copy link

vscodebot bot commented Aug 11, 2019

We try to keep VS Code lean and we think the functionality you're asking for is great for a VS Code extension. Maybe you can already find one that suits you in the VS Code Marketplace. Just in case, in a few simple steps you can get started writing your own extension. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Aug 11, 2019
@chriszwickerocteris
Copy link
Author

@mjbvz I'm afraid I don't quite understand, isn't the functionality (as it is) part of the core? And if it is, can it easily be changed by an extension (if so, would you know of an example of an extension doing a similar thing)? And if not, are you suggesting reimplementing the functionality?

Thanks!

@j
Copy link

j commented Aug 13, 2019

I ran into this issue today as well.

I want to import 'reflect-metadata'; before anything else but it's sorting it by default causing compile errors.

How can I force specific imports to stay in place? Grouped imports makes sense here.

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*extension-candidate Issue identified as good extension implementation
Projects
None yet
Development

No branches or pull requests

3 participants