diff --git a/packages/extension/package.json b/packages/extension/package.json index a44dc27b..044355c6 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -989,7 +989,8 @@ "sqltoolsPanelContainer": [ { "id": "sqltoolsViewConsoleMessages", - "name": "Messages" + "name": "Messages", + "when": "sqltools.consoleMessages.active" } ] }, diff --git a/packages/plugins/connection-manager/explorer/index.ts b/packages/plugins/connection-manager/explorer/index.ts index 1f55c399..d939068d 100644 --- a/packages/plugins/connection-manager/explorer/index.ts +++ b/packages/plugins/connection-manager/explorer/index.ts @@ -234,6 +234,7 @@ export class ConnectionExplorer implements TreeDataProvider, Tr export class MessagesProvider implements TreeDataProvider { private items: TreeItem[] = []; + private active: boolean = false; private _onDidChangeTreeData: EventEmitter = new EventEmitter(); public readonly onDidChangeTreeData = this._onDidChangeTreeData.event; getTreeItem(element: TreeItem): TreeItem | Thenable { @@ -249,6 +250,10 @@ export class MessagesProvider implements TreeDataProvider { } addMessages = (messages: NSDatabase.IResult['messages'] = []) => { + if (!this.active && messages.length > 0) { + this.active = true; + commands.executeCommand('setContext', `${EXT_NAMESPACE}.consoleMessages.active`, true); + } this.items = messages.map(m => { let item: TreeItem; if (typeof m === 'string') {