File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 8
8
use anyhow:: anyhow;
9
9
use harp:: environment:: Environment ;
10
10
use harp:: environment:: R_ENVS ;
11
+ use harp:: eval:: r_parse_eval;
11
12
use harp:: exec:: r_parse_exprs_with_srcrefs;
12
13
use harp:: exec:: r_source_str_in;
13
14
use harp:: exec:: RFunction ;
@@ -18,6 +19,7 @@ use libr::R_NilValue;
18
19
use libr:: Rf_ScalarLogical ;
19
20
use libr:: Rf_asInteger ;
20
21
use libr:: SEXP ;
22
+ use once_cell:: sync:: Lazy ;
21
23
use rust_embed:: RustEmbed ;
22
24
23
25
#[ derive( RustEmbed ) ]
46
48
f ( data)
47
49
}
48
50
51
+ pub static ARK_ENVS : Lazy < ArkEnvs > = Lazy :: new ( || {
52
+ let positron_ns = r_parse_eval (
53
+ "environment(as.environment('tools:positron')$.ps.internal)" ,
54
+ Default :: default ( ) ,
55
+ )
56
+ . unwrap ( )
57
+ . sexp ;
58
+
59
+ let rstudio_ns = r_parse_eval (
60
+ "as.environment('tools:rstudio')$.__rstudio_ns__." ,
61
+ Default :: default ( ) ,
62
+ )
63
+ . unwrap ( )
64
+ . sexp ;
65
+
66
+ ArkEnvs {
67
+ positron_ns,
68
+ rstudio_ns,
69
+ }
70
+ } ) ;
71
+
72
+ // Silences diagnostics when called from `r_task()`. Should only be
73
+ // accessed from the R thread.
74
+ unsafe impl Send for ArkEnvs { }
75
+ unsafe impl Sync for ArkEnvs { }
76
+
77
+ pub struct ArkEnvs {
78
+ pub positron_ns : SEXP ,
79
+ pub rstudio_ns : SEXP ,
80
+ }
81
+
49
82
pub fn initialize ( testing : bool ) -> anyhow:: Result < ( ) > {
50
83
// If we are `testing`, set the corresponding R level global option
51
84
if testing {
You can’t perform that action at this time.
0 commit comments