fix(language-service): Remove getTemplateReferences() from LanguageService API (#33807)
The method `getTemplateReferences()` appears in both the LanguageService interface and LanguageServiceHost interface. It should belong in the latter and not the former, since the former deals with the semantics of the language and not the mechanics. PR Close #33807
This commit is contained in:

committed by
Alex Rickabaugh

parent
7c64b1889f
commit
c365eded5b
@ -28,11 +28,6 @@ export function createLanguageService(host: TypeScriptServiceHost): LanguageServ
|
||||
class LanguageServiceImpl implements LanguageService {
|
||||
constructor(private readonly host: TypeScriptServiceHost) {}
|
||||
|
||||
getTemplateReferences(): string[] {
|
||||
this.host.getAnalyzedModules(); // same role as 'synchronizeHostData'
|
||||
return this.host.getTemplateReferences();
|
||||
}
|
||||
|
||||
getDiagnostics(fileName: string): tss.Diagnostic[] {
|
||||
const analyzedModules = this.host.getAnalyzedModules(); // same role as 'synchronizeHostData'
|
||||
const results: Diagnostic[] = [];
|
||||
|
@ -44,7 +44,6 @@ export function getExternalFiles(project: tss.server.Project): string[] {
|
||||
// Without an Angular host there is no way to get template references.
|
||||
return [];
|
||||
}
|
||||
ngLSHost.getAnalyzedModules();
|
||||
const templates = ngLSHost.getTemplateReferences();
|
||||
const logger = project.projectService.logger;
|
||||
if (logger.hasLevel(tss.server.LogLevel.verbose)) {
|
||||
|
@ -394,11 +394,6 @@ export interface Hover {
|
||||
* @publicApi
|
||||
*/
|
||||
export interface LanguageService {
|
||||
/**
|
||||
* Returns a list of all the external templates referenced by the project.
|
||||
*/
|
||||
getTemplateReferences(): string[];
|
||||
|
||||
/**
|
||||
* Returns a list of all error for all templates in the given file.
|
||||
*/
|
||||
|
@ -144,7 +144,10 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
return this.resolver.getReflector() as StaticReflector;
|
||||
}
|
||||
|
||||
getTemplateReferences(): string[] { return [...this.templateReferences]; }
|
||||
getTemplateReferences(): string[] {
|
||||
this.getAnalyzedModules();
|
||||
return [...this.templateReferences];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the program has changed and returns all analyzed modules.
|
||||
|
Reference in New Issue
Block a user