Skip to content

Commit cb4ca6b

Browse files
committed
remove duplicate code
1 parent ae0f2fd commit cb4ca6b

File tree

3 files changed

+31
-64
lines changed

3 files changed

+31
-64
lines changed

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ 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'
1312

1413
export async function activate(context: ExtensionContext) {
1514
const appInitContext = amazonq.DefaultAmazonQAppInitContext.instance
@@ -59,7 +58,6 @@ export async function activate(context: ExtensionContext) {
5958
await amazonq.activateBadge()
6059
void setupLsp()
6160
void setupAuthNotification()
62-
void setupVscodeVersionNotification()
6361
}
6462

6563
function registerApps(appInitContext: amazonq.AmazonQAppInitContext) {
@@ -106,31 +104,3 @@ async function setupAuthNotification() {
106104
}
107105
}
108106
}
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: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { Auth } from './auth'
5050
import { AuthFormId } from './login/webview/vue/types'
5151
import { getTelemetryMetadataForConn, isSsoConnection } from './auth/connection'
5252
import { registerCommands } from './commands'
53+
import * as semver from 'semver'
5354

5455
// In web mode everything must be in a single file, so things like the endpoints file will not be available.
5556
// The following imports the endpoints file, which causes webpack to bundle it in the final output file
@@ -170,7 +171,7 @@ export async function activateCommon(
170171
uriHandler: globals.uriHandler,
171172
credentialsStore: globals.loginManager.store,
172173
}
173-
174+
void setupVscodeVersionNotification()
174175
await activateViewsShared(extContext.extensionContext)
175176

176177
return extContext
@@ -303,3 +304,32 @@ export async function emitUserState() {
303304
})
304305
})
305306
}
307+
308+
// TODO: remove once version bump to 1.83.0 is complete.
309+
function setupVscodeVersionNotification() {
310+
let notificationDisplayed = false
311+
tryShowNotification()
312+
313+
function tryShowNotification() {
314+
// Do not show the notification if the IDE version will continue to be supported.
315+
if (!semver.gte(vscode.version, '1.83.0')) {
316+
return
317+
}
318+
319+
if (notificationDisplayed) {
320+
return
321+
}
322+
323+
notificationDisplayed = true
324+
325+
telemetry.toolkit_showNotification.emit({
326+
component: 'editor',
327+
id: 'versionNotification',
328+
reason: 'unsupportedVersion',
329+
result: 'Succeeded',
330+
})
331+
void vscode.window.showWarningMessage(
332+
'Update VS Code to version 1.83.0+, support for previous versions will be dropped soon. '
333+
)
334+
}
335+
}

packages/toolkit/src/extensionNode.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,15 @@ 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'
1310

1411
export async function activate(context: ExtensionContext) {
1512
await activateCore(context)
1613

1714
// after toolkit is activated, ask Amazon Q to register toolkit api callbacks
1815
await Commands.tryExecute('aws.amazonq.refreshConnectionCallback', awsToolkitApi)
19-
void setupVscodeVersionNotification()
2016
return awsToolkitApi
2117
}
2218

2319
export async function deactivate() {
2420
await deactivateCore()
2521
}
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)