REditorSupport / REditorSupport/vscode-R

LSP (e.g. Go to Definition) not working across files with source

Open
#1,593 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I find that all the language server features seem to be unaware of sourced files. This includes "Go to Definition" and "Go to Symbol in Workspace". It also won't pull in completions and tool tips from libraries.

It does work when I have the sourced file open (regardless of whether I actually source the file).

It also works when I use the exact R package directory setup (per chat GPT).

myproject/
├── DESCRIPTION            # <- triggers package behavior
├── R/
│   ├── functions.R        # <- put your function definitions here
├── scripts/
│   └── test.R

However, if I remove the DESCRIPTION or rename the R/ directory (e.g. to "lib") then it stops working.

This seems way more brittle than necessary. Why not just do a recursive walk and index all .r files starting from the workspace directory? At minimum, it would be nice to document this so that future users don't have to go through this whole discovery process.

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

Reproduce the two workspace layouts described in the issue, including the DESCRIPTION/R structure and the renamed lib layout. Start by tracing how the extension discovers R files and connects them to language-server features; done means cross-file definitions, workspace symbols, completions, and tooltips work without requiring files to be open, or the discovery rules are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.