Skip to content

Commit 0726fc3

Browse files
Merge functional changes from 1.7 branch (excluding July 25 commits)
2 parents 0edf6bb + 31e82a2 commit 0726fc3

File tree

11 files changed

+290
-24
lines changed

11 files changed

+290
-24
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Check CSP configuration in webClientServer.ts
3232
run: |
3333
TARGET_FILE="patched-vscode/src/vs/server/node/webClientServer.ts"
34-
REQUIRED_TEXT="'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://*.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;'"
34+
REQUIRED_TEXT="'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://openvsxorg.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;'"
3535
3636
if [ ! -f "$TARGET_FILE" ]; then
3737
echo "❌ FAIL: Target file $TARGET_FILE does not exist."

patched-vscode/build/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,9 +2567,9 @@ supports-color@^7.1.0:
25672567
has-flag "^4.0.0"
25682568

25692569
tar-fs@^2.0.0:
2570-
version "2.1.2"
2571-
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.2.tgz#425f154f3404cb16cb8ff6e671d45ab2ed9596c5"
2572-
integrity sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==
2570+
version "2.1.3"
2571+
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.3.tgz#fb3b8843a26b6f13a08e606f7922875eb1fbbf92"
2572+
integrity sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg==
25732573
dependencies:
25742574
chownr "^1.1.1"
25752575
mkdirp-classic "^0.5.2"

