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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic NgModule Imports #1501

Closed
2 tasks done
wSedlacek opened this issue Sep 6, 2021 · 10 comments
Closed
2 tasks done

Automatic NgModule Imports #1501

wSedlacek opened this issue Sep 6, 2021 · 10 comments
Assignees
Labels

Comments

@wSedlacek
Copy link

Is your feature request related to a problem? Please describe.

No

馃殌 feature request

Description

One of the killer features of Webstorm when working with angular is the ability to automatically import NgModules from templates as an auto completion for components, directives and pipes.

It would be fantastic if such a feature could be brought into vsc

Feature Type

What does this bug affect

  • Angular Language Service VSCode extension
  • Angular Language Service server

Describe the solution you'd like

This is probably a tricky problem to solve as it relies on knowing all the possible NgModules (something that even TypeScript struggles with for things like submodules imports of @angular/material) and then adding the import via a code completion to a file that is potentially not open.

The closest thing I can think of that currently exist in vsc is renaming files automatically updating their imports which I believe the TypeScript language service manages.

Describe alternatives you've considered

Anything else relevant?

WebStorm added this feature in 2019 but I don't think their work on it is open source, at least I couldn't find it easily.

@dylhunn
Copy link
Collaborator

dylhunn commented Jul 13, 2022

Just for the record -- I'm working on this, building on top of the work as per this PR for #1610.

@eneajaho
Copy link

@dylhunn This is great news 馃コ. Will it also import the module in @component imports array?

@dylhunn
Copy link
Collaborator

dylhunn commented Jul 13, 2022

That's an interesting point; probably we should. I'm looking at it more from the standalone angle as well though.

@laggage
Copy link

laggage commented Oct 14, 2022

Expecting this feature~

@atscott
Copy link
Collaborator

atscott commented Mar 24, 2023

@dylhunn As far as I can tell, this is working with components that are declared in NgModules and standalone components so I think we can close this as completed. Is that correct?

@dylhunn
Copy link
Collaborator

dylhunn commented Mar 24, 2023

@dylhunn Yes, closing this!

@dylhunn dylhunn closed this as completed Mar 24, 2023
@A77AY
Copy link

A77AY commented Apr 15, 2023

@dylhunn What about the same feature with external libraries?
(In VS Code, there are still no code actions available for Material package modules)

@dylhunn
Copy link
Collaborator

dylhunn commented Apr 24, 2023

I'm intending to enable this for external libraries in a future release. I was worried about performance issues, and so I put it on the back burner for a while. (Although the primary motivation is standalone, there's no reason we can't also do it for NgModules)

@laggage
Copy link

laggage commented Apr 25, 2023

I was worried about performance issues, and so I put it on the back burner for a while

May be we can have an option to opt-in

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants