File tree Expand file tree Collapse file tree
server/aws-lsp-codewhisperer/src/language-server/workspaceContext Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,8 +142,18 @@ export const WorkspaceContextServer = (): Server => features => {
142142
143143 const updateConfiguration = async ( ) => {
144144 try {
145+ // Guard: workspaceFolderManager may not be initialized yet if didChangeConfiguration
146+ // fires before onInitialized completes (race condition observed in V2160933004)
147+ if ( ! workspaceFolderManager ) {
148+ logging . log ( `updateConfiguration called before workspaceFolderManager initialized, skipping` )
149+ return
150+ }
151+
145152 const clientInitializParams = safeGet ( lsp . getClientInitializeParams ( ) )
146153 const extensionName = clientInitializParams . initializationOptions ?. aws ?. clientInfo ?. extension . name
154+ logging . log (
155+ `updateConfiguration: extensionName=${ extensionName } , isSupportedExtension=${ isSupportedExtension } `
156+ )
147157 if ( extensionName === 'AmazonQ-For-VSCode' ) {
148158 const amazonQSettings = ( await lsp . workspace . getConfiguration ( 'amazonQ' ) ) ?. [ 'server-sideContext' ]
149159 isOptedIn = amazonQSettings || false
@@ -165,6 +175,9 @@ export const WorkspaceContextServer = (): Server => features => {
165175 logging . log ( `Workspace context server opt-in flag is: ${ isOptedIn } ` )
166176
167177 if ( ! isOptedIn ) {
178+ logging . log (
179+ `User opted out, clearing workspace resources. isWorkflowInitialized=${ isWorkflowInitialized } `
180+ )
168181 isWorkflowInitialized = false
169182 fileUploadJobManager ?. dispose ( )
170183 dependencyEventBundler ?. dispose ( )
You can’t perform that action at this time.
0 commit comments