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

R6 member name completion after Dollar on "Tab" keystroke #43

Closed
jmp75 opened this issue Feb 9, 2015 · 4 comments
Closed

R6 member name completion after Dollar on "Tab" keystroke #43

jmp75 opened this issue Feb 9, 2015 · 4 comments

Comments

@jmp75
Copy link

jmp75 commented Feb 9, 2015

Context

I am the author of the rClr (R - .NET interop) package and considering R6 as a way to expose .NET objects via reference classes. I started using the R reference classes some months ago but bumped into several issues. R6 may be a better option.

Feature request

One important feature I'd think is a boon to user experience is code completion after the $ separator on object members. I think these are features of the Rcpp, rJava and rJavax packages, using utils::.DollarNames and related facilities. I am not familiar with the details.

I have forked R6, and may consider implementing these features, unless:

  • There are design considerations against supporting it
  • Someone else is already doing is, or feels more familiar with the mechanics to tackle it.
@gaborcsardi
Copy link
Member

👍

@wch
Copy link
Member

wch commented Feb 9, 2015

Interesting -- I wasn't aware of utils::.DollarNames. For the record, this is also related to #30.

@wch
Copy link
Member

wch commented Jun 22, 2015

Tab completions appear to just work with R6 in R 3.2.1, so maybe there was a change in R to support this?

I've tested this in RStudio and with R at the terminal, both in Linux.

AC <- R6Class("AC",
  public = list(
    x1 = 1,
    x2 = 2
  )
)
a <- AC$new()

# Press [tab] after this
a$

@wch wch closed this as completed Jun 22, 2015
@peekxc
Copy link

peekxc commented Feb 19, 2019

Very minor request, but is it possible to extend this in a nested manner?

Consider amended example:

AC <- R6Class("AC",
              public = list(
                  x1 = function(){ invisible(self) },
                  x2 = 2
              )
)
a <- AC$new()

While code completion works for x1, one cannot see x2 or any other members with, e.g.

a$x1()$

Whereas this is possible w/ magrittr pipes, e.g.
mtcars %>% select(mpg, cyl) %>% select( ) # [tab] yields remaining columns

I understand this is a bit trickier, and only works if the member function returns self, but nonetheless would be nice for workflows which naturally rely on R6's method chaining.

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

4 participants