saeidamiri1 / rbox

https://github.com/saeidamiri1/rbox/wiki
MIT License
22 stars 3 forks source link

Displaying help pages and errors/warnings #8

Open Kabouik opened 6 years ago

Kabouik commented 6 years ago

The wiki recommends using display(help(mean)) to display help pages from Rbox, but the function display() is not found on a default installation. I have not managed to find the corresponding R package for this function (I found some display() functions in some packages, but they seemed to be unrelated). Could you please indicate which package to install to make it work? Also, would it be possible to make a shortcut in Rbox with ?, to use ?mean instead of the long cumbersome display(help(mean)) if they are equivalent?

This is not exactly related, but I noticed that errors and warnings are sometimes difficult to read in Rbox, but I'm not sure whether this comes from Rbox or Hydrogen. It seems that the wrapping is messed up sometimes, and there is no easy way to distinguish between one error and the following because there is no clear separation in the output. Should I report it to the Hydrogen issue tracker? To be honest I have never extensively used Atom or IDEs in general so I'm not sure what components/plugins are doing what when I'm using Rbox.

saeidamiri1 commented 6 years ago

Try the following

library("IRdisplay") display(help(mean))

Kabouik commented 6 years ago

Thanks for your answer. I tried that and got the following warning:

> library("IRdisplay")
> display(help(mean))
Warning message:
In getOption("jupyter.base_display_func")(data, metadata) :
  IRdisplay can only be used from the IPython R kernel and R magic.

It is just a warning, but the help still isn't showing.

However, as a workaround, I'm opening an R console in Termination and running my script commands using Alt+R instead of Shift+Enter (but unfortunately, it means that Hydrogen is not triggered anymore and I cannot see the outputs in the Hydrogen's way). The workflow is relatively similar to that of Rstudio, except the outputs and help are not shown in a proper panel. I have added options(help_type = "html") at the top of my scripts so that I can display the help pages in a browser instead of the R console, it makes scrolling long help pages easier, and allows for better multi-monitor support.

