@@ -11,7 +11,15 @@ import { InlineCompletionManager } from '../app/inline/completion'
11
11
import { AmazonQLspAuth , encryptionKey , notificationTypes } from './auth'
12
12
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
13
13
import { 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'
15
23
import { activate } from './chat/activation'
16
24
import { AmazonQResourcePaths } from './lspInstaller'
17
25
@@ -101,10 +109,22 @@ export async function startLanguageServer(
101
109
} ,
102
110
}
103
111
} )
104
-
105
112
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
+
108
128
if ( Experiments . instance . get ( 'amazonqChatLSP' , false ) ) {
109
129
activate ( client , encryptionKey , resourcePaths . mynahUI )
110
130
}
@@ -125,8 +145,7 @@ export async function startLanguageServer(
125
145
} ) ,
126
146
AuthUtil . instance . auth . onDidDeleteConnection ( async ( ) => {
127
147
client . sendNotification ( notificationTypes . deleteBearerToken . method )
128
- } ) ,
129
- inlineManager
148
+ } )
130
149
)
131
150
} )
132
151
}
0 commit comments