File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -387,7 +387,15 @@ export const deleteRecentProjectRecord = async (path: string) => {
387387 * Uses AppleScript to get window titles from the IDE process.
388388 * Returns a Set of folder names (last path component) that have open windows.
389389 */
390+ let cachedActiveIDEFolders : Set < string > | null = null ;
391+ let activeIDECacheTimestamp = 0 ;
392+ const ACTIVE_IDE_CACHE_TTL_MS = 5000 ;
393+
390394export const detectActiveIDEProjects = async ( ) : Promise < Set < string > > => {
395+ const now = Date . now ( ) ;
396+ if ( cachedActiveIDEFolders && ( now - activeIDECacheTimestamp ) < ACTIVE_IDE_CACHE_TTL_MS ) {
397+ return cachedActiveIDEFolders ;
398+ }
391399 const processName = currentIDEMode === IDEMode . Cursor ? 'Cursor' : 'Code' ;
392400 const execPromise = ( cmd : string ) : Promise < string > =>
393401 new Promise ( ( resolve ) => {
@@ -427,5 +435,7 @@ end tell`;
427435 }
428436 }
429437
438+ cachedActiveIDEFolders = folderNames ;
439+ activeIDECacheTimestamp = now ;
430440 return folderNames ;
431441} ;
You can’t perform that action at this time.
0 commit comments