diff --git a/packages/nimble/R/BUGS_modelDef.R b/packages/nimble/R/BUGS_modelDef.R index d8e3c7e8c..4e242023d 100644 --- a/packages/nimble/R/BUGS_modelDef.R +++ b/packages/nimble/R/BUGS_modelDef.R @@ -2932,7 +2932,7 @@ modelDefClass$methods(buildSymbolTable = function() { }) -modelDefClass$methods(newModel = function(data = list(), inits = list(), where = globalenv(), modelName = character(), check = getNimbleOption('checkModel'), calculate = TRUE, debug = FALSE) { +modelDefClass$methods(newModel = function(data = list(), inits = list(), where = globalenv(), modelName = character(), check = getNimbleOption('checkModel'), calculate = TRUE, debug = FALSE, rstudioFix = getNimbleOption('doRStudioHangingFix')) { if(debug) browser() if(inherits(modelClass, 'uninitializedField')) { vars <- lapply(varInfo, `[[`, 'maxs') @@ -3006,7 +3006,7 @@ modelDefClass$methods(newModel = function(data = list(), inits = list(), where = if(getNimbleOption('verbose')) message("Checking model calculations") model$check() } - fixRStudioHanging(model) + if(rstudioFix) fixRStudioHanging(model) return(model) }) diff --git a/packages/nimble/R/options.R b/packages/nimble/R/options.R index 93f217970..be78933ef 100644 --- a/packages/nimble/R/options.R +++ b/packages/nimble/R/options.R @@ -189,6 +189,7 @@ nimOptimMethod("bobyqa", compileOnly = FALSE, buildInterfacesForCompiledNestedNimbleFunctions = FALSE, ## provides interfaces, i.e. named access in R, to all variables in nested compiled nimbleFunctions clearNimbleFunctionsAfterCompiling = FALSE, + doRStudioHangingFix = FALSE, ## causes implementation of the str method for all dynamically generated classes, to prevent hanging in RStudio checkModel = FALSE, checkNimbleFunction = TRUE, checkDuplicateNodeDefinitions = TRUE,