Skip to content

Commit 7a8f47e

Browse files
authored
Hide Amazon Q and CodeCatalyst views in Sagemaker (#4129)
Hides Amazon Q and CodeCatalyst nodes **_AFTER THE EXTENSION IS ACTIVATED_**. * This will not hide them before load, at the very least there will be a pop-in for the views. * Depending on how much of the VS Code codebase SageMaker is willing to modify: * SageMaker can permanently disable the icon by setting a `aws.isSageMaker` [when clause context](https://code.visualstudio.com/api/references/when-clause-contexts) to `true` * SageMaker can also force the extension to load on open, which will slow load time for the IDE but will make the icons and menus pop out faster. * This also prevents loading their code, which should speed up extension load
1 parent 1e81474 commit 7a8f47e

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

docs/develop.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ We set the following keys:
2828
nodejs (i.e. the environment has no "compute").
2929
- Compare to `isWeb`, which vscode defines when the _UI_ is web, but says nothing about the
3030
_extension host_.
31+
- `aws.isSageMaker`: AWS Toolkit is running in the SageMaker Code Editor.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@
725725
"type": "webview",
726726
"id": "aws.AmazonQChatView",
727727
"name": "%AWS.amazonq.chat%",
728-
"when": "!isCloud9"
728+
"when": "!isCloud9 && !aws.isSageMaker"
729729
},
730730
{
731731
"id": "aws.AmazonQNeverShowBadge",
@@ -737,7 +737,7 @@
737737
{
738738
"id": "aws.amazonq",
739739
"name": "%AWS.amazonq.title%",
740-
"when": "!isCloud9"
740+
"when": "!isCloud9 && !aws.isSageMaker"
741741
},
742742
{
743743
"id": "aws.codewhisperer",
@@ -755,7 +755,7 @@
755755
{
756756
"id": "aws.codecatalyst",
757757
"name": "%AWS.codecatalyst.explorerTitle%",
758-
"when": "!isCloud9 || isCloud9CodeCatalyst"
758+
"when": "!isCloud9 && !aws.isSageMaker || isCloud9CodeCatalyst"
759759
}
760760
],
761761
"aws-codewhisperer-reference-log": [

src/extension.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,12 @@ export async function activate(context: vscode.ExtensionContext) {
211211
)
212212

213213
// do not enable codecatalyst for sagemaker
214+
// TODO: remove setContext if SageMaker adds the context to their IDE
214215
if (!isSageMaker()) {
216+
vscode.commands.executeCommand('setContext', 'aws.isSageMaker', false)
215217
await codecatalyst.activate(extContext)
218+
} else {
219+
vscode.commands.executeCommand('setContext', 'aws.isSageMaker', true)
216220
}
217221

218222
await activateCloudFormationTemplateRegistry(context)
@@ -256,8 +260,10 @@ export async function activate(context: vscode.ExtensionContext) {
256260
await activateSchemas(extContext)
257261

258262
if (!isCloud9()) {
259-
await activateCWChat(extContext.extensionContext)
260-
await activateQGumby(extContext)
263+
if (!isSageMaker()) {
264+
await activateCWChat(extContext.extensionContext)
265+
await activateQGumby(extContext)
266+
}
261267
await activateApplicationComposer(context)
262268
}
263269

0 commit comments

Comments
 (0)