Additionally, I just installed atom-ide-ui and ide-r packages in Atom, and was happily surprised by one of the features: now when I mouseover an R function in my script, the help documentation shows up as a temporary (meaning you don't have to close it afterwards) pop-up in Atom. It can be pinned too, if necessary. This is very convenient and goes very well with Rbox despite its limitation with help():

screenshot from 2018-03-21 16-16-50

Perhaps it could go as a recommendation in the wiki?

rosseji commented 6 years ago

@Kabouik Thanks for the tips very useful. I would like to use the floating help box that you mention, but after installing atom-ide-ui and ide-r I still can't get it to work with a mouseover... any tips?

Kabouik commented 6 years ago

Weirdly enough @rosseji, this doesn't seem to work on my end either now. I don't think I have changed anything in either R or Atom, except for package updates that I have kept installing.

That reminds me of something I noticed when I posted my above message. For some reason, when I open Atom with a R script tab, the code can be highlighted in two different ways:

screenshot from 2018-06-20 13 00 32

or

screenshot from 2018-06-20 12 59 27

I couldn't find any way to reproduce it. Just closing and re-opening Atom will sometime highlight the code in one way, sometimes in the other. Weird. And since it's not happening all the time, it would be painstaking to troubleshoot by disabling Atom packages one by one, because even in that case, I might have to re-open my script 40 times for each package disabled to see when I finally get only one syntax highlighting.

The syntax is automatically set to "R" in both cases (bottom right of Atom, and I have two entries named "R" there, but manually selecting one or the other does not change the highlighting), and I have no idea which packages are responsible for either color codes (but please let me know if you recognize the themes and know which Atom package does which theme).

The above might sound off-topic, but I do remember that the pop-up windows we were talking about only appeared when I had the highlighting shown in the first screenshot, not when the code was highlighted as in the second one. Now, is the second highlighting showing up only when the package responsible for the first one fails to load in time, or is it the other way around? I have no idea, but identifying respective packages might help understanding what prevents pop-ups windows now.

The pop-ups seem to be called Datatips and there is no doubt they come from atom-ide-ui according to this link. But they should show up with my current settings, so obviously they are inhibited by something else, maybe in atom-ide-ui or maybe by another package.

[Edit] Here is the list of my current packages:

~ $ apm list
Built-in Atom Packages (92)
├── atom-dark-syntax@0.29.0
├── atom-dark-ui@0.53.2
├── atom-light-syntax@0.29.0
├── atom-light-ui@0.46.2
├── base16-tomorrow-dark-theme@1.5.0
├── base16-tomorrow-light-theme@1.5.0
├── one-dark-ui@1.12.1
├── one-light-ui@1.12.1
├── one-dark-syntax@1.8.2
├── one-light-syntax@1.8.2
├── solarized-dark-syntax@1.1.4
├── solarized-light-syntax@1.1.4
├── about@1.8.1
├── archive-view@0.64.3
├── autocomplete-atom-api@0.10.7
├── autocomplete-css@0.17.5
├── autocomplete-html@0.8.4
├── autocomplete-plus@2.40.6
├── autocomplete-snippets@1.12.0
├── autoflow@0.29.3
├── autosave@0.24.6
├── background-tips@0.28.0
├── bookmarks@0.45.1
├── bracket-matcher@0.89.2
├── command-palette@0.43.5
├── dalek@0.2.2
├── deprecation-cop@0.56.9
├── dev-live-reload@0.48.1
├── encoding-selector@0.23.8
├── exception-reporting@0.43.1
├── find-and-replace@0.215.9
├── fuzzy-finder@1.8.1
├── github@0.14.5 (disabled)
├── git-diff@1.3.9 (disabled)
├── go-to-line@0.33.0
├── grammar-selector@0.50.1
├── image-view@0.62.4
├── incompatible-packages@0.27.3
├── keybinding-resolver@0.38.1
├── line-ending-selector@0.7.6
├── link@0.31.4
├── markdown-preview@0.159.20
├── metrics@1.2.6
├── notifications@0.70.5
├── open-on-github@1.3.1
├── package-generator@1.3.0
├── settings-view@0.254.2
├── snippets@1.3.3
├── spell-check@0.73.4
├── status-bar@1.8.15
├── styleguide@0.49.11
├── symbols-view@0.118.2
├── tabs@0.109.1
├── timecop@0.36.2
├── tree-view@0.222.0
├── update-package-dependencies@0.13.1
├── welcome@0.36.6
├── whitespace@0.37.5
├── wrap-guide@0.40.3
├── language-c@0.59.3
├── language-clojure@0.22.7
├── language-coffee-script@0.49.3
├── language-csharp@1.0.1
├── language-css@0.42.10
├── language-gfm@0.90.3
├── language-git@0.19.1
├── language-go@0.45.3
├── language-html@0.49.0
├── language-hyperlink@0.16.3
├── language-java@0.29.0
├── language-javascript@0.128.5
├── language-json@0.19.1
├── language-less@0.34.2
├── language-make@0.22.3
├── language-mustache@0.14.5
├── language-objective-c@0.15.1
├── language-perl@0.38.1
├── language-php@0.43.2
├── language-property-list@0.9.1
├── language-python@0.49.5
├── language-ruby@0.71.4
├── language-ruby-on-rails@0.25.3
├── language-sass@0.61.4
├── language-shellscript@0.26.3
├── language-source@0.9.0
├── language-sql@0.25.10
├── language-text@0.7.4
├── language-todo@0.29.4
├── language-toml@0.18.2
├── language-typescript@0.3.3
├── language-xml@0.35.2
└── language-yaml@0.32.0

Community Packages (36) ~/.atom/packages
├── Hydrogen@2.5.1
├── Sublime-Style-Column-Selection@1.7.4
├── asciidoc-preview@2.12.1
├── atom-beautify@0.32.5
├── atom-html-preview@0.2.5
├── atom-ide-ui@0.12.0
├── atom-language-r@1.4.8
├── atomic-chrome@0.3.3
├── autocomplete-R@0.6.0
├── autocomplete-asciidoc@0.1.2
├── busy-signal@1.4.3
├── chrome-color-picker@0.8.0
├── custom-title@1.0.1
├── expose@0.15.0
├── fold-comments@0.6.0
├── formatter@2.12.4
├── ide-html@0.4.2
├── ide-r@0.1.8
├── intentions@1.1.5
├── language-asciidoc@1.11.0
├── language-bbcode-and-syntax-highlight@1.0.5
├── markdown-preview-enhanced@0.15.6
├── minimap@4.29.8
├── minimap-autohider@1.5.4
├── minimap-bookmarks@0.4.2
├── minimap-cursorline@0.2.0
├── minimap-selection@4.5.0
├── open-recent@5.0.0
├── pen-paper-coffee-syntax@0.14.9
├── pigments@0.40.2
├── rbox@0.5.0
├── selection-highlight@0.1.6
├── seti-ui@1.10.0
├── sort-lines@0.18.0
├── sync-settings@0.8.6
└── termination@0.6.2