|
6 | 6 | import vscode from 'vscode' |
7 | 7 | import { |
8 | 8 | AuthUtil, |
9 | | - CodeSuggestionsState, |
10 | 9 | CodeWhispererCodeCoverageTracker, |
11 | 10 | CodeWhispererConstants, |
12 | | - CodeWhispererSettings, |
13 | | - ConfigurationEntry, |
14 | | - DefaultCodeWhispererClient, |
15 | | - invokeRecommendation, |
16 | 11 | isInlineCompletionEnabled, |
17 | | - KeyStrokeHandler, |
18 | | - RecommendationHandler, |
19 | 12 | runtimeLanguageContext, |
20 | 13 | TelemetryHelper, |
21 | 14 | UserWrittenCodeTracker, |
22 | 15 | vsCodeState, |
23 | 16 | } 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' |
25 | 18 |
|
26 | 19 | export async function activate() { |
27 | | - const codewhispererSettings = CodeWhispererSettings.instance |
28 | | - const client = new DefaultCodeWhispererClient() |
29 | | - |
30 | 20 | if (isInlineCompletionEnabled()) { |
31 | 21 | await setSubscriptionsforInlineCompletion() |
32 | 22 | await AuthUtil.instance.setVscodeContextProps() |
33 | 23 | } |
34 | 24 |
|
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 | | - |
55 | 25 | async function setSubscriptionsforInlineCompletion() { |
56 | | - RecommendationHandler.instance.subscribeSuggestionCommands() |
57 | | - |
58 | 26 | /** |
59 | 27 | * Automated trigger |
60 | 28 | */ |
61 | 29 | 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 | | - }), |
71 | 30 | vscode.workspace.onDidChangeTextDocument(async (e) => { |
72 | 31 | const editor = vscode.window.activeTextEditor |
73 | 32 | if (!editor) { |
@@ -105,19 +64,6 @@ export async function activate() { |
105 | 64 | * Then this event can be processed by our code. |
106 | 65 | */ |
107 | 66 | 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 | | - }) |
121 | 67 | }) |
122 | 68 | ) |
123 | 69 | } |
|
0 commit comments