Skip to content

Commit

Permalink
Detect running via VSCode (fix #134)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Apr 19, 2024
1 parent 795b6d1 commit 664af6f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: startup
Version: 0.21.0-9003
Version: 0.21.0-9004
Title: Friendly R Startup Configuration
Depends: R (>= 2.14.0)
Suggests: commonmark, tools, tcltk
Expand Down
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* `startup()` gained argument `encoding`, which controls the encoding
used to parse the R startup files.

* Now `sysinfo()` return also flag `webr`, which indicates whether R
runs via WebR or not.
* Now `sysinfo()` report also on Visual Studio Code (VSCode) webR via
flags `vscode` and `webr`.


# Version 0.21.0 (2023-12-11)
Expand Down
7 changes: 7 additions & 0 deletions R/is_vscode.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#' Checks if running is R via Visual Studio Code (VSCode)
#'
#' @return A logical
is_vscode <- function() {
opt_names <- names(options())
"vsc.globalenv" %in% opt_names
}
1 change: 1 addition & 0 deletions R/sysinfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sysinfo <- function() {
## Deprecated: Renamed rice -> rtichoke in February 2018
sysinfo$rice <- sysinfo$radian
sysinfo$pqr <- is_pqr()
sysinfo$vscode <- is_vscode()
sysinfo$webr <- is_webr()
sysinfo$wine <- is_wine()

Expand Down
14 changes: 14 additions & 0 deletions man/is_vscode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 664af6f

Please sign in to comment.