Skip to content

Commit ae0f2fd

Browse files
committed
add notification
1 parent 470e48b commit ae0f2fd

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

packages/amazonq/src/app/chat/activation.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { telemetry } from 'aws-core-vscode/telemetry'
99
import { AuthUtil, CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
1010
import { Commands, placeholder, funcUtil } from 'aws-core-vscode/shared'
1111
import * as amazonq from 'aws-core-vscode/amazonq'
12+
import * as semver from 'semver'
1213

1314
export async function activate(context: ExtensionContext) {
1415
const appInitContext = amazonq.DefaultAmazonQAppInitContext.instance
@@ -58,14 +59,14 @@ export async function activate(context: ExtensionContext) {
5859
await amazonq.activateBadge()
5960
void setupLsp()
6061
void setupAuthNotification()
62+
void setupVscodeVersionNotification()
6163
}
6264

6365
function registerApps(appInitContext: amazonq.AmazonQAppInitContext) {
6466
amazonq.cwChatAppInit(appInitContext)
6567
amazonq.featureDevChatAppInit(appInitContext)
6668
amazonq.gumbyChatAppInit(appInitContext)
6769
}
68-
6970
/**
7071
* Display a notification to user for Log In.
7172
*
@@ -105,3 +106,31 @@ async function setupAuthNotification() {
105106
}
106107
}
107108
}
109+
// TODO: remove once version bump to 1.83.0 is complete.
110+
export function setupVscodeVersionNotification() {
111+
let notificationDisplayed = false
112+
tryShowNotification()
113+
114+
function tryShowNotification() {
115+
// Do not show the notification if the IDE version will continue to be supported.
116+
if (!semver.gte(vscode.version, '1.83.0')) {
117+
return
118+
}
119+
120+
if (notificationDisplayed) {
121+
return
122+
}
123+
124+
notificationDisplayed = true
125+
126+
telemetry.toolkit_showNotification.emit({
127+
component: 'editor',
128+
id: 'versionNotification',
129+
reason: 'unsupportedVersion',
130+
result: 'Succeeded',
131+
})
132+
void vscode.window.showWarningMessage(
133+
'Update VS Code to version 1.83.0+, support for previous versions will be dropped soon. '
134+
)
135+
}
136+
}

packages/core/src/extension.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import vscode from 'vscode'
1414
import * as nls from 'vscode-nls'
15-
1615
import globals, { initialize, isWeb } from './shared/extensionGlobals'
1716
import { join } from 'path'
1817
import { Commands } from './shared/vscode/commands2'

packages/toolkit/src/extensionNode.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,48 @@ import type { ExtensionContext } from 'vscode'
77
import { activate as activateCore, deactivate as deactivateCore } from 'aws-core-vscode/node'
88
import { awsToolkitApi } from './api'
99
import { Commands } from 'aws-core-vscode/shared'
10+
import * as semver from 'semver'
11+
import * as vscode from 'vscode'
12+
import { telemetry } from 'aws-core-vscode/telemetry'
1013

1114
export async function activate(context: ExtensionContext) {
1215
await activateCore(context)
1316

1417
// after toolkit is activated, ask Amazon Q to register toolkit api callbacks
1518
await Commands.tryExecute('aws.amazonq.refreshConnectionCallback', awsToolkitApi)
19+
void setupVscodeVersionNotification()
1620
return awsToolkitApi
1721
}
1822

1923
export async function deactivate() {
2024
await deactivateCore()
2125
}
26+
27+
// TODO: remove once version bump to 1.83.0 is complete.
28+
export function setupVscodeVersionNotification() {
29+
let notificationDisplayed = false
30+
tryShowNotification()
31+
32+
function tryShowNotification() {
33+
// Do not show the notification if the IDE version will continue to be supported.
34+
if (!semver.gte(vscode.version, '1.83.0')) {
35+
return
36+
}
37+
38+
if (notificationDisplayed) {
39+
return
40+
}
41+
42+
notificationDisplayed = true
43+
44+
telemetry.toolkit_showNotification.emit({
45+
component: 'editor',
46+
id: 'versionNotification',
47+
reason: 'unsupportedVersion',
48+
result: 'Succeeded',
49+
})
50+
void vscode.window.showWarningMessage(
51+
'Update VS Code to version 1.83.0+, support for previous versions will be dropped soon. '
52+
)
53+
}
54+
}

0 commit comments

Comments
 (0)