Skip to content

Language Service: Automatic Import Improvements #47737

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

Open
dylhunn opened this issue Oct 11, 2022 · 12 comments
Open

Language Service: Automatic Import Improvements #47737

dylhunn opened this issue Oct 11, 2022 · 12 comments
Assignees
Labels
area: language-service Issues related to Angular's VS Code language service feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Milestone

Comments

@dylhunn
Copy link
Contributor

dylhunn commented Oct 11, 2022

I recently implemented auto-imports in the language service in #47088. This feature includes the scaffolding for a large number of possible improvements, tracked below. We should prioritize some of these to make the experience as excellent as possible.

  • (15.0.0) Automatic Quickfix Imports: Suggest imports as a quick fix for unknown standalone components.
  • (15.0.0) NgModule support: Support importing to and from NgModules, in addition to standalone components.
  • (15.1.0) Multi-suggestions: If more than one directive has this selector, give the user a choice.
  • (15.2.0) Pipes: Support pipes as well as directives.
  • 🗓️ Declaration Files: Suggest directives from .d.ts files, including imports with @ specifiers.
  • 🗓️ Builtin Directives: We should suggest first-party Angular directives and pipes when appropriate.

✅ Complete | 🚧 In Progress | 🗓️ Planned

Collected PRs Relevant to this Hotlist
Language Service: #47181, #47088, #47787, #47938, #48074, #48354
Compiler: #47180, #47166, #47561, #47631, #48090

@dylhunn dylhunn added feature Issue that requests a new feature area: language-service Issues related to Angular's VS Code language service feature: under consideration Feature request for which voting has completed and the request is now under consideration labels Oct 11, 2022
@ngbot ngbot bot modified the milestone: Backlog Oct 11, 2022
@dylhunn dylhunn self-assigned this Oct 11, 2022
@kbrilla
Copy link

kbrilla commented Oct 14, 2022

Is the code behind this feature using typescript auto-import rules?
[https://github.com/microsoft/TypeScript/issues/51155](Auto-import priority rules)
There are some issues right now in TS when for example monorepors like nx are involved where relative paths are proposed instead of @my-lib/... even if they are properly exported in barrels.

@dylhunn
Copy link
Contributor Author

dylhunn commented Oct 17, 2022

@kbrilla

Is the code behind this feature using typescript auto-import rules?

Not at present. I may switch to using the TypeScript compiler to emit some import references -- I need to do more research into how this works.

In general, we can always emit a same-project relative path, but figuring out absolute specifiers is much trickier.

@JeanMeche
Copy link
Member

Awesome work !

Btw you might want to consider #48689 which have been opened recently !

@dylhunn
Copy link
Contributor Author

dylhunn commented Jan 23, 2023

Thanks. I hadn't actually seen that issue yet.

@Akxe
Copy link

Akxe commented Mar 18, 2023

What do I need to do in order to enable this in my codebase? I am using Angular 15.1 with nx monorepo

@kbrilla
Copy link

kbrilla commented May 30, 2023

Any progress on this one? Seems like Webstorm is once again ahead of angular language service

@rezoled
Copy link

rezoled commented Aug 15, 2023

What's the current status and roadmap?
We are currently running with language service 16.1 and it seems like a lot of features are missing, which makes it really difficult to us to migrate to VSCode from IntelliJ.
Specifically

  • Auto imports of components based on tsconfig paths declaration.
  • Component suggestions

@fMoro1999
Copy link

fMoro1999 commented Nov 8, 2023

Hi, are there any news on this?

@itspers
Copy link

itspers commented Aug 4, 2024

Can't understand how people using Vscode for developing angular... Trying once in few months, it looks like some kind of GPT in 50% of functions now, but it still cant import simple button directive. Only theory i have - MS made it not to write real code, but to have something simple and fast to shoot videos of how to make hello world one-file projects to make them viral in twitter and popularize programming in general...

@jpike88
Copy link

jpike88 commented Mar 10, 2025

Over 2 years later... I have relative imports scattered all over the place in my angular project because my devs just can't help themselves using the auto import suggestions. It's a mess now.

@alan-agius4 these kind of things matter, can the team please look at this one properly? Most people with a project bigger than a hello world likely use tsconfig paths, they're critical in helping maintain an organized codebase. This shouldn't have even been released without getting that part right.

@luketanner
Copy link

luketanner commented Apr 17, 2025

I agree with @jpike88 -- this is a very frustrating pain point for our team as well. Is this issue even on the agenda/roadmap?

Between this and a whole host of other missing/half-broken features (as @rezoled and others have also alluded to) -- and more than anything, the lack of acknowledgement/response to them (so many issues open for years with no indication of whether they're even being considered) -- we're finding it very hard to justify sticking with VS Code. As reluctant as I am to admit it, we're this close to giving up on it altogether and just moving to WebStorm.

@itspers
Copy link

itspers commented Apr 17, 2025

I agree with @jpike88 -- this is a very frustrating pain point for our team as well. Is this issue even on the agenda/roadmap?

Between this and a whole host of other missing/half-broken features (as @rezoled and others have also alluded to) -- and more than anything, the lack of acknowledgement/response to them (so many issues open for years with no indication of whether they're even being considered) -- we're finding it very hard to justify sticking with VS Code. As reluctant as I am to admit it, we're this close to giving up on it altogether and just moving to WebStorm.

It all moving so slow that since my last comment i already switched to VSCode, and now considering switching back.
At some point AI in Cursor became so good, that it fixes lack of serious language server - Cursor just suggest right import faster than extensions even think. And not only for angular, but TS language server as well. So i just press tab, tab, tab...

But now Windsurf announced new Jetbrains plugin, and Jetbrains themselves announced owen Junie - will try all that, maybe in combination will be better than Cursor, cause after working half year in this, still feels like you working in Notepad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: language-service Issues related to Angular's VS Code language service feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

9 participants