vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Support for `$` autocompletion in nested lists

Open Ben-Drucker opened this issue 2 years ago • 2 comments
trafficstars

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 :)

Ben-Drucker avatar Jun 30 '23 17:06 Ben-Drucker