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

feat(language-service): expose determining the NgModule of a Directive #32710

Closed
wants to merge 3 commits into from

Conversation

ayazhafiz
Copy link
Member

This sets up the Language Service to support #32565.
This PR exposes a getDirectiveModule method on TypeScriptServiceHost
that returns the NgModule owning a Directive given the Directive's
TypeScript node or its Angular StaticSymbol. Both types are supported
to reduce extraneous helper methods.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Feature

Does this PR introduce a breaking change?

  • Yes
  • No

This sets up the Language Service to support angular#32565.
This PR exposes a `getDirectiveModule` method on `TypeScriptServiceHost`
that returns the NgModule owning a Directive given the Directive's
TypeScript node or its Angular `StaticSymbol`. Both types are supported
to reduce extraneous helper methods.
@ayazhafiz ayazhafiz added feature Issue that requests a new feature area: language-service Issues related to Angular's VS Code language service target: major This PR is targeted for the next major release labels Sep 17, 2019
@ayazhafiz ayazhafiz requested a review from a team as a code owner September 17, 2019 03:39
@ayazhafiz ayazhafiz self-assigned this Sep 17, 2019
@ngbot ngbot bot modified the milestone: needsTriage Sep 17, 2019
* @param node TypeScript node to get static symbol of
* @return Angular StaticSymbol of the TypeScript node, if any
*/
getNodeStaticSymbol(node: ts.Node): StaticSymbol|undefined {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being pedantic, node here seems overly broad in scope and not representative of the responsibility of the function. Why not take fileName + className?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Fixed now. Maybe it's better to just expose this.resolver in this case; we can return a readonly version, perhaps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reflector has its own caches, which would be invalidated through a public API that I proposed in #32543. If it is exposed, we lose control of the caches.

Copy link
Contributor

@kyliau kyliau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@kyliau kyliau added the action: merge The PR is ready for merge by the caretaker label Sep 18, 2019
arnehoek pushed a commit to arnehoek/angular that referenced this pull request Sep 26, 2019
angular#32710)

This sets up the Language Service to support angular#32565.
This PR exposes a `getDirectiveModule` method on `TypeScriptServiceHost`
that returns the NgModule owning a Directive given the Directive's
TypeScript node or its Angular `StaticSymbol`. Both types are supported
to reduce extraneous helper methods.

PR Close angular#32710
@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 Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: language-service Issues related to Angular's VS Code language service cla: yes feature Issue that requests a new feature target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants