R: Workspace symbol search shows duplicate results that open read-only editors

Open Beginner friendly
#17,575 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
devtools

Research direction

Read extensions/positron-r/src/provider.ts and inspect the two pattern selectors in R_DOCUMENT_SELECTORS. Reproduce the duplicate by opening Git changes for a modified R file and searching for a symbol with # in Quick Open. Add the file scheme to both selectors, then confirm the search returns one result and git diff copies no longer receive these R language features.

Written by the indexing model from the issue text.

Description

area: kernels lang: r

When an R file has uncommitted git changes and a diff of it is open, searching for a symbol (#name in Quick Open) lists the symbol twice with the same label, e.g. save_pdf R/live.R. One result opens the real file. The other opens a read-only editor showing the HEAD version of the file. Each extra git copy that is open (staged version, other diff views) adds another duplicate.

Steps to reproduce
  1. Open a folder that is a git repo and contains an R file with a function, e.g. R/live.R with save_pdf <- function(x) x.
  2. Edit and save R/live.R so it shows as modified.
  3. Run Git: Open Changes on the file.
  4. Open Quick Open and type #save_pdf.

Expected: one result. Actual: two save_pdf R/live.R results; picking the second opens a locked, read-only live.R with the old contents.

Cause

R_DOCUMENT_SELECTORS in extensions/positron-r/src/provider.ts includes { language: 'r', pattern: '**/*.{r,R}' } without a scheme, so it matches R documents under any scheme. The git: documents that back diff editors are synced to ark, which indexes them as separate files and returns them from workspace/symbol with their git: URIs. VS Code only merges symbols with identical URIs, and the label service shows the git: URI relative to the workspace folder, so both rows look the same.

Ark itself is not doing anything wrong: it only indexes the documents it is sent.

Suggested fix

Add scheme: 'file' to the two pattern selectors in R_DOCUMENT_SELECTORS. This also stops other LSP features (diagnostics, hover, etc.) from running on read-only git copies.

Positron 2026.12.0, ark 0.1.252+519.646f572, macOS.

Originally discovered by @Hadley.

Dominant language
TypeScript
Stars
4.4k
Forks
207
Avg merge
1d 16h
Merged PRs (30d)
308

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from posit-dev/positron

All issues in posit-dev/positron

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.