@@ -163,6 +163,8 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
163
163
// Limit FileSystemWatcher events that may produce a putDoc()
164
164
// request to 50 concurrent calls to avoid hammering the server
165
165
const restRateLimiter = new RateLimiter ( 50 ) ;
166
+ // A cache of the last time each file was last changed
167
+ const lastFileChangeTimes : Map < string , number > = new Map ( ) ;
166
168
// Index classes and routines that currently exist
167
169
vscode . workspace
168
170
. findFiles ( new vscode . RelativePattern ( wsFolder , "{**/*.cls,**/*.mac,**/*.int,**/*.inc}" ) )
@@ -187,8 +189,10 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
187
189
return ;
188
190
}
189
191
const uriString = uri . toString ( ) ;
192
+ const lastFileChangeTime = lastFileChangeTimes . get ( uriString ) ?? 0 ;
193
+ lastFileChangeTimes . set ( uriString , Date . now ( ) ) ;
190
194
if ( openCustomEditors . includes ( uriString ) ) {
191
- // This class is open in a graphical editor, so its name will not change
195
+ // This class is open in a low-code editor, so its name will not change
192
196
// and any updates to the class will be handled by that editor
193
197
touchedByVSCode . delete ( uriString ) ;
194
198
return ;
@@ -201,6 +205,12 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
201
205
touchedByVSCode . delete ( uriString ) ;
202
206
return ;
203
207
}
208
+ if ( lastFileChangeTimes . get ( uriString ) - lastFileChangeTime < 300 ) {
209
+ // This file change event came too quickly after the last one to be a
210
+ // meaningful change triggered by the user, so consider it a duplicate
211
+ touchedByVSCode . delete ( uriString ) ;
212
+ return ;
213
+ }
204
214
const api = new AtelierAPI ( uri ) ;
205
215
const conf = vscode . workspace . getConfiguration ( "objectscript" , wsFolder ) ;
206
216
const syncLocalChanges : string = conf . get ( "syncLocalChanges" ) ;
0 commit comments