REditorSupport / REditorSupport/languageserver

[FR] support language services for functions inside of an environment

Open
#524 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
675
Forks
118
Avg merge
1d 37m
Merged PRs (30d)
11

Description

I often use "environment" as the namespace of R, so that I can manage the name conflicts in a large R project. Also, it's much easier to find the source of the function, with such "namespace".

However, using this pattern in VSCode R is not very convenient, as it can't provide any parameter info when calling functions inside of an environment (or a list).

It's probably difficult to provide "static" analysis for environment functions. But I think, at least we should use the current session info, as RStudio IDE does.

Thanks.

normal_fun <- function(a, b) {
  a + b
}

env <- new.env()
env$fun <- function(a, b) {
  a + b
}

# move curser on normal_fun, vscode tips the arguments; type a inside the bracket, it hints `a` is an argument
normal_fun()

# in contrast, a function inside an environment loses such ability
env$fun()
image

Contributor guide

No contributing guide indexed for this repository

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 language-server entry point that provides parameter information, using the issue's normal_fun and env$fun examples as the comparison case. Determine how current-session information could identify functions stored in environments or lists, and consider the work complete when calls such as env$fun() receive the same parameter hints as normal_fun().

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.