@@ -23,7 +23,6 @@ import {
2323 CodeWhispererSettings ,
2424 getSelectedCustomization ,
2525 TelemetryHelper ,
26- vsCodeState ,
2726} from 'aws-core-vscode/codewhisperer'
2827import {
2928 Settings ,
@@ -347,7 +346,26 @@ async function onLanguageServerReady(
347346 // use language server for inline completion
348347 const inlineManager = new InlineCompletionManager ( client , sessionManager , lineTracker , inlineTutorialAnnotation )
349348 inlineManager . registerInlineCompletion ( )
350- toDispose . push ( inlineManager )
349+ toDispose . push (
350+ inlineManager ,
351+ Commands . register ( 'aws.amazonq.showPrev' , async ( ) => {
352+ await sessionManager . maybeRefreshSessionUx ( )
353+ await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.showPrevious' )
354+ sessionManager . onPrevSuggestion ( )
355+ } ) ,
356+ Commands . register ( 'aws.amazonq.showNext' , async ( ) => {
357+ await sessionManager . maybeRefreshSessionUx ( )
358+ await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.showNext' )
359+ sessionManager . onNextSuggestion ( )
360+ } ) ,
361+ // this is a workaround since handleDidShowCompletionItem is not public API
362+ Commands . register ( 'aws.amazonq.checkInlineSuggestionVisibility' , async ( ) => {
363+ sessionManager . checkInlineSuggestionVisibility ( )
364+ } ) ,
365+ vscode . workspace . onDidCloseTextDocument ( async ( ) => {
366+ await vscode . commands . executeCommand ( 'aws.amazonq.rejectCodeSuggestion' )
367+ } )
368+ )
351369 }
352370
353371 activateInlineChat ( extensionContext , client , encryptionKey , inlineChatTutorialAnnotation )
@@ -364,24 +382,6 @@ async function onLanguageServerReady(
364382 await initializeLanguageServerConfiguration ( client , 'startup' )
365383
366384 toDispose . push (
367- Commands . register ( 'aws.amazonq.showPrev' , async ( ) => {
368- await sessionManager . maybeRefreshSessionUx ( )
369- await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.showPrevious' )
370- sessionManager . onPrevSuggestion ( )
371- } ) ,
372- Commands . register ( 'aws.amazonq.showNext' , async ( ) => {
373- await sessionManager . maybeRefreshSessionUx ( )
374- await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.showNext' )
375- sessionManager . onNextSuggestion ( )
376- } ) ,
377- // this is a workaround since handleDidShowCompletionItem is not public API
378- Commands . register ( 'aws.amazonq.checkInlineSuggestionVisibility' , async ( ) => {
379- sessionManager . checkInlineSuggestionVisibility ( )
380- } ) ,
381- Commands . register ( { id : 'aws.amazonq.invokeInlineCompletion' , autoconnect : true } , async ( ) => {
382- vsCodeState . lastManualTriggerTime = performance . now ( )
383- await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.trigger' )
384- } ) ,
385385 Commands . register ( 'aws.amazonq.refreshAnnotation' , async ( forceProceed : boolean ) => {
386386 telemetry . record ( {
387387 traceId : TelemetryHelper . instance . traceId ,
@@ -407,9 +407,6 @@ async function onLanguageServerReady(
407407 getLogger ( ) . debug ( `codewhisperer: user dismiss tutorial.` )
408408 }
409409 } ) ,
410- vscode . workspace . onDidCloseTextDocument ( async ( ) => {
411- await vscode . commands . executeCommand ( 'aws.amazonq.rejectCodeSuggestion' )
412- } ) ,
413410 AuthUtil . instance . auth . onDidChangeActiveConnection ( async ( ) => {
414411 await auth . refreshConnection ( )
415412 } ) ,
0 commit comments