Skip to content

Commit b299145

Browse files
committed
refactor(amazonq): deprecate amazon q inline through vscode
1 parent da499d5 commit b299145

25 files changed

+91
-3087
lines changed

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

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,27 @@
66
import vscode from 'vscode'
77
import {
88
AuthUtil,
9-
CodeSuggestionsState,
109
CodeWhispererCodeCoverageTracker,
1110
CodeWhispererConstants,
12-
CodeWhispererSettings,
13-
ConfigurationEntry,
14-
DefaultCodeWhispererClient,
15-
invokeRecommendation,
1611
isInlineCompletionEnabled,
17-
KeyStrokeHandler,
18-
RecommendationHandler,
1912
runtimeLanguageContext,
2013
TelemetryHelper,
2114
UserWrittenCodeTracker,
2215
vsCodeState,
2316
} from 'aws-core-vscode/codewhisperer'
24-
import { Commands, getLogger, globals, sleep } from 'aws-core-vscode/shared'
17+
import { globals, sleep } from 'aws-core-vscode/shared'
2518

2619
export async function activate() {
27-
const codewhispererSettings = CodeWhispererSettings.instance
28-
const client = new DefaultCodeWhispererClient()
29-
3020
if (isInlineCompletionEnabled()) {
3121
await setSubscriptionsforInlineCompletion()
3222
await AuthUtil.instance.setVscodeContextProps()
3323
}
3424

35-
function getAutoTriggerStatus(): boolean {
36-
return CodeSuggestionsState.instance.isSuggestionsEnabled()
37-
}
38-
39-
async function getConfigEntry(): Promise<ConfigurationEntry> {
40-
const isShowMethodsEnabled: boolean =
41-
vscode.workspace.getConfiguration('editor').get('suggest.showMethods') || false
42-
const isAutomatedTriggerEnabled: boolean = getAutoTriggerStatus()
43-
const isManualTriggerEnabled: boolean = true
44-
const isSuggestionsWithCodeReferencesEnabled = codewhispererSettings.isSuggestionsWithCodeReferencesEnabled()
45-
46-
// TODO:remove isManualTriggerEnabled
47-
return {
48-
isShowMethodsEnabled,
49-
isManualTriggerEnabled,
50-
isAutomatedTriggerEnabled,
51-
isSuggestionsWithCodeReferencesEnabled,
52-
}
53-
}
54-
5525
async function setSubscriptionsforInlineCompletion() {
56-
RecommendationHandler.instance.subscribeSuggestionCommands()
57-
5826
/**
5927
* Automated trigger
6028
*/
6129
globals.context.subscriptions.push(
62-
vscode.window.onDidChangeActiveTextEditor(async (editor) => {
63-
await RecommendationHandler.instance.onEditorChange()
64-
}),
65-
vscode.window.onDidChangeWindowState(async (e) => {
66-
await RecommendationHandler.instance.onFocusChange()
67-
}),
68-
vscode.window.onDidChangeTextEditorSelection(async (e) => {
69-
await RecommendationHandler.instance.onCursorChange(e)
70-
}),
7130
vscode.workspace.onDidChangeTextDocument(async (e) => {
7231
const editor = vscode.window.activeTextEditor
7332
if (!editor) {
@@ -105,19 +64,6 @@ export async function activate() {
10564
* Then this event can be processed by our code.
10665
*/
10766
await sleep(CodeWhispererConstants.vsCodeCursorUpdateDelay)
108-
if (!RecommendationHandler.instance.isSuggestionVisible()) {
109-
await KeyStrokeHandler.instance.processKeyStroke(e, editor, client, await getConfigEntry())
110-
}
111-
}),
112-
// manual trigger
113-
Commands.register({ id: 'aws.amazonq.invokeInlineCompletion', autoconnect: true }, async () => {
114-
invokeRecommendation(
115-
vscode.window.activeTextEditor as vscode.TextEditor,
116-
client,
117-
await getConfigEntry()
118-
).catch((e) => {
119-
getLogger().error('invokeRecommendation failed: %s', (e as Error).message)
120-
})
12167
})
12268
)
12369
}

packages/amazonq/test/e2e/inline/inline.test.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
toTextEditor,
1515
using,
1616
} from 'aws-core-vscode/test'
17-
import { RecommendationHandler, RecommendationService, session } from 'aws-core-vscode/codewhisperer'
17+
import { session } from 'aws-core-vscode/codewhisperer'
1818
import { Commands, globals, sleep, waitUntil, collectionUtil } from 'aws-core-vscode/shared'
1919
import { loginToIdC } from '../amazonq/utils/setup'
2020

@@ -54,7 +54,6 @@ describe('Amazon Q Inline', async function () {
5454
const events = getUserTriggerDecision()
5555
console.table({
5656
'telemetry events': JSON.stringify(events),
57-
'recommendation service status': RecommendationService.instance.isRunning,
5857
})
5958
}
6059

@@ -76,24 +75,10 @@ describe('Amazon Q Inline', async function () {
7675
if (!suggestionShown) {
7776
throw new Error(`Suggestion did not show. Suggestion States: ${JSON.stringify(session.suggestionStates)}`)
7877
}
79-
const suggestionVisible = await waitUntil(
80-
async () => RecommendationHandler.instance.isSuggestionVisible(),
81-
waitOptions
82-
)
83-
if (!suggestionVisible) {
84-
throw new Error(
85-
`Suggestions failed to become visible. Suggestion States: ${JSON.stringify(session.suggestionStates)}`
86-
)
87-
}
8878
console.table({
8979
'suggestions states': JSON.stringify(session.suggestionStates),
90-
'valid recommendation': RecommendationHandler.instance.isValidResponse(),
91-
'recommendation service status': RecommendationService.instance.isRunning,
9280
recommendations: session.recommendations,
9381
})
94-
if (!RecommendationHandler.instance.isValidResponse()) {
95-
throw new Error('Did not find a valid response')
96-
}
9782
}
9883

9984
/**
@@ -234,7 +219,7 @@ describe('Amazon Q Inline', async function () {
234219

235220
if (name === 'automatic') {
236221
// It should never get triggered since its not a supported file type
237-
assert.deepStrictEqual(RecommendationService.instance.isRunning, false)
222+
// assert.deepStrictEqual(RecommendationService.instance.isRunning, false)
238223
} else {
239224
await getTestWindow().waitForMessage('currently not supported by Amazon Q inline suggestions')
240225
}

packages/amazonq/test/unit/codewhisperer/commands/invokeRecommendation.test.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

packages/amazonq/test/unit/codewhisperer/commands/onAcceptance.test.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

packages/amazonq/test/unit/codewhisperer/commands/onInlineAcceptance.test.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)