From 69ba834cfc9cc035e1ef9276449d5b1e2bb97f3a Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Fri, 22 Nov 2024 15:53:32 +0100 Subject: [PATCH 1/3] fix: show export to language icon only when copilot is active VSCODE-655 --- package.json | 2 +- src/mdbExtensionController.ts | 15 +++++++++++++++ 2 files changed, 16 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..fdebfab82 100644 --- a/src/mdbExtensionController.ts +++ b/src/mdbExtensionController.ts @@ -168,6 +168,21 @@ 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 + ); + + vscode.extensions.onDidChange(() => { + void vscode.commands.executeCommand( + 'setContext', + 'mdb.isCopilotActive', + copilot?.isActive + ); + }); } registerCommands = (): void => { From 243fdd2b795b7b201d7c6f36bd387ac11a54e00b Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Fri, 22 Nov 2024 16:10:07 +0100 Subject: [PATCH 2/3] test: increase timeout for manipulations with a file --- src/test/suite/participant/participant.test.ts | 2 ++ 1 file changed, 2 insertions(+) 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' From f8af0abd57f63c45eca75d53026950c476836c9a Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Fri, 22 Nov 2024 16:41:25 +0100 Subject: [PATCH 3/3] refactor: remove vscode.extensions.onDidChange --- src/mdbExtensionController.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/mdbExtensionController.ts b/src/mdbExtensionController.ts index fdebfab82..f4f73262d 100644 --- a/src/mdbExtensionController.ts +++ b/src/mdbExtensionController.ts @@ -175,14 +175,6 @@ export default class MDBExtensionController implements vscode.Disposable { 'mdb.isCopilotActive', copilot?.isActive ); - - vscode.extensions.onDidChange(() => { - void vscode.commands.executeCommand( - 'setContext', - 'mdb.isCopilotActive', - copilot?.isActive - ); - }); } registerCommands = (): void => {