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

[ES6] Auto imports with completion #7849

Closed
angelozerr opened this issue Apr 6, 2016 · 31 comments
Closed

[ES6] Auto imports with completion #7849

angelozerr opened this issue Apr 6, 2016 · 31 comments
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue

Comments

@angelozerr
Copy link

It should really fantastic if tsserver completion command could support auto import with completion like WebStorm provides:

See http://blog.jetbrains.com/webstorm/2016/04/angular-2-workflow-in-webstorm/#ng2-imports for more information.

@angelozerr
Copy link
Author

@DanielRosenwasser @mhegazy is there any chance that tsserver could provide this feature? If yes in which RoadMap? Thanks!

@RyanCavanaugh
Copy link
Member

This would be really complex and is unlikely to be a priority relative to other work for quite a while

@angelozerr
Copy link
Author

Thank's @RyanCavanaughfor your answer. I understand that it's not your priority but a lot of users from VSCode, typescript.java complains about this missing features compared to Jetbrains.

I know that there are VSCode extension to do that, but it's not clean because there are double TypeScript parsing (one by tsserver and one by the extension). It should be very cool if tsserver provides this feature.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 26, 2016

#11768 would handle part of that, though not through completion but through quick fixes.

@angelozerr
Copy link
Author

Thanks @mhegazy for your answer. #11768 is a great feature. I'm implementing quickfix support inside Eclipse. I'm very enthousiasm to test it once my implementation will be finished.

Do you think you could use #11768 logic to support auto import with completion?

@mhegazy
Copy link
Contributor

mhegazy commented Oct 27, 2016

Do you think you could use #11768 logic to support auto import with completion?

What i meant is the user would get some of the functionality with the quick fix. possibly we can leverage some of the logic later on to support the feature in the OP.

the main issue is that we need to have our completion include some sort of edit ranges, so that accepting the completion would generate multiple changes in the file. which is not that hard to do to be frank, bit it is work.

@angelozerr
Copy link
Author

Thanks again @mhegazy to have taking time to answer me.

What i meant is the user would get some of the functionality with the quick fix.

Yes it's already a great improvement.

possibly we can leverage some of the logic later on to support the feature in the OP.

It was the answer that I wished:) Hope one day auto import will be implemented.

the main issue is that we need to have our completion include some sort of edit ranges, so that accepting the completion would generate multiple changes in the file. which is not that hard to do to be frank, bit it is work.

Ok I understand. I though the hard task was about the scan files (to have the best performance), because in this case you must scan about the whole ts files in the project and not only declared files as module (with import, require).

@waderyan waderyan added the VS Code Tracked There is a VS Code equivalent to this issue label Nov 2, 2016
@waderyan
Copy link

waderyan commented Nov 7, 2016

Feedback from VS Code users - microsoft/vscode#818

@angelozerr
Copy link
Author

@mhegazy I'm sorry to insist with this feature, but is there an chance that auto import could be added inside RoadMap https://github.com/Microsoft/TypeScript/wiki/Roadmap ?

@mhegazy
Copy link
Contributor

mhegazy commented Nov 29, 2016

We are planning the next release now. should have more information about what we can take on soon.

@angelozerr
Copy link
Author

Thank's @mhegazy!

@thekalinga
Copy link

This more than anything else is the biggest hurdle for users to move away from Webstorm.
Note sure why it is not yet listed in the Roadmap as of yet :(

@donaldpipowitch
Copy link
Contributor

@thekalinga If you want to switch from WebStorm to VS Code you can use a plugin to solve this for now. In my experience it works good enough and similar to WebStorm.

@thekalinga
Copy link

thekalinga commented Dec 15, 2016

@donaldpipowitch

Thanks for sharing this. I just tried using this. It was unable to show suggestion for Optional class in angular 2

It seems to be searching my source files instead of the dependencies under the source tree (usually in node_modules)

This seems like a decent attempt to show the suggestions atleast based on the code you already wrote, but its no where near webstorm

Please let me know if could import a class from a library that's already downloaded by npm but not yet imported into any classes in your project. I could not get this working.

I tried Optional as a test case as I know this is something thats part of @angular/core

May be I'm missing something

@thekalinga
Copy link

thekalinga commented Dec 15, 2016

Just looked at their TODO

Follow up ///<reference path="..." /> declarations
Process node_modules/**/*.d.ts
Process typings/**/*.d.ts

They have this in the list of todos. Hopefully once it is implemented, there will some working version similar to Webstorm.

Thanks in anycase

@thekalinga
Copy link

thekalinga commented Dec 15, 2016

Good news

I just came across this other plugin called Typescript Hero

This auto detects all classes from the dependencies aswell & allows you to organise imports (incase if you delete a class reference)

Try this. Some relief for TS developers.

Disclosure: I'm in no way associated with the developer

@angelozerr
Copy link
Author

@donaldpipowitch @thekalinga the big problems with thoses kinds of VSCode extensions is that there is a double parsing of TypeScript files (from tsserver and from the extension). I think it should be better than tsserver provides this feature for performance and for the other IDE, Editors.

@donaldpipowitch
Copy link
Contributor

@angelozerr Sure, it would be better to solve this inside the language service. But most people just asked for feature parity between VS Code and WebStorm and at the end WebStorm probably parses twice as well.

@waderyan
Copy link

Thank you for your feedback here! Although not tracked on TypeScript's repo, this is an issue we have high on our priority list on the VS Code side. As we nail down the planning more we will make it public.

@AndyMoreland
Copy link

I use (and maintain) the tsunami-code vscode extension to do this.

@thekalinga
Copy link

thekalinga commented Dec 27, 2016

@waderyan Whenever you have an update, is it possible to post update here/link to the vscode issue where we can expect updates (so that I can subscribe to that issue instead)

Thanks

@mhegazy mhegazy assigned aozgaa and unassigned zhengbli May 1, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.4, TypeScript 2.5 Jun 5, 2017
@amcasey amcasey self-assigned this Jul 5, 2017
@angelozerr
Copy link
Author

angelozerr commented Aug 6, 2017

There is a PR for this issue #13921 but I don't know when it will be available?

@mhegazy do you know when #13921 will be merged at master.

@amcasey amcasey assigned amcasey and unassigned aozgaa and amcasey Aug 21, 2017
@mhegazy mhegazy modified the milestone: TypeScript 2.6 Aug 31, 2017
@mhegazy mhegazy assigned ghost and unassigned amcasey Sep 21, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Oct 16, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Oct 17, 2017

Fixed by #19069

@mhegazy mhegazy closed this as completed Oct 17, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests