Merge pull request #22136 from Microsoft/moduleResolution

Use cache for the non-relative module resolution and enhance the watches for failed lookup locations
This commit is contained in:
Sheetal Nandi
2018-02-28 14:39:22 -08:00
committed by GitHub
17 changed files with 491 additions and 96 deletions

View File

@@ -210,6 +210,9 @@ namespace ts.server {
/*@internal*/
public directoryStructureHost: DirectoryStructureHost;
/*@internal*/
public readonly getCanonicalFileName: GetCanonicalFileName;
/*@internal*/
constructor(
/*@internal*/readonly projectName: string,
@@ -224,6 +227,7 @@ namespace ts.server {
currentDirectory: string | undefined) {
this.directoryStructureHost = directoryStructureHost;
this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory || "");
this.getCanonicalFileName = this.projectService.toCanonicalFileName;
this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
if (!this.compilerOptions) {
@@ -238,7 +242,10 @@ namespace ts.server {
this.setInternalCompilerOptionsForEmittingJsFiles();
const host = this.projectService.host;
if (host.trace) {
if (this.projectService.logger.loggingEnabled()) {
this.trace = s => this.writeLog(s);
}
else if (host.trace) {
this.trace = s => host.trace(s);
}