@@ -728,16 +728,7 @@ workspace_file <- file.path(dir_session, "workspace.json")
728728workspace_lock_file <- file.path(dir_session , " workspace.lock" )
729729file.create(workspace_lock_file , showWarnings = FALSE )
730730
731- # Deferred workspace scanning - scan when R is idle, not immediately after command
732- pending_workspace_scan <- NULL
733- workspace_scan_delay <- getOption(" vsc.workspace_scan_delay" , 0.2 ) # 200ms default
734- use_later <- requireNamespace(" later" , quietly = TRUE )
735- if (! use_later ) {
736- message(" Install package `later` for improved terminal responsiveness: install.packages('later')" )
737- }
738-
739- do_workspace_scan <- function () {
740- pending_workspace_scan <<- NULL
731+ update_workspace <- function (... ) {
741732 tryCatch({
742733 data <- list (
743734 search = search()[- 1 ],
@@ -747,20 +738,6 @@ do_workspace_scan <- function() {
747738 jsonlite :: write_json(data , workspace_file , force = TRUE , pretty = FALSE )
748739 cat(get_timestamp(), file = workspace_lock_file )
749740 }, error = message )
750- }
751-
752- update_workspace <- function (... ) {
753- if (use_later ) {
754- # Cancel any pending scan (debounce)
755- if (! is.null(pending_workspace_scan )) {
756- tryCatch(later :: later_cancel(pending_workspace_scan ), error = function (e ) NULL )
757- }
758- # Schedule scan after delay (runs when R is idle)
759- pending_workspace_scan <<- later :: later(do_workspace_scan , delay = workspace_scan_delay )
760- } else {
761- # Fallback: immediate scan if 'later' not available
762- do_workspace_scan()
763- }
764741 TRUE
765742}
766743update_workspace()
0 commit comments