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

Option to start all imports in the imports list at the start of the file #62

Open
dantman opened this issue Jun 29, 2019 · 0 comments
Open

Comments

@dantman
Copy link

dantman commented Jun 29, 2019

I think the NPM Intellisense: Import module command would be more useful if instead of starting at the current cursor location (which may be in the middle of the file where it could be invalid syntax) it would insert the import at the end of the import list at the top of the file.

Bare minimum it would insert it at the top and move the cursor there so you can edit the imported identifiers.

Better would be if it added the import, placed your cursor on the identifier (for ES6 it would be a selection around the {} so you could either replace it with a default identifier import or add names), and if possible placed the equivalent of a snippet's $0 at the original cursor location. That way you could have a workflow like: Command Palette > Import module > Select package > Jump to location > Type out identifiers to import > Tab > Jump back to original cursor > Continue coding

Absolute ideal would be if it added the import and then opened one of the little inline windows vscode uses to peek at other files to the location the import was added at. Then you could edit the imported identifiers without leaving the location you plan to actually use the import.

I've gotten very used to vscode's built-in import feature, I typically type out identifiers and use intellisense to add imports automatically instead of jumping to the start of the file and importing them each time. And I use organize imports / eslint to manage the order of imports so I don't need to bother with that. However there are a few cases like invariant where vscode does not do a good job importing. So it would be really nice if I could use NPM Intellisense: Import module to import those with the same ease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant