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:
parent
3aba7ebe6a
commit
47a4edb817
|
@ -86,7 +86,7 @@ class LanguageServiceImpl implements LanguageService {
|
||||||
if (fileName.endsWith('.ts')) {
|
if (fileName.endsWith('.ts')) {
|
||||||
const sf = this.host.getSourceFile(fileName);
|
const sf = this.host.getSourceFile(fileName);
|
||||||
if (sf) {
|
if (sf) {
|
||||||
return getTsDefinitionAndBoundSpan(sf, position, this.host.host);
|
return getTsDefinitionAndBoundSpan(sf, position, this.host.tsLsHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,8 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||||
ngModules: [],
|
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(
|
this.summaryResolver = new AotSummaryResolver(
|
||||||
{
|
{
|
||||||
loadSummary(filePath: string) { return null; },
|
loadSummary(filePath: string) { return null; },
|
||||||
|
@ -81,7 +82,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||||
fromSummaryFileName(filePath: string): string{return filePath;},
|
fromSummaryFileName(filePath: string): string{return filePath;},
|
||||||
},
|
},
|
||||||
this.staticSymbolCache);
|
this.staticSymbolCache);
|
||||||
this.reflectorHost = new ReflectorHost(() => this.program, host);
|
this.reflectorHost = new ReflectorHost(() => this.program, tsLsHost);
|
||||||
this.staticSymbolResolver = new StaticSymbolResolver(
|
this.staticSymbolResolver = new StaticSymbolResolver(
|
||||||
this.reflectorHost, this.staticSymbolCache, this.summaryResolver,
|
this.reflectorHost, this.staticSymbolCache, this.summaryResolver,
|
||||||
(e, filePath) => this.collectError(e, filePath));
|
(e, filePath) => this.collectError(e, filePath));
|
||||||
|
@ -277,7 +278,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||||
for (const sourceFile of program.getSourceFiles()) {
|
for (const sourceFile of program.getSourceFiles()) {
|
||||||
const fileName = sourceFile.fileName;
|
const fileName = sourceFile.fileName;
|
||||||
seen.add(fileName);
|
seen.add(fileName);
|
||||||
const version = this.host.getScriptVersion(fileName);
|
const version = this.tsLsHost.getScriptVersion(fileName);
|
||||||
const lastVersion = this.fileVersions.get(fileName);
|
const lastVersion = this.fileVersions.get(fileName);
|
||||||
if (version !== lastVersion) {
|
if (version !== lastVersion) {
|
||||||
this.fileVersions.set(fileName, version);
|
this.fileVersions.set(fileName, version);
|
||||||
|
@ -333,7 +334,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||||
*/
|
*/
|
||||||
private getExternalTemplate(fileName: string): TemplateSource|undefined {
|
private getExternalTemplate(fileName: string): TemplateSource|undefined {
|
||||||
// First get the text for the template
|
// First get the text for the template
|
||||||
const snapshot = this.host.getScriptSnapshot(fileName);
|
const snapshot = this.tsLsHost.getScriptSnapshot(fileName);
|
||||||
if (!snapshot) {
|
if (!snapshot) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue