@@ -2,7 +2,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/src/extension
22===================================================================
33--- /dev/null
44+++ sagemaker-code-editor/vscode/extensions/sagemaker-extension/src/extension.ts
5- @@ -0,0 +1,137 @@
5+ @@ -0,0 +1,175 @@
66+ import * as vscode from 'vscode';
77+ import * as fs from 'fs';
88+ import { SessionWarning } from "./sessionWarning";
@@ -23,6 +23,10 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/src/extension
2323+
2424+ const PARSE_SAGEMAKER_COOKIE_COMMAND = 'sagemaker.parseCookies';
2525+
26+ + // Command to enable auto-update for extensions
27+ + // Please ensure backwards compatibility when pulling in new Code OSS version
28+ + const ENABLE_AUTO_UPDATE_COMMAND = 'workbench.extensions.action.enableAutoUpdate';
29+ +
2630+ function showWarningDialog() {
2731+ vscode.commands.executeCommand(PARSE_SAGEMAKER_COOKIE_COMMAND).then(response => {
2832+
@@ -126,6 +130,37 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/src/extension
126130+ });
127131+ }
128132+
133+ + // Render warning message regarding auto upgrade disabled
134+ + function renderExtensionAutoUpdateDisabledNotification() {
135+ + // Get current extension auto disabled config
136+ + const autoUpdateEnabled = vscode.workspace.getConfiguration('extensions').get('autoUpdate');
137+ +
138+ + // Check if customer has choose to disable this notification
139+ + const extensionConfig = vscode.workspace.getConfiguration('sagemaker-extension');
140+ + const showNotificationEnabled = extensionConfig.get('notification.extensionAutoUpdateDisabled', true);
141+ +
142+ + // Only show notification, if auto update is disabled, and customer hasn't opt-out the notification
143+ + if (showNotificationEnabled && autoUpdateEnabled == false) {
144+ + const enableAutoUpdate = 'Enable extension auto-update';
145+ + const doNotShowAgain = 'Do not show again';
146+ + vscode.window.showInformationMessage(
147+ + 'Extension auto-update is disabled. This can be changed in Code Editor settings.',
148+ + enableAutoUpdate,
149+ + doNotShowAgain,
150+ + ).then(response => {
151+ + if (response === enableAutoUpdate) {
152+ + vscode.commands.executeCommand(ENABLE_AUTO_UPDATE_COMMAND)
153+ + } else if (response == doNotShowAgain) {
154+ + extensionConfig.update(
155+ + 'notification.extensionAutoUpdateDisabled',
156+ + false,
157+ + vscode.ConfigurationTarget.Global
158+ + );
159+ + }
160+ + })
161+ + }
162+ + }
163+ +
129164+ export function activate(context: vscode.ExtensionContext) {
130165+
131166+ // TODO: log activation of extension
@@ -139,6 +174,9 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/src/extension
139174+ initialize(sagemakerCookie);
140175+ updateStatusItemWithMetadata(context);
141176+ });
177+ +
178+ + // render warning message regarding auto upgrade disabled
179+ + renderExtensionAutoUpdateDisabledNotification();
142180+ }
143181Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/src/sessionWarning.ts
144182===================================================================
@@ -211,7 +249,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/package.json
211249===================================================================
212250--- /dev/null
213251+++ sagemaker-code-editor/vscode/extensions/sagemaker-extension/package.json
214- @@ -0,0 +1,46 @@
252+ @@ -0,0 +1,52 @@
215253+ {
216254+ "name": "sagemaker-extension",
217255+ "displayName": "Sagemaker Extension",
@@ -241,8 +279,14 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-extension/package.json
241279+ "contributes": {
242280+ "configuration": {
243281+ "type": "object",
244- + "title": "Sagemaker Extension",
245- + "properties": {}
282+ + "title": "SageMaker Extension",
283+ + "properties": {
284+ + "sagemaker-extension.notification.extensionAutoUpdateDisabled": {
285+ + "type": "boolean",
286+ + "default": true,
287+ + "markdownDescription": "Show notification if extension auto-update is disabled"
288+ + }
289+ + }
246290+ },
247291+ "commands": [
248292+ ]
0 commit comments