-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
feature request: Auto import dependencies #2635
Comments
@wxqqh Any specific languages you have in mind? |
en, such as Just like this, the workspace:
In import * as util1 from "../util/utilsubdir/uitl1.ts";
import * as util2 from "../util/utilsubdir/uitl2.ts"; In this process, it's easy to get wrong.
So, if VSCode can support this feature, it will be very easy to resolve by just press the shortcut key. |
This would be a really cool feature. I'm currently using Webstorm for Angular 2 development - there you can just type |
It is a hot feature! Desired behavior for TypeScript:
This scenario is not suited well for CommonJS @dbaeumer you are our hope! |
@Artazor the actual implementation of that feature has to come from the TS team which maintain the tsserver which we use for TS language smartness. They have several bugs for this:
|
The repository is: https://github.com/Microsoft/TypeScript |
Why / how is Webstorm able to do it? That seems to work pretty fine. |
@Artazor didn't make myself clear enough: this is not a technical problem. The TypeScript team is working on addressing it. I The coding of that feature has to happen in this https://github.com/Microsoft/TypeScript and not in VS Code itself. We use the tsserver from that repository via npm inside VS Code. |
Is there any progress on this? |
See microsoft/TypeScript#188 CC @jbrownson. |
So now that microsoft/TypeScript#188 has been closed and a bunch of extensions already provide autoimport for TS, will this be baked into VSCode? Or will it remain something from userland? |
Yeah, I'm very interested to know that as well. Along with VSTS integration it's the most important missing feature I believe. |
Just for the record. microsoft/TypeScript#188 will not solve this request. microsoft/TypeScript#188 is about code complete in file name in import statements. It will not automatically add imports like Ctrl+Shift+O in Eclipse. microsoft/TypeScript#188 will very likely land in the next VS Code release |
Potentially solved by this plugin https://github.com/soates/Auto-Import |
@OliverJAsh I use this and it's great. However, I don't think it supports removing unused imports and sorting them. I could be wrong though. |
@OliverJAsh and @caseyhoward Have you guys tried Typescript Hero? |
This is of dup of the Orange code assist example. The item it adds is the cleanup of unused imports. |
@dbaeumer Is there any place where "auto-importing" is being tracked as an issue, then? |
Yes, @waderyan knows which I forgot to ping in my last comment. |
Okay, but will THIS issue solve it? Or what issue will solve it? Why do we need extensions for such a basic feature? #2635 (comment) |
@roblourens Clearly, you didn't read into the rest of the comments. |
I believe this is the correct issue - microsoft/TypeScript#7849 |
It is annoying writing code without this feature, I've tried typescript-hero, seems that it doesn't import symbols in module declaration in d.ts. (I want auto alias actually.) |
I think that now Typescript 2.2 and Visual Studio Code 1.10 allow adding missing imports as stated on the blog: So, should this issue be closed? |
what we request is different with what they stated, I don't want to select or move cursor to every symbols to fix missing imports, fixing every missing import automatically with one single command is better. |
Is there a way to say for auto-import to use single quotes? |
@ng-state This is being tracked upstream: microsoft/TypeScript#13270 |
Yes, VScode 1.10 added a quick fix for imports but as @fightingcat notes, we do not automatically apply these fixes and I believe that is what this issue is tracking. This feature would likely behave like eslint'/tslint's We will only be able to auto fix symbols that have a single potential import. Otherwise, you will still have to manually apply the quick fix and select the correct import to use. We also want to make sure this does not get in the way while you are working on a file |
@mjbvz it was opened in Jan 3 and still not fixed.. forcing devs to correct each import by hand :( |
What is missing - intellisence. E.g. when using AutoImport plugin you begin to write class name and you can pick it from the list, once picked import is added automatically. With current implementation developer needs to know exact class name to get yellow bulb for import. |
In my view, this feature is much more urgent than others, would save much time. |
Are there any plans to have this also for javascript? |
Having this feature for .net would be great.. |
Adding to the October iteration plan. This will depend on microsoft/TypeScript#19069 which should land in TypeScript 2.6 |
@mjbvz As I'm not sure it's a TS or VS Code problem, please see microsoft/TypeScript#19417 about an important problem with this new feature. |
Can VSCode support automatically import dependencies just link eclipse(ctrl+shift+o)?
The text was updated successfully, but these errors were encountered: