-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy pathinit_late.R
More file actions
47 lines (42 loc) · 1.23 KB
/
init_late.R
File metadata and controls
47 lines (42 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
dir_init <- getwd()
# cleanup previous version
removeTaskCallback("vscode-R")
options(vscodeR = NULL)
.vsc.name <- "tools:vscode"
if (.vsc.name %in% search()) {
detach(.vsc.name, character.only = TRUE)
}
# Source vsc utils in new environmeent
.vsc <- new.env()
source(file.path(dir_init, "vsc.R"), local = .vsc)
# attach functions that are meant to be called by the user/vscode
exports <- local({
.vsc <- .vsc
.vsc.attach <- .vsc$attach
.vsc.detach <- .vsc$detach
.vsc.view <- .vsc$show_dataview
.vsc.browser <- .vsc$show_browser
.vsc.viewer <- .vsc$show_viewer
.vsc.page_viewer <- .vsc$show_page_viewer
environment()
})
attach(exports, name = .vsc.name, warn.conflicts = FALSE)
# overwrite S3 bindings from other packages
suppressWarnings({
if (!identical(getOption("vsc.helpPanel", "Two"), FALSE)) {
# Overwrite print function for results of `?`
.vsc$.S3method(
"print",
"help_files_with_topic",
.vsc$print.help_files_with_topic
)
# Overwrite print function for results of `??`
.vsc$.S3method(
"print",
"hsearch",
.vsc$print.hsearch
)
}
# Further S3 overwrites can go here
# ...
})