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

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 Close #32710
This commit is contained in:
ayazhafiz
2019-09-16 22:33:48 -05:00
committed by Andrew Kushnir
parent ab29874f09
commit 2846505dbd
2 changed files with 28 additions and 0 deletions

View File

@ -441,6 +441,14 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
return astResult;
}
/**
* Gets a StaticSymbol from a file and symbol name.
* @return Angular StaticSymbol matching the file and name, if any
*/
getStaticSymbol(file: string, name: string): StaticSymbol|undefined {
return this.reflector.getStaticSymbol(file, name);
}
/**
* Find the NgModule which the directive associated with the `classSymbol`
* belongs to, then return its schema and transitive directives and pipes.