From 9c9a7223ed39e11adfe2db6450cfe72c01d9c7be Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Mon, 25 Nov 2024 10:57:38 +0100 Subject: [PATCH] fix: show export to language icon only when copilot is active VSCODE-655 (#882) * fix: show export to language icon only when copilot is active VSCODE-655 * test: increase timeout for manipulations with a file * refactor: remove vscode.extensions.onDidChange --- package.json | 2 +- src/mdbExtensionController.ts | 7 +++++++ src/test/suite/participant/participant.test.ts | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index aa670b06c..22a9633aa 100644 --- a/package.json +++ b/package.json @@ -724,7 +724,7 @@ { "command": "mdb.selectTargetForExportToLanguage", "group": "navigation@1", - "when": "mdb.isPlayground == true" + "when": "mdb.isPlayground == true && mdb.isCopilotActive == true" }, { "command": "mdb.runPlayground", diff --git a/src/mdbExtensionController.ts b/src/mdbExtensionController.ts index 55ec199f4..f4f73262d 100644 --- a/src/mdbExtensionController.ts +++ b/src/mdbExtensionController.ts @@ -168,6 +168,13 @@ export default class MDBExtensionController implements vscode.Disposable { this.showOverviewPageIfRecentlyInstalled(); void this.showSurveyForEstablishedUsers(); void this.showCopilotIntroductionForEstablishedUsers(); + + const copilot = vscode.extensions.getExtension('GitHub.copilot'); + void vscode.commands.executeCommand( + 'setContext', + 'mdb.isCopilotActive', + copilot?.isActive + ); } registerCommands = (): void => { diff --git a/src/test/suite/participant/participant.test.ts b/src/test/suite/participant/participant.test.ts index 5be22ddf5..ce89bf105 100644 --- a/src/test/suite/participant/participant.test.ts +++ b/src/test/suite/participant/participant.test.ts @@ -1698,6 +1698,8 @@ Schema: }); suite('export to playground', function () { + this.timeout(5000); + beforeEach(async function () { await vscode.commands.executeCommand( 'workbench.action.files.newUntitledFile'