@@ -207,13 +207,14 @@ class DeepCodeAnalyzer implements DeepCode.AnalyzerInterface {
207207 this . analysisResultsCollection ,
208208 updatedFile
209209 ) ;
210- this . analysisResultsCollection [ updatedFile . workspace ] . files [
211- updatedFile . filePathInWorkspace
212- ] = { ...fileIssuesList } ;
210+ // Opening a project directory instead of a workspace leads to empty updatedFile.workspace field
211+ const workspace = updatedFile . workspace || Object . keys ( this . analysisResultsCollection ) [ 0 ] ;
212+ const filepath = updatedFile . filePathInWorkspace || updatedFile . fullPath . replace ( workspace , "" ) ;
213+ this . analysisResultsCollection [ workspace ] . files [ filepath ] = { ...fileIssuesList } ;
213214 if ( this . deepcodeReview ) {
214215 const issues = this . createIssuesList ( {
215216 fileIssuesList,
216- suggestions : this . analysisResultsCollection [ updatedFile . workspace ] . suggestions ,
217+ suggestions : this . analysisResultsCollection [ workspace ] . suggestions ,
217218 fileUri : vscode . Uri . file ( updatedFile . fullPath )
218219 } ) ;
219220 this . deepcodeReview . set ( vscode . Uri . file ( updatedFile . fullPath ) , [
@@ -224,7 +225,7 @@ class DeepCodeAnalyzer implements DeepCode.AnalyzerInterface {
224225 } catch ( err ) {
225226 extension . errorHandler . processError ( extension , err , {
226227 message : errorsLogs . updateReviewPositions ,
227- bundleId : extension . remoteBundles [ updatedFile . workspace ] . bundleId ,
228+ bundleId : ( extension . remoteBundles [ updatedFile . workspace ] || { } ) . bundleId ,
228229 data : {
229230 [ updatedFile . filePathInWorkspace ] : updatedFile . contentChanges
230231 }
0 commit comments