@@ -11,7 +11,15 @@ import { InlineCompletionManager } from '../app/inline/completion'
1111import { AmazonQLspAuth , encryptionKey , notificationTypes } from './auth'
1212import { AuthUtil } from 'aws-core-vscode/codewhisperer'
1313import { ConnectionMetadata } from '@aws/language-server-runtimes/protocol'
14- import { Settings , oidcClientName , createServerOptions , globals , Experiments , getLogger } from 'aws-core-vscode/shared'
14+ import {
15+ Settings ,
16+ oidcClientName ,
17+ createServerOptions ,
18+ globals ,
19+ Experiments ,
20+ getLogger ,
21+ Commands ,
22+ } from 'aws-core-vscode/shared'
1523import { activate } from './chat/activation'
1624import { AmazonQResourcePaths } from './lspInstaller'
1725
@@ -101,10 +109,22 @@ export async function startLanguageServer(
101109 } ,
102110 }
103111 } )
104-
105112 await auth . init ( )
106- const inlineManager = new InlineCompletionManager ( client )
107- inlineManager . registerInlineCompletion ( )
113+
114+ if ( Experiments . instance . get ( 'amazonqLSPInline' , false ) ) {
115+ const inlineManager = new InlineCompletionManager ( client )
116+ inlineManager . registerInlineCompletion ( )
117+ toDispose . push (
118+ inlineManager ,
119+ Commands . register ( { id : 'aws.amazonq.invokeInlineCompletion' , autoconnect : true } , async ( ) => {
120+ await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.trigger' )
121+ } ) ,
122+ vscode . workspace . onDidCloseTextDocument ( async ( ) => {
123+ await vscode . commands . executeCommand ( 'aws.amazonq.rejectCodeSuggestion' )
124+ } )
125+ )
126+ }
127+
108128 if ( Experiments . instance . get ( 'amazonqChatLSP' , false ) ) {
109129 activate ( client , encryptionKey , resourcePaths . mynahUI )
110130 }
@@ -125,8 +145,7 @@ export async function startLanguageServer(
125145 } ) ,
126146 AuthUtil . instance . auth . onDidDeleteConnection ( async ( ) => {
127147 client . sendNotification ( notificationTypes . deleteBearerToken . method )
128- } ) ,
129- inlineManager
148+ } )
130149 )
131150 } )
132151}
0 commit comments