@@ -177,17 +177,28 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
177177 // part of the workspace folder, like "git" files
178178 return ;
179179 }
180+ if ( vscode . workspace . getWorkspaceFolder ( uri ) ?. uri . toString ( ) != wsFolder . uri . toString ( ) ) {
181+ // This file is not in this workspace folder. This can occur if there
182+ // are two workspace folders open where one is a subfolder of the other
183+ // and the file being changed is in the subfolder. This event will fire
184+ // for both watchers, but VS Code will correctly report that the file
185+ // is in the subfolder workspace folder, so the parent watcher can
186+ // safely ignore the event.
187+ return ;
188+ }
180189 const uriString = uri . toString ( ) ;
181190 if ( openCustomEditors . includes ( uriString ) ) {
182191 // This class is open in a graphical editor, so its name will not change
183192 // and any updates to the class will be handled by that editor
193+ touchedByVSCode . delete ( uriString ) ;
184194 return ;
185195 }
186196 if ( exportedUris . has ( uriString ) ) {
187197 // This creation/change event was fired due to a server
188198 // export, so don't re-sync the file with the server.
189199 // The index has already been updated.
190200 exportedUris . delete ( uriString ) ;
201+ touchedByVSCode . delete ( uriString ) ;
191202 return ;
192203 }
193204 const api = new AtelierAPI ( uri ) ;
@@ -225,6 +236,15 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
225236 // part of the workspace folder, like "git" files
226237 return ;
227238 }
239+ if ( vscode . workspace . getWorkspaceFolder ( uri ) ?. uri . toString ( ) != wsFolder . uri . toString ( ) ) {
240+ // This file is not in this workspace folder. This can occur if there
241+ // are two workspace folders open where one is a subfolder of the other
242+ // and the file being changed is in the subfolder. This event will fire
243+ // for both watchers, but VS Code will correctly report that the file
244+ // is in the subfolder workspace folder, so the parent watcher can
245+ // safely ignore the event.
246+ return ;
247+ }
228248 const uriString = uri . toString ( ) ;
229249 const api = new AtelierAPI ( uri ) ;
230250 const syncLocalChanges : string = vscode . workspace
0 commit comments