@@ -49,7 +49,7 @@ import { getOrThrowBaseTokenServiceManager } from '../../shared/amazonQServiceMa
4949import { AmazonQWorkspaceConfig } from '../../shared/amazonQServiceManager/configurationUtils'
5050import { hasConnectionExpired } from '../../shared/utils'
5151import { getOrThrowBaseIAMServiceManager } from '../../shared/amazonQServiceManager/AmazonQIAMServiceManager'
52- // import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager'
52+ import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager'
5353import path = require( 'path' )
5454import { getRelativePath } from '../workspaceContext/util'
5555import { UserWrittenCodeTracker } from '../../shared/userWrittenCodeTracker'
@@ -346,8 +346,10 @@ export const CodewhispererServerFactory =
346346 const maxResults = isAutomaticLspTriggerKind ? 1 : 5
347347 const selectionRange = params . context . selectedCompletionInfo ?. range
348348 const fileContext = getFileContext ( { textDocument, inferredLanguageId, position : params . position } )
349- // const workspaceFolder = WorkspaceFolderManager.getInstance()?.getWorkspaceFolder(params.textDocument.uri)
350- // const workspaceId = WorkspaceFolderManager.getInstance()?.getWorkspaceId(workspaceFolder)
349+ const workspaceState = WorkspaceFolderManager . getInstance ( ) ?. getWorkspaceState ( )
350+ const workspaceId = workspaceState ?. webSocketClient ?. isConnected ( )
351+ ? workspaceState . workspaceId
352+ : undefined
351353 // TODO: Can we get this derived from a keyboard event in the future?
352354 // This picks the last non-whitespace character, if any, before the cursor
353355 const triggerCharacter = fileContext . leftFileContent . trim ( ) . at ( - 1 ) ?? ''
@@ -450,7 +452,7 @@ export const CodewhispererServerFactory =
450452 . slice ( 0 , CONTEXT_CHARACTERS_LIMIT )
451453 . replaceAll ( '\r\n' , '\n' ) ,
452454 } ,
453- // workspaceId: workspaceId,
455+ ... ( workspaceId ? { workspaceId : workspaceId } : { } ) ,
454456 } )
455457 . then ( async suggestionResponse => {
456458 return processSuggestionResponse ( suggestionResponse , newSession , true , selectionRange )
0 commit comments