mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Merge pull request #18934 from Microsoft/throttledCancellation
Wrap the cancellation token in throttled cancellation token from server
This commit is contained in:
commit
a3853d0774
@ -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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user