提交 96700602 编写于 作者: M Matt Bierner

Make sure we never cancel a request to just one of the ts servers

Fixes #76143
上级 53f050c0
...@@ -357,8 +357,34 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ ...@@ -357,8 +357,34 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ
return this.syntaxServer.executeImpl(command, args, executeInfo); return this.syntaxServer.executeImpl(command, args, executeInfo);
} else if (SyntaxRoutingTsServer.sharedCommands.has(command)) { } else if (SyntaxRoutingTsServer.sharedCommands.has(command)) {
// Dispatch to both server but only return from syntax one // Dispatch to both server but only return from syntax one
this.semanticServer.executeImpl(command, args, executeInfo);
return this.syntaxServer.executeImpl(command, args, executeInfo); // Also make sure we never cancel requests to just one server
let hasCompletedSyntax = false;
let hasCompletedSemantic = false;
let token: vscode.CancellationToken | undefined = undefined;
if (executeInfo.token) {
const source = new vscode.CancellationTokenSource();
executeInfo.token.onCancellationRequested(() => {
if (hasCompletedSyntax && !hasCompletedSemantic || hasCompletedSemantic && !hasCompletedSyntax) {
// Don't cancel.
// One of the servers completed this request so we don't want to leave the other
// in a different state
return;
}
source.cancel();
});
token = source.token;
}
const semanticRequest = this.semanticServer.executeImpl(command, args, { ...executeInfo, token });
if (semanticRequest) {
semanticRequest.finally(() => { hasCompletedSemantic = true; });
}
const syntaxRequest = this.syntaxServer.executeImpl(command, args, { ...executeInfo, token });
if (syntaxRequest) {
syntaxRequest.finally(() => { hasCompletedSyntax = true; });
}
return syntaxRequest;
} else { } else {
return this.semanticServer.executeImpl(command, args, executeInfo); return this.semanticServer.executeImpl(command, args, executeInfo);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册