diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index d6901a1c2be..b36f0bfb25e 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -35,18 +35,22 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { } append(value: string): void { + this.validate(); this._proxy.$append(this._id, this._name, value); } appendLine(value: string): void { + this.validate(); this.append(value + '\n'); } clear(): void { + this.validate(); this._proxy.$clear(this._id, this._name); } show(columnOrPreserveFocus?: vscode.ViewColumn | boolean, preserveFocus?: boolean): void { + this.validate(); if (typeof columnOrPreserveFocus === 'boolean') { preserveFocus = columnOrPreserveFocus; } @@ -55,8 +59,15 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { } hide(): void { + this.validate(); this._proxy.$close(this._id); } + + private validate(): void { + if (this._disposed) { + throw new Error('Channel has been closed'); + } + } } export class ExtHostOutputService {