-
Notifications
You must be signed in to change notification settings - Fork 317
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
Hyperlinks #1544
Hyperlinks #1544
Conversation
🚀 Enregistrement.de.l.ecran.2022-01-07.a.12.27.04.mov |
This no longer needs dev version of |
This comment has been minimized.
This comment has been minimized.
* identify ansi hyperlinks * unused * HYPERLINK_REGEX only matching one anchor code (rather than both) * attempt to render <a> in the console output * only match at start * handle urls in ClassRange * Adding style xtermUnderline to link <span> * retain both url and params in Hyperlink class * use Event.setEventListener() instead of onclick attribute * add consoleFollowHyperlink() rpc method * prepare to use consoleFollowHyperlink() * unused * Update src/cpp/session/modules/SessionRCompletions.R * add text to console_follow_hyperlink rpc method * invoke the console_follow_hyperlink rpc * handle links with type=help:topic=<fun> * type=file -> .rs.api.navigateToFile() * type=viewer * define R_CLI_HYPERLINKS=true in build sessions * rather define R_CLI_HYPERLINKS in the main session and let it be copied on build sessions * Add and use Hyperlink.getTitle() * no longer user [params] for dispatch to action, just use url * unused import * fix file handler when no location is given * use the uri scheme to dispatch. use `[params] = target=viewer` to open in viewer * using file:(line):(col) syntax * parse name=value: params * remove local variable hyperlink_code, simplify. * Apply suggestions from code review Co-authored-by: Kevin Ushey <kevin@rstudio.com> * describe params= and rm the unused funs * - obsolete comment * rm _ suffix for public members * rm _ suffix * just rely on browseURL() to follow help links * handle rstudio:help scheme, and rstudio:print * shelf the serialization idea, use params for `rstudio:help` * only needs first thing * Add style xtermHyperlink to themes * Revert "Add style xtermHyperlink to themes" This reverts commit ad55c22. * no longer add xtermUderline style automatically * rstudio:viewer as a prefix * typo * update comment about `file://` handler * apply style xtermHyperlink to links, currently doing nothing * default style dor xtermHyperlink in the themes. Cancelled if other cli style is applied * add color to xtermHyperlink class * Improve link title * special url `rstudio:run` to send code to the console * allow the form `rstudio:run:code` * fix file:// handling * hyperlink artifically add underline, italic and magenta styles * Apply suggestions from code review Co-authored-by: Kevin Ushey <kevin@rstudio.com> * Not adding italic to links by default * Us params for file:// links, because :suffix don't work in e.g. iTerm. see r-lib/testthat#1544 (comment) * make <a> instead of <span> * remove unintentionally added import * col was not correctly inialized * no longer set the href ad params attributes * no longer set the href and params attrinutes * specify cursor: pointer in .xtermHyperlink css class. * unused import * squeeze in a VirtualConsoleServerOperations interface * import * inject VirtualConsoleServerOperations in VirtualConsole ctor * Fake VirtualConsoleServerOperations in tests * inject VirtualConsoleServerOperations in the constructor * + unit test * news bullet * Apply suggestions from code review Co-authored-by: Kevin Ushey <kevin@rstudio.com> * Remove ... in NEWS * missing , * missing argument Co-authored-by: Kevin Ushey <kevin@rstudio.com>
@romainfrancois is this ok to merge, do you think? |
Yes I think so. Probably not worth advertising it in the NEWS yet though, as this will need a spotted-wakerobin (2022-06) build of rstudio. |
It will also happen in terminals that cli detects hyperlink support for, e.g. iTerm2. |
code_accept <- paste0("snapshot_accept('", name, "')") | ||
code_review <- paste0("snapshot_review('", name, "')") | ||
link <- function(code) { | ||
cli::style_hyperlink(code, paste0("rstudio:run:testthat::", code)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaborcsardi should we be doing something so that this only appear as a link in the ide ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind.
I think it’s worth a news bullet even if it only works in an upcoming release. @lionel- we should definitely include this in the next release. |
Is this ready to be merged? |
Yes, we might follow up in r-lib/cli#416 to only display the |
Proof of concept to display link in the test results.
After clicking the link, this opens the file at the requested line/col:
currently needs rstudio/rstudio#10299