feat(language-service): allow retreiving synchronized analyzed NgModules (#32779)
Sometimes modules retreived from the language service need to be synchronized to the last time they were updated, and not updated on-the-fly. This PR adds a flag to `TypeScriptServiceHost#getAnalyzedModules` that retreives cached analyzed NgModules rather than potentially recomputing them. PR Close #32779
This commit is contained in:
@ -152,9 +152,13 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
* and templateReferences.
|
||||
* In addition to returning information about NgModules, this method plays the
|
||||
* same role as 'synchronizeHostData' in tsserver.
|
||||
* @param ensureSynchronized whether or not the Language Service should make sure analyzedModules
|
||||
* are synced to the last update of the project. If false, returns the set of analyzedModules
|
||||
* that is already cached. This is useful if the project must not be reanalyzed, even if its
|
||||
* file watchers (which are disjoint from the TypeScriptServiceHost) detect an update.
|
||||
*/
|
||||
getAnalyzedModules(): NgAnalyzedModules {
|
||||
if (this.upToDate()) {
|
||||
getAnalyzedModules(ensureSynchronized = true): NgAnalyzedModules {
|
||||
if (!ensureSynchronized || this.upToDate()) {
|
||||
return this.analyzedModules;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user