Skip to content

Emit R6Class methods as workspace symbols #861

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lionel-
Copy link
Contributor

@lionel- lionel- commented Jun 30, 2025

Addresses posit-dev/positron#6549

  • Add a bunch of tests for the workspace indexers which were not tested before.

  • Add a new indexed type Method. This is used to include R6Class methods in workspace symbols but exclusing them from completions.

  • Indexers now push symbols onto a list instead of returning a single symbol to their callers. This allows a single indexer to handle multiple symbols.

  • The assignment handler now pushes R6Class method symbols in addition to the assigned object.

QA Notes

Add the following to a file:

class <- R6::R6Class(
    'class',
    public = list(
      initialize = function() 'initialize',
      foo = function() {
        1
      }
    ),
    private = list(
      bar = function() {
        2
      },
      not_indexed1 = NULL
    ),
    other = list(
      not_indexed2 = function() {
        3
      }
    )
  )

These symbols should now be available as Workspace symbols (# prefix in command palette): initialize(), foo(), bar() and you should be able to jump straight to the definition of these methods from any file.

The symbols starting with not_indexed should not be available.

All this is tested on the backend side.

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

Successfully merging this pull request may close these issues.

1 participant