mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
fix #136731
This commit is contained in:
@@ -146,57 +146,44 @@ export class ExtHostOutputService implements ExtHostOutputServiceShape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createExtHostOutputChannel(name: string, channelPromise: Promise<ExtHostOutputChannel>, extensionDescription: IExtensionDescription): vscode.OutputChannel {
|
private createExtHostOutputChannel(name: string, channelPromise: Promise<ExtHostOutputChannel>, extensionDescription: IExtensionDescription): vscode.OutputChannel {
|
||||||
const validate = (channel: ExtHostOutputChannel, checkProposedApi?: boolean) => {
|
let disposed = false;
|
||||||
|
const validate = (checkProposedApi?: boolean) => {
|
||||||
if (checkProposedApi) {
|
if (checkProposedApi) {
|
||||||
checkProposedApiEnabled(extensionDescription);
|
checkProposedApiEnabled(extensionDescription);
|
||||||
}
|
}
|
||||||
if (channel.disposed) {
|
if (disposed) {
|
||||||
throw new Error('Channel has been closed');
|
throw new Error('Channel has been closed');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
get name(): string { return name; },
|
get name(): string { return name; },
|
||||||
append(value: string): void {
|
append(value: string): void {
|
||||||
channelPromise.then(channel => {
|
validate();
|
||||||
validate(channel);
|
channelPromise.then(channel => channel.append(value));
|
||||||
channel.append(value);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
appendLine(value: string): void {
|
appendLine(value: string): void {
|
||||||
channelPromise.then(channel => {
|
validate();
|
||||||
validate(channel);
|
channelPromise.then(channel => channel.appendLine(value));
|
||||||
channel.appendLine(value);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
clear(): void {
|
clear(): void {
|
||||||
channelPromise.then(channel => {
|
validate();
|
||||||
validate(channel);
|
channelPromise.then(channel => channel.clear());
|
||||||
channel.clear();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
replace(value: string): void {
|
replace(value: string): void {
|
||||||
channelPromise.then(channel => {
|
validate(true);
|
||||||
validate(channel, true);
|
channelPromise.then(channel => channel.replace(value));
|
||||||
channel.replace(value);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
show(columnOrPreserveFocus?: vscode.ViewColumn | boolean, preserveFocus?: boolean): void {
|
show(columnOrPreserveFocus?: vscode.ViewColumn | boolean, preserveFocus?: boolean): void {
|
||||||
channelPromise.then(channel => {
|
validate();
|
||||||
validate(channel);
|
channelPromise.then(channel => channel.show(columnOrPreserveFocus, preserveFocus));
|
||||||
channel.show(columnOrPreserveFocus, preserveFocus);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
hide(): void {
|
hide(): void {
|
||||||
channelPromise.then(channel => {
|
validate();
|
||||||
validate(channel);
|
channelPromise.then(channel => channel.hide());
|
||||||
channel.hide();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
dispose(): void {
|
dispose(): void {
|
||||||
channelPromise.then(channel => {
|
disposed = true;
|
||||||
validate(channel);
|
channelPromise.then(channel => channel.dispose());
|
||||||
channel.dispose();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user