Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt if user wants the error searched #2

Open
coatless opened this issue Feb 15, 2018 · 6 comments
Open

Prompt if user wants the error searched #2

coatless opened this issue Feb 15, 2018 · 6 comments

Comments

@coatless
Copy link
Collaborator

The present experience might be a bit too jarring of immediately opening a web browser.

Let's prompt the user first to see if they would like us to search the error. Maybe add something with praise?

@daviddalpiaz
Copy link

Assuming the user is working in RStudio, could you somehow utilize the Viewer window? Thinking "big" for a moment, I'm envisioning a user encountering an error and then a rendered HTML document populates the Viewer window with:

  • Some positive messaging like "here is some help with the error you just encountered!"
  • A list of links for documentation of any functions used in the line that caused the error
  • A list of links for documentation / vignettes if any offending functions came from packages
  • A list of links that search the error message

Thoughts? (You could also do this with a browser window.)

You could get really crazy and allow users to specify extra args for links that always appears, say for example for a course that a user is currently taking. Sort of like, here are the links for your specific error, but also some links that will always be helpful while taking course STAT 4XX. Basically have students setup options at the beginning of the semester for projects related to a specific course. Maybe develop some way to pass this information to students.

You could also include some messaging about what to do for further help. A suggestion to use reprex. Comments about posting on stack overflow. Details on how to post on Piazza or contact course staff. Options are endless.

I haven't had enough coffee yet this morning so maybe this is ridiculous, but I had this idea seeing the conversations around searcher in my inbox this morning. @mine-cetinkaya-rundel thinking of it as an officehour package prompted me to think about adding the course specific information and messaging.

@coatless
Copy link
Collaborator Author

Assuming the user is working in RStudio, could you somehow utilize the Viewer window?

Yes. This is possible. Though, we add a dependency on the rstudioapi package.

The approach is given in the rstudioapi::viewer() documentation:

# probe for viewer option then fall back to browseURL
viewer <- getOption("viewer")
if (!is.null(viewer))
   viewer("http://localhost:8100")
else
   utils::browseURL("http://localhost:8100")

Regarding the other ideas... The main sticking point is quickly creating and rendering an HTML overlay.

Some positive messaging like "here is some help with the error you just encountered!"

praise would allow custom versions to be accomplished. We're using this to generate responses to students.

A list of links for documentation of any functions used in the line that caused the error

This is a bit more tricky as we need to search for function calls in the error. Sometimes the functions would be user-defined or the package author may disable the call portion of the stop.

e.g.

stop_with_call = function() { 
  stop("hi", call. = TRUE)
}

stop_without_call = function() {
  stop("hi", call. = FALSE)
}

stop_with_call()
# Error in stop_with_call() : hi
stop_without_call()
# Error: hi

A list of links for documentation / vignettes if any offending functions came from packages

We'd probably have to get a list of packages on the search path.

environments_active = search()
pkgs_active = sub("^package[:]", "",
                  environments_active[grepl("^package", environments_active)])
pkgs_active

Potentially, we could search for the function with either findFunction() or help.search().

pkg_list = findFunction("print")
docs = help.search(pattern = "^print$"),
            agrep = FALSE)

A list of links that search the error message

This could be generated with the proposed search_sites() functionality in searcher. We'll also need a flag to disable opening the URL in a browser.


In terms of course space, I think it makes sense to pursue an officehour package. The question is do we build it ontop of errorist or fork errorist?

You could get really crazy and allow users to specify extra args for links that always appears, say for example for a course that a user is currently taking. Sort of like, here are the links for your specific error, but also some links that will always be helpful while taking course STAT 4XX. Basically have students setup options at the beginning of the semester for projects related to a specific course. Maybe develop some way to pass this information to students.

I think these options could be embedded in the .Rprofile shipped inside an RStudio Cloud base template on a per course basis.

Though, the current state of RStudio Cloud instances would have the .Rprofile always being placed in a visible area of the students project (e.g. in the /cloud/project/ directory). Thus, this may add an unnecessary distractor.

@coatless
Copy link
Collaborator Author

@daviddalpiaz let's aim to talk more in-depth about this during our meeting on Friday.

@daviddalpiaz
Copy link

Agreed on an in-depth conversation. I'm even more excited about this than the package I proposed last time. A couple notes:

  • Agreed that speed of generating the html could make or break this. If it's not nearly instant, I as a user would get annoyed.
  • I'm open to suggestions on which of those things we actually display for the user. Those were just my first reactions, not thinking about difficulty of implementation.
  • I didn't even think about how this would interact with RStudio Cloud. Pre-shipping this to students that way makes a ton of sense, skipping any setup for them.

@daviddalpiaz
Copy link

Also, now that I've thought about this for a second, I feel like I'm basically proposing Clippy for R.

@daviddalpiaz
Copy link

Another quick thought: check user's R, RStudio, and maybe package versions against current versions. If lagging, provide as much code as possible to automate the update procedure.

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

No branches or pull requests

2 participants