@@ -49,7 +49,7 @@ import { getOrThrowBaseTokenServiceManager } from '../../shared/amazonQServiceMa
49
49
import { AmazonQWorkspaceConfig } from '../../shared/amazonQServiceManager/configurationUtils'
50
50
import { hasConnectionExpired } from '../../shared/utils'
51
51
import { getOrThrowBaseIAMServiceManager } from '../../shared/amazonQServiceManager/AmazonQIAMServiceManager'
52
- // import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager'
52
+ import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager'
53
53
import path = require( 'path' )
54
54
import { getRelativePath } from '../workspaceContext/util'
55
55
import { UserWrittenCodeTracker } from '../../shared/userWrittenCodeTracker'
@@ -346,8 +346,10 @@ export const CodewhispererServerFactory =
346
346
const maxResults = isAutomaticLspTriggerKind ? 1 : 5
347
347
const selectionRange = params . context . selectedCompletionInfo ?. range
348
348
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
351
353
// TODO: Can we get this derived from a keyboard event in the future?
352
354
// This picks the last non-whitespace character, if any, before the cursor
353
355
const triggerCharacter = fileContext . leftFileContent . trim ( ) . at ( - 1 ) ?? ''
@@ -450,7 +452,7 @@ export const CodewhispererServerFactory =
450
452
. slice ( 0 , CONTEXT_CHARACTERS_LIMIT )
451
453
. replaceAll ( '\r\n' , '\n' ) ,
452
454
} ,
453
- // workspaceId: workspaceId,
455
+ ... ( workspaceId ? { workspaceId : workspaceId } : { } ) ,
454
456
} )
455
457
. then ( async suggestionResponse => {
456
458
return processSuggestionResponse ( suggestionResponse , newSession , true , selectionRange )
0 commit comments