refactor(language-service): rename `host` to `tsLsHost` (#32346)

Disambiguate the name of the Language Service Host used in constructing
a TypeScript Language Service Host by renaming the `host` property to
`tsLsHost`.

PR Close #32346
This commit is contained in:
ayazhafiz 2019-08-27 09:51:40 -05:00 committed by Misko Hevery
parent 3aba7ebe6a
commit 47a4edb817
2 changed files with 6 additions and 5 deletions

View File

@ -86,7 +86,7 @@ class LanguageServiceImpl implements LanguageService {
if (fileName.endsWith('.ts')) {
const sf = this.host.getSourceFile(fileName);
if (sf) {
return getTsDefinitionAndBoundSpan(sf, position, this.host.host);
return getTsDefinitionAndBoundSpan(sf, position, this.host.tsLsHost);
}
}
}

View File

@ -72,7 +72,8 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
ngModules: [],
};
constructor(readonly host: ts.LanguageServiceHost, private readonly tsLS: ts.LanguageService) {
constructor(
readonly tsLsHost: ts.LanguageServiceHost, private readonly tsLS: ts.LanguageService) {
this.summaryResolver = new AotSummaryResolver(
{
loadSummary(filePath: string) { return null; },
@ -81,7 +82,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
fromSummaryFileName(filePath: string): string{return filePath;},
},
this.staticSymbolCache);
this.reflectorHost = new ReflectorHost(() => this.program, host);
this.reflectorHost = new ReflectorHost(() => this.program, tsLsHost);
this.staticSymbolResolver = new StaticSymbolResolver(
this.reflectorHost, this.staticSymbolCache, this.summaryResolver,
(e, filePath) => this.collectError(e, filePath));
@ -277,7 +278,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
for (const sourceFile of program.getSourceFiles()) {
const fileName = sourceFile.fileName;
seen.add(fileName);
const version = this.host.getScriptVersion(fileName);
const version = this.tsLsHost.getScriptVersion(fileName);
const lastVersion = this.fileVersions.get(fileName);
if (version !== lastVersion) {
this.fileVersions.set(fileName, version);
@ -333,7 +334,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
*/
private getExternalTemplate(fileName: string): TemplateSource|undefined {
// First get the text for the template
const snapshot = this.host.getScriptSnapshot(fileName);
const snapshot = this.tsLsHost.getScriptSnapshot(fileName);
if (!snapshot) {
return;
}