Skip to content

Commit

Permalink
refactor(language-service): rename host to tsLsHost
Browse files Browse the repository at this point in the history
Disambiguate the name of the Language Service Host used in constructing
a TypeScript Language Service Host by renaming the `host` property to
`tsLsHost`.
  • Loading branch information
ayazhafiz committed Aug 29, 2019
1 parent 97fc45f commit 3d5dc86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/language-service/src/language_service.ts
Expand Up @@ -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);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions packages/language-service/src/typescript_host.ts
Expand Up @@ -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; },
Expand All @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3d5dc86

Please sign in to comment.