@@ -158,39 +158,6 @@ export class InlineCompletionManager implements Disposable {
158158 this . languageClient . sendNotification ( this . logSessionResultMessageName , params )
159159 }
160160 commands . registerCommand ( 'aws.amazonq.rejectCodeSuggestion' , onInlineRejection )
161-
162- /*
163- We have to overwrite the prev. and next. commands because the inlineCompletionProvider only contained the current item
164- To show prev. and next. recommendation we need to re-register a new provider with the previous or next item
165- */
166-
167- const swapProviderAndShow = async ( ) => {
168- await commands . executeCommand ( 'editor.action.inlineSuggest.hide' )
169- this . disposable . dispose ( )
170- this . disposable = languages . registerInlineCompletionItemProvider (
171- CodeWhispererConstants . platformLanguageIds ,
172- new AmazonQInlineCompletionItemProvider (
173- this . languageClient ,
174- this . recommendationService ,
175- this . sessionManager ,
176- this . inlineTutorialAnnotation ,
177- false
178- )
179- )
180- await commands . executeCommand ( 'editor.action.inlineSuggest.trigger' )
181- }
182-
183- const prevCommandHandler = async ( ) => {
184- this . sessionManager . decrementActiveIndex ( )
185- await swapProviderAndShow ( )
186- }
187- commands . registerCommand ( 'editor.action.inlineSuggest.showPrevious' , prevCommandHandler )
188-
189- const nextCommandHandler = async ( ) => {
190- this . sessionManager . incrementActiveIndex ( )
191- await swapProviderAndShow ( )
192- }
193- commands . registerCommand ( 'editor.action.inlineSuggest.showNext' , nextCommandHandler )
194161 }
195162}
196163
@@ -199,8 +166,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
199166 private readonly languageClient : LanguageClient ,
200167 private readonly recommendationService : RecommendationService ,
201168 private readonly sessionManager : SessionManager ,
202- private readonly inlineTutorialAnnotation : InlineTutorialAnnotation ,
203- private readonly isNewSession : boolean = true
169+ private readonly inlineTutorialAnnotation : InlineTutorialAnnotation
204170 ) { }
205171
206172 provideInlineCompletionItems = debounce (
@@ -215,29 +181,28 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
215181 context : InlineCompletionContext ,
216182 token : CancellationToken
217183 ) : Promise < InlineCompletionItem [ ] > {
184+ getLogger ( ) . debug ( `provideInlineCompletionItems: ${ context . triggerKind } ` )
218185 try {
219186 vsCodeState . isRecommendationsActive = true
220- if ( this . isNewSession ) {
221- const isAutoTrigger = context . triggerKind === InlineCompletionTriggerKind . Automatic
222- if ( isAutoTrigger && ! CodeSuggestionsState . instance . isSuggestionsEnabled ( ) ) {
223- // return early when suggestions are disabled with auto trigger
224- return [ ]
225- }
226-
227- // tell the tutorial that completions has been triggered
228- await this . inlineTutorialAnnotation . triggered ( context . triggerKind )
229- TelemetryHelper . instance . setInvokeSuggestionStartTime ( )
230- TelemetryHelper . instance . setTriggerType ( context . triggerKind )
231-
232- // make service requests if it's a new session
233- await this . recommendationService . getAllRecommendations (
234- this . languageClient ,
235- document ,
236- position ,
237- context ,
238- token
239- )
187+ getLogger ( ) . debug ( `provideInlineCompletionItems triggered` )
188+ const isAutoTrigger = context . triggerKind === InlineCompletionTriggerKind . Automatic
189+ if ( isAutoTrigger && ! CodeSuggestionsState . instance . isSuggestionsEnabled ( ) ) {
190+ // return early when suggestions are disabled with auto trigger
191+ return [ ]
240192 }
193+
194+ // tell the tutorial that completions has been triggered
195+ await this . inlineTutorialAnnotation . triggered ( context . triggerKind )
196+ TelemetryHelper . instance . setInvokeSuggestionStartTime ( )
197+ TelemetryHelper . instance . setTriggerType ( context . triggerKind )
198+
199+ await this . recommendationService . getAllRecommendations (
200+ this . languageClient ,
201+ document ,
202+ position ,
203+ context ,
204+ token
205+ )
241206 // get active item from session for displaying
242207 const items = this . sessionManager . getActiveRecommendation ( )
243208 const session = this . sessionManager . getActiveSession ( )
0 commit comments