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

Aperta Adatta ai principianti
#17,575 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
devtools

Direzione di ricerca

Leggi extensions/positron-r/src/provider.ts ed esamina i due selettori di pattern in R_DOCUMENT_SELECTORS. Riproduci il duplicato aprendo le modifiche Git di un file R modificato e cercando un simbolo con # in Quick Open. Aggiungi lo schema file a entrambi i selettori, quindi conferma che la ricerca restituisce un risultato e che le copie di git diff non ricevono più queste funzionalità del linguaggio R.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
4.4k
Fork
207
Merge medio
1g 16h
PR unite (30g)
308

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di posit-dev/positron

Tutte le issue di posit-dev/positron

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.