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: exclude files via settings #52087

Closed
no-stack-dub-sack opened this issue Jun 16, 2018 · 2 comments
Closed

Organize imports: exclude files via settings #52087

no-stack-dub-sack opened this issue Jun 16, 2018 · 2 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) javascript JavaScript support issues

Comments

@no-stack-dub-sack
Copy link

Suggestion

It would be excellent if we had the ability to disable organize imports on a per-file basis as part of the feature's settings, e.g. :

"editor.codeActionsOnSave": {
    "source.organizeImports": true,
    "source.organizeImports.exclude": [
        "**/index.ts",
        "src/components/MyComponent.ts"
    ]
},

Use Cases

Organize imports on save is an excellent time-saving feature, however in some rare cases, imports may need to be in a specific order for a specific file. For example, loading 3rd party CSS assets which conflict with one another in the right order in the root component of an angular or react app (which is one of my particular use-cases).

Currently, since I'm trying to maintain consistent standards throughout my project, I am keeping organize imports on, however, every time I modify a couple of particular files, I need to go to settings, turn it off, save, then turn it back on. It seems like this may be an edge use-case, since I don't see any one else suggesting this (searched open and closed issues, sorry if I missed something), but I'm sure others could also find it useful.

Thanks for considering my comments!

Examples

This:

import 'this-should-come-first.css';
import 'this-needs-to-be-loaded-last.css';

Sorts to this, even though the former condition needs to be true to preserve the correct styles:

import 'this-needs-to-be-loaded-last.css';
import 'this-should-come-first.css';
@vscodebot
Copy link

vscodebot bot commented Jun 16, 2018

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

@vscodebot vscodebot bot added the javascript JavaScript support issues label Jun 16, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 18, 2018

duplicate of microsoft/TypeScript#35395

(or rather of #50888 which was marked as a dup of that)

@mjbvz mjbvz closed this as completed Jun 18, 2018
@mjbvz mjbvz added the *duplicate Issue identified as a duplicate of another issue(s) label Jun 18, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) javascript JavaScript support issues
Projects
None yet
Development

No branches or pull requests

2 participants