@@ -21,9 +21,18 @@ import {
2121 ResponseMessage ,
2222 WorkspaceFolder ,
2323} from '@aws/language-server-runtimes/protocol'
24- import { Settings , oidcClientName , createServerOptions , globals , Experiments , getLogger } from 'aws-core-vscode/shared'
24+ import {
25+ Settings ,
26+ oidcClientName ,
27+ createServerOptions ,
28+ globals ,
29+ Experiments ,
30+ getLogger ,
31+ Commands ,
32+ } from 'aws-core-vscode/shared'
2533import { activate } from './chat/activation'
2634import { AmazonQResourcePaths } from './lspInstaller'
35+ import { InlineCompletionManager } from '../app/inline/completion'
2736
2837const localize = nls . loadMessageBundle ( )
2938
@@ -103,21 +112,33 @@ export async function startLanguageServer(
103112 const auth = new AmazonQLspAuth ( client )
104113
105114 return client . onReady ( ) . then ( async ( ) => {
106- await auth . init ( )
107- //const inlineManager = new InlineCompletionManager(client)
108- //inlineManager.registerInlineCompletion()
109- if ( Experiments . instance . get ( 'amazonqChatLSP' , false ) ) {
110- activate ( client , encryptionKey , resourcePaths . mynahUI )
111- }
112-
113- // Request handler for when the server wants to know about the clients auth connnection
115+ // Request handler for when the server wants to know about the clients auth connnection. Must be registered before the initial auth init call
114116 client . onRequest < ConnectionMetadata , Error > ( notificationTypes . getConnectionMetadata . method , ( ) => {
115117 return {
116118 sso : {
117119 startUrl : AuthUtil . instance . auth . startUrl ,
118120 } ,
119121 }
120122 } )
123+ await auth . init ( )
124+
125+ if ( Experiments . instance . get ( 'amazonqLSPInline' , false ) ) {
126+ const inlineManager = new InlineCompletionManager ( client )
127+ inlineManager . registerInlineCompletion ( )
128+ toDispose . push (
129+ inlineManager ,
130+ Commands . register ( { id : 'aws.amazonq.invokeInlineCompletion' , autoconnect : true } , async ( ) => {
131+ await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.trigger' )
132+ } ) ,
133+ vscode . workspace . onDidCloseTextDocument ( async ( ) => {
134+ await vscode . commands . executeCommand ( 'aws.amazonq.rejectCodeSuggestion' )
135+ } )
136+ )
137+ }
138+
139+ if ( Experiments . instance . get ( 'amazonqChatLSP' , false ) ) {
140+ activate ( client , encryptionKey , resourcePaths . mynahUI )
141+ }
121142
122143 // Temporary code for pen test. Will be removed when we switch to the real flare auth
123144 const authInterval = setInterval ( async ( ) => {
0 commit comments