patched-vscode/extensions/post-startup-notifications/src/extension.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ import { POST_START_UP_STATUS_FILE, SERVICE_NAME_ENV_KEY, SERVICE_NAME_ENV_VALUE
44
import { StatusFile } from './types';
55
import * as chokidar from 'chokidar';
66

7+
// Simple method to check if user has seen a notification
8+
function hasUserSeen(context: vscode.ExtensionContext, notificationId: string): boolean {
9+
return context.globalState.get(`notification_seen_${notificationId}`) === true;
10+
}
11+
12+
// Simple method to mark notification as seen
13+
function markAsSeen(context: vscode.ExtensionContext, notificationId: string): void {
14+
context.globalState.update(`notification_seen_${notificationId}`, true);
15+
}
716

817
let previousStatus: string | undefined;
918
let watcher: chokidar.FSWatcher;
@@ -18,6 +27,9 @@ export function activate(context: vscode.ExtensionContext) {
1827
}
1928

2029
outputChannel = vscode.window.createOutputChannel('SageMaker Unified Studio Post Startup Notifications');
30+
31+
// Show Q CLI notification if user hasn't seen it before
32+
showQCliNotification(context);
2133

2234
try {
2335
watcher = chokidar.watch(POST_START_UP_STATUS_FILE, {
@@ -69,6 +81,31 @@ function processStatusFile() {
6981
}
7082
};
7183

84+
// Show Q CLI notification if user hasn't seen it before
85+
function showQCliNotification(context: vscode.ExtensionContext): void {
86+
const notificationId = 'smus_q_cli_notification';
87+
const message = 'The Amazon Q Command Line Interface (CLI) is installed. You can now access AI-powered assistance in your terminal.';
88+
const link = 'https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/q-actions.html';
89+
const linkLabel = 'Learn More';
90+
91+
if (!hasUserSeen(context, notificationId)) {
92+
outputChannel.appendLine("User has not seen the notification")
93+
// Show notification with Learn More button
94+
vscode.window.showInformationMessage(
95+
message,
96+
{ modal: false },
97+
{ title: linkLabel, isCloseAffordance: false }
98+
).then((selection) => {
99+
if (selection && selection.title === linkLabel) {
100+
vscode.env.openExternal(vscode.Uri.parse(link));
101+
}
102+
103+
// Mark as seen regardless of which button was clicked
104+
markAsSeen(context, notificationId);
105+
});
106+
}
107+
}
108+
72109
export function deactivate() {
73110
if (watcher) {
74111
watcher.close();
@@ -77,4 +114,4 @@ export function deactivate() {
77114
if (outputChannel) {
78115
outputChannel.dispose();
79116
}
80-
}
117+
}

patched-vscode/extensions/post-startup-notifications/src/test/extension.test.ts

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ interface MockFSWatcher extends chokidar.FSWatcher {
1515
jest.mock('vscode', () => ({
1616
window: {
1717
showErrorMessage: jest.fn(),
18-
showInformationMessage: jest.fn(),
18+
showInformationMessage: jest.fn().mockReturnValue(Promise.resolve()),
1919
createOutputChannel: jest.fn()
20+
},
21+
env: {
22+
openExternal: jest.fn()
23+
},
24+
Uri: {
25+
parse: jest.fn(url => ({ toString: () => url }))
2026
}
2127
}));
2228

@@ -32,8 +38,15 @@ describe('SageMaker Unified Studio Extension Tests', () => {
3238
// Reset mocks
3339
jest.resetAllMocks();
3440

35-
// Setup context
36-
mockContext = { subscriptions: [] } as any;
41+
// Setup context with globalState for storage
42+
mockContext = {
43+
subscriptions: [],
44+
globalState: {
45+
get: jest.fn(),
46+
update: jest.fn(),
47+
keys: jest.fn().mockReturnValue([])
48+
}
49+
} as any;
3750

3851
// Setup watcher
3952
mockWatcher = {
@@ -189,6 +202,59 @@ describe('SageMaker Unified Studio Extension Tests', () => {
189202
});
190203
});
191204

205+
describe('Q CLI Notification Tests', () => {
206+
test('should show Q CLI notification with Learn More button', () => {
207+
// Set up globalState to simulate first-time user
208+
(mockContext.globalState.get as jest.Mock).mockReturnValue(undefined);
209+
210+
activate(mockContext);
211+
212+
// Verify notification is shown with correct message and button
213+
expect(vscode.window.showInformationMessage).toHaveBeenCalledWith(
214+
'The Amazon Q Command Line Interface (CLI) is installed. You can now access AI-powered assistance in your terminal.',
215+
{ modal: false },
216+
{ title: 'Learn More', isCloseAffordance: false }
217+
);
218+
});
219+
220+
test('should open documentation when Learn More is clicked', async () => {
221+
// Set up globalState to simulate first-time user
222+
(mockContext.globalState.get as jest.Mock).mockReturnValue(undefined);
223+
224+
// Mock the user clicking "Learn More"
225+
const mockSelection = { title: 'Learn More' };
226+
(vscode.window.showInformationMessage as jest.Mock).mockReturnValue(Promise.resolve(mockSelection));
227+
228+
activate(mockContext);
229+
230+
// Wait for the promise to resolve
231+
await new Promise(process.nextTick);
232+
233+
// Verify the documentation link is opened
234+
expect(vscode.env.openExternal).toHaveBeenCalledWith(
235+
expect.objectContaining({
236+
toString: expect.any(Function)
237+
})
238+
);
239+
240+
// Verify notification is marked as seen
241+
expect(mockContext.globalState.update).toHaveBeenCalledWith(
242+
'notification_seen_smus_q_cli_notification',
243+
true
244+
);
245+
});
246+
247+
test('should not show notification if already seen', () => {
248+
// Set up globalState to simulate returning user who has seen notification
249+
(mockContext.globalState.get as jest.Mock).mockReturnValue(true);
250+
251+
activate(mockContext);
252+
253+
// Verify notification is not shown again
254+
expect(vscode.window.showInformationMessage).not.toHaveBeenCalled();
255+
});
256+
});
257+
192258
describe('Deactivation Tests', () => {
193259
test('should cleanup resources properly', () => {
194260
activate(mockContext);
@@ -198,4 +264,4 @@ describe('SageMaker Unified Studio Extension Tests', () => {
198264
expect(mockOutputChannel.dispose).toHaveBeenCalled();
199265
});
200266
});
201-
});
267+
});

patched-vscode/remote/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ strip-json-comments@~2.0.1:
587587
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
588588

589589
tar-fs@^2.0.0:
590-
version "2.1.2"
591-
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.2.tgz#425f154f3404cb16cb8ff6e671d45ab2ed9596c5"
592-
integrity sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==
590+
version "2.1.3"
591+
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.3.tgz#fb3b8843a26b6f13a08e606f7922875eb1fbbf92"
592+
integrity sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg==
593593
dependencies:
594594
chownr "^1.1.1"
595595
mkdirp-classic "^0.5.2"

patched-vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { getServiceMachineId } from 'vs/platform/externalServices/common/service
1616
import { IStorageService } from 'vs/platform/storage/common/storage';
1717
import { TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
1818
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
19-
import { RemoteAuthorities } from 'vs/base/common/network';
2019
import { TargetPlatform } from 'vs/platform/extensions/common/extensions';
2120

2221
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
@@ -141,9 +140,9 @@ export abstract class AbstractExtensionResourceLoaderService implements IExtensi
141140
}
142141

143142
protected _isWebExtensionResourceEndPoint(uri: URI): boolean {
144-
const uriPath = uri.path, serverRootPath = RemoteAuthorities.getServerRootPath();
145-
// test if the path starts with the server root path followed by the web extension resource end point segment
146-
return uriPath.startsWith(serverRootPath) && uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT, serverRootPath.length);
143+
const uriPath = uri.path;
144+
// test if the path starts with the web extension resource end point segment
145+
return uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT);
147146
}
148147

149148
}

patched-vscode/src/vs/server/node/webClientServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export class WebClientServer {
398398
`frame-src 'self' https://*.vscode-cdn.net data:;`,
399399
'worker-src \'self\' data: blob:;',
400400
'style-src \'self\' \'unsafe-inline\';',
401-
'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://*.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;',
401+
'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://openvsxorg.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;',
402402
'font-src \'self\' blob:;',
403403
'manifest-src \'self\';'
404404
].join(' ');

patches/custom-extensions-marketplace.diff

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
9898
===================================================================
9999
--- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts
100100
+++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
101-
@@ -320,14 +320,7 @@ export class WebClientServer {
101+
@@ -331,14 +331,7 @@ export class WebClientServer {
102102
const productConfiguration = {
103103
rootEndpoint: base,
104104
embedderIdentifier: 'server-distro',
@@ -134,3 +134,28 @@ Index: sagemaker-code-editor/vscode/product.json
134134
"linkProtectionTrustedDomains": [
135135
"https://open-vsx.org"
136136
]
137+
Index: sagemaker-code-editor/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
138+
===================================================================
139+
--- sagemaker-code-editor.orig/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
140+
+++ sagemaker-code-editor/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
141+
@@ -16,7 +16,6 @@ import { getServiceMachineId } from 'vs/
142+
import { IStorageService } from 'vs/platform/storage/common/storage';
143+
import { TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
144+
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
145+
-import { RemoteAuthorities } from 'vs/base/common/network';
146+
import { TargetPlatform } from 'vs/platform/extensions/common/extensions';
147+
148+
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
149+
@@ -141,9 +140,9 @@ export abstract class AbstractExtensionR
150+
}
151+
152+
protected _isWebExtensionResourceEndPoint(uri: URI): boolean {
153+
- const uriPath = uri.path, serverRootPath = RemoteAuthorities.getServerRootPath();
154+
- // test if the path starts with the server root path followed by the web extension resource end point segment
155+
- return uriPath.startsWith(serverRootPath) && uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT, serverRootPath.length);
156+
+ const uriPath = uri.path;
157+
+ // test if the path starts with the web extension resource end point segment
158+
+ return uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT);
159+
}
160+
161+
}

patches/display-language.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
326326
'worker-src \'self\' data: blob:;',
327327
'style-src \'self\' \'unsafe-inline\';',
328328
- 'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;',
329-
+ 'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://*.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;',
329+
+ 'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://openvsxorg.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;',
330330
'font-src \'self\' blob:;',
331331
'manifest-src \'self\';'
332332
].join(' ');

0 commit comments

Comments
 (0)