R6 icon indicating copy to clipboard operation
R6 copied to clipboard

Functions not being properly recognized in 2.6.1

Open lukakoning opened this issue 10 months ago • 4 comments

In version 2.6.1, functions are not properly recognized when accessing via '$' sign. This means you can no longer see it is a function, you don't get the automatic '()' when accessing it, and you also aren't shown the arguments of the function.

For illustration, this is how they used to show in 2.5.1:

Image

Now in 2.6.1:

Image

I am on:

R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

(RSTudio 2024.09.0 Build 375)

lukakoning avatar Mar 10 '25 10:03 lukakoning

Does it exhibit that behavior with this code?

library(R6)
AC <- R6Class("AC",
    public = list(
        x = 1
    )
)

a <- AC$new()

# Press <tab> below
a$

And if not, can you provide a reproducible example?

wch avatar Mar 10 '25 16:03 wch

@wch With this I can reproduce it:

AC <- R6::R6Class(
  "AC",
  public = list(
    x = 1,
    y = function(some_argument = "default") {
      print(some_argument)
    }
  )
)

a <- AC$new()

So then under 2.6.1 you see 'y' as a regular (purple) field and not as a function (blue):

Image

This is how it should be (correct under 2.5.1 and also 2.6.0):

Image

So then it seems related to the change made in 2.6.1 regarding ".DollarNames.R6(), avoid use of NextMethod()" (#298).

I was not able to reproduce on my personal PC where I was using R 4.4.2 and also R 4.1.3, but with a newer build of RStudio. So it may be related to the RStudio IDE most likely, as the change made in 2.6.1 was also made for an issue with the RStudio IDE. To recall, this bug occurs under RSTudio 2024.09.0 Build 375.

lukakoning avatar Mar 11 '25 07:03 lukakoning

Does the issue persist with the latest daily builds of RStudio? https://dailies.rstudio.com

kevinushey avatar Mar 11 '25 16:03 kevinushey

The issue occurs on my work device where I unfortunately cannot install a newer version of RStudio. But on my personal PC where I run a newer version of RStudio I cannot reproduce the issue. So it's likely related to the older RStudio builds (RSTudio 2024.09.0 Build 375 on my work device).

lukakoning avatar Mar 12 '25 18:03 lukakoning