Skip to content

Conversation

@renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Aug 16, 2021

What problem did you solve?

Closes #755

capture_str now handles error internally in the following way:

  1. Capture str() with user specified max.level.
  2. If error occurs, fall back to show class.

(If you do not have screenshot) How can I check this pull request?

The following examples no longer produce errors:

Simple flawed str:

errobj <- structure(list(x = 1), class = "err")
str.err <- function(obj) 0 + obj
options(vsc.str.max.level = 1)

Original issue with flawed str implementation:

library(tidyverse)
library(igraph)
library(tidygraph)

# setting workspace level to anything > 0 creates error
options(vsc.str.max.level = 1)

# create a simple igraph object
g <- erdos.renyi.game(10, .1)

# converting to a tbl_graph object produces the error (note that code still runs)
g <- as_tbl_graph(g)

@renkun-ken renkun-ken requested a review from ElianHugh August 17, 2021 04:56
Copy link
Collaborator

@ElianHugh ElianHugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, thank you for the quick fix!

@renkun-ken renkun-ken merged commit 22b784f into REditorSupport:master Aug 17, 2021
ElianHugh pushed a commit to ElianHugh/vscode-R that referenced this pull request May 12, 2022
* Handle error in capture_str

* Simplify capture_str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"subscript out of bounds" when "vsc.str.max.level" > 0

2 participants