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
commit a3853d0774
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 {

View File

@ -7091,6 +7091,7 @@ declare namespace ts.server {
*/
private projectStateVersion;
private typingFiles;
private readonly cancellationToken;
isNonTsProject(): boolean;
isJsOnlyProject(): boolean;
getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap;
@ -7103,7 +7104,7 @@ declare namespace ts.server {
getScriptKind(fileName: string): ScriptKind;
getScriptVersion(filename: string): string;
getScriptSnapshot(filename: string): IScriptSnapshot;
getCancellationToken(): HostCancellationToken;
getCancellationToken(): ThrottledCancellationToken;
getCurrentDirectory(): string;
getDefaultLibFileName(): string;
useCaseSensitiveFileNames(): boolean;