Merge pull request #18934 from Microsoft/throttledCancellation

Wrap the cancellation token in throttled cancellation token from server
This commit is contained in:
Sheetal Nandi
2017-10-03 17:10:38 -07:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -167,6 +167,8 @@ namespace ts.server {
private typingFiles: SortedReadonlyArray<string>;
private readonly cancellationToken: ThrottledCancellationToken;
public isNonTsProject() {
this.updateGraph();
return allFilesAreJsOrDts(this);
@@ -206,6 +208,7 @@ namespace ts.server {
/*@internal*/public directoryStructureHost: DirectoryStructureHost,
rootDirectoryForResolution: string | undefined) {
this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
if (!this.compilerOptions) {
this.compilerOptions = getDefaultCompilerOptions();
this.compilerOptions.allowNonTsExtensions = true;
@@ -294,7 +297,7 @@ namespace ts.server {
}
getCancellationToken() {
return this.projectService.cancellationToken;
return this.cancellationToken;
}
getCurrentDirectory(): string {