mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
Fixing cancellation errors for TS. Fixes #28501
This commit is contained in:
parent
78250b41d2
commit
01fa0b83e9
|
@ -497,7 +497,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||||
args.push('--enableTelemetry');
|
args.push('--enableTelemetry');
|
||||||
}
|
}
|
||||||
if (this.apiVersion.has222Features()) {
|
if (this.apiVersion.has222Features()) {
|
||||||
this.cancellationPipeName = electron.getPipeName(`tscancellation-${electron.makeRandomHexString(20)}`);
|
this.cancellationPipeName = electron.getTempFile(`tscancellation-${electron.makeRandomHexString(20)}`);
|
||||||
args.push('--cancellationPipeName', this.cancellationPipeName + '*');
|
args.push('--cancellationPipeName', this.cancellationPipeName + '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,7 +947,11 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||||
|
|
||||||
if (this.apiVersion.has222Features() && this.cancellationPipeName) {
|
if (this.apiVersion.has222Features() && this.cancellationPipeName) {
|
||||||
this.tracer.logTrace(`TypeScript Service: trying to cancel ongoing request with sequence number ${seq}`);
|
this.tracer.logTrace(`TypeScript Service: trying to cancel ongoing request with sequence number ${seq}`);
|
||||||
|
try {
|
||||||
fs.writeFileSync(this.cancellationPipeName + seq, '');
|
fs.writeFileSync(this.cancellationPipeName + seq, '');
|
||||||
|
} catch (e) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,7 @@ export function makeRandomHexString(length: number): string {
|
||||||
function generatePipeName(): string {
|
function generatePipeName(): string {
|
||||||
return getPipeName(makeRandomHexString(40));
|
return getPipeName(makeRandomHexString(40));
|
||||||
}
|
}
|
||||||
|
function getPipeName(name: string): string {
|
||||||
export function getPipeName(name: string): string {
|
|
||||||
const fullName = 'vscode-' + name;
|
const fullName = 'vscode-' + name;
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
return '\\\\.\\pipe\\' + fullName + '-sock';
|
return '\\\\.\\pipe\\' + fullName + '-sock';
|
||||||
|
@ -38,6 +37,11 @@ export function getPipeName(name: string): string {
|
||||||
return path.join(os.tmpdir(), fullName + '.sock');
|
return path.join(os.tmpdir(), fullName + '.sock');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTempFile(name: string): string {
|
||||||
|
const fullName = 'vscode-' + name;
|
||||||
|
return path.join(os.tmpdir(), fullName + '.sock');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function generatePatchedEnv(env: any, stdInPipeName: string, stdOutPipeName: string, stdErrPipeName: string): any {
|
function generatePatchedEnv(env: any, stdInPipeName: string, stdOutPipeName: string, stdErrPipeName: string): any {
|
||||||
// Set the two unique pipe names and the electron flag as process env
|
// Set the two unique pipe names and the electron flag as process env
|
||||||
|
|
Loading…
Reference in a new issue