REditorSupport / REditorSupport/vscode-R

Support for `$` autocompletion in nested lists

Open
#1,389 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request stale
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Is your feature request related to a problem? Please describe.
Sometimes, I'm using nested lists, for example

l <- list(a1 = list(b = 3, c = list(1, 2, d = list(e = 3))), a2 = 4, a3 = 5)

The existing autocompletion feature when using the $ selector is very handy to bring up the possible elements:
image
However, if one tries to use the $ operator on a sublist, no autocompletions are available:
image
If I'm manipulating a nested list from, say, an external package, I don't always know what the elements of a nested list are (and they're not always documented). So it would be nice to see them directly within the code editor.

Perhaps this is because autocompletions only appear when an object is evaluated. Hence, a potential workaround is assigning l$a1 to an intermediate variable and using $ on that.

Describe the solution you'd like
When selecting elements of a nested list using multiple $, the elements of the nested list should appear as auto-suggestions.

Describe alternatives you've considered
One can assign an intermediate, temporary variable and then use the $ selector on that. Obviously, one could also print the list of elements in the terminal, but the presentation is much nicer when it's integrated into the code editor.

Additional context
I've really enjoyed using this extension! It's incredibly useful :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing $ autocompletion behavior in the VS Code extension and how it evaluates R objects. Reproduce the nested-list example from the issue, then verify that chained selectors such as l$a1$ show the nested elements without breaking existing suggestions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.