@@ -91,24 +91,30 @@ class WorkspaceTracker {
9191 )
9292 }
9393
94- private async workspaceDidReset ( ) {
94+ private workspaceDidReset ( ) {
9595 if ( this . resetTimer ) {
9696 clearTimeout ( this . resetTimer )
9797 }
98- this . resetTimer = setTimeout ( async ( ) => {
99- if ( this . prevWorkSpacePath !== this . cwd ) {
100- await this . providerRef . deref ( ) ?. postMessageToWebview ( {
101- type : "workspaceUpdated" ,
102- filePaths : [ ] ,
103- openedTabs : this . getOpenedTabsInfo ( ) ,
104- } )
105- this . filePaths . clear ( )
106- this . prevWorkSpacePath = this . cwd
107- this . initializeFilePaths ( )
108- }
98+ this . resetTimer = setTimeout ( ( ) => {
99+ void this . resetWorkspace ( ) . catch ( ( error ) => {
100+ console . error ( "[WorkspaceTracker] Failed to reset workspace:" , error )
101+ } )
109102 } , 300 ) // Debounce for 300ms
110103 }
111104
105+ private async resetWorkspace ( ) {
106+ if ( this . prevWorkSpacePath !== this . cwd ) {
107+ await this . providerRef . deref ( ) ?. postMessageToWebview ( {
108+ type : "workspaceUpdated" ,
109+ filePaths : [ ] ,
110+ openedTabs : this . getOpenedTabsInfo ( ) ,
111+ } )
112+ this . filePaths . clear ( )
113+ this . prevWorkSpacePath = this . cwd
114+ await this . initializeFilePaths ( )
115+ }
116+ }
117+
112118 private workspaceDidUpdate ( ) {
113119 if ( this . updateTimer ) {
114120 clearTimeout ( this . updateTimer )
@@ -119,7 +125,7 @@ class WorkspaceTracker {
119125 }
120126
121127 const relativeFilePaths = Array . from ( this . filePaths ) . map ( ( file ) => toRelativePath ( file , this . cwd ) )
122- this . providerRef . deref ( ) ?. postMessageToWebview ( {
128+ void this . providerRef . deref ( ) ?. postMessageToWebview ( {
123129 type : "workspaceUpdated" ,
124130 filePaths : relativeFilePaths ,
125131 openedTabs : this . getOpenedTabsInfo ( ) ,
0 commit comments