microsoft / microsoft/vscode-cpptools

References on the destructor collapse to the whole type, or no results

Aperta
#14,630 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Feature: Find All References Language Service
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Environment

cpptools — References on the destructor mv::Vec2::~Vec2() collapse to the whole type

Field Value
Symbol (spec id) dtor-Vec2
Declaration ~Vec2(); (destructor)
Query position 1 src/mathvec.h:15:6 (cursor on Vec2, immediately after the ~)
Query position 2 src/mathvec.h:15:5 (cursor on the ~, immediately before Vec2)
Affected LSP request textDocument/references
Repro archive P1-dtor-Vec2.zip (this folder)

Summary

For query position 1

Find All References on the destructor of mv::Vec2 returns every mention of the Vec2 type instead of the two destructor sites — even though the cursor is on the destructor name after the tilde. Observed in VS Code with the C/C++ extension (cpptools).

For query position 2

Find All References on the destructor of mv::Vec2 returns no results. Observed in VS Code with the C/C++ extension (cpptools).

Environment

  • Editor: Visual Studio Code 1.33.5
  • Extension: C/C++ (ms-vscode.cpptools), default IntelliSense engine
  • Language standard: C++20 (freestanding fixture; no STL/toolchain required)

Steps to reproduce

  1. Extract P1-dtor-Vec2.zip and open the cpp-project folder in VS Code (C/C++ extension enabled).
  2. Optionally configure with CMake Tools (preset cdb); the fixture also parses under default C++20 IntelliSense.
  3. Open src/mathvec.h and place the cursor either immediately after the ~ in ~Vec2();, on Vec2 (line 15, col 6); or immediately before the ~, on the tilde itself (line 15, col 5).
  4. Invoke Find All References (Shift+Alt+F12).

Expected vs actual

Source Result count
Expected (both positions) 2
cpptools — query position 1 39
cpptools — query position 2 0

Expected (2): the declaration (mathvec.h:15) and the out-of-line definition (mathvec.cpp:11, Vec2::~Vec2()).

Actual — query position 1 (39): every occurrence of the Vec2 type (the same 39-item set as the constructor queries). Placing the cursor after the ~ does not restrict the query to the destructor — it collapses to "all mentions of the type."

Actual — query position 2 (0): no results at all.

Why it matters

Destructor references are used to reason about lifetime and teardown. Returning the whole type population makes that impossible and is especially surprising given the cursor is unambiguously on the destructor.

Bug Summary and Steps to Reproduce

Small repro soruce code:
P1-dtor-Vec2.zip

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia con il fixture estratto P1-dtor-Vec2.zip, in particolare src/mathvec.h:15 e la definizione del distruttore in src/mathvec.cpp:11. Esegui Find All References in entrambe le posizioni del cursore e segui la gestione di textDocument/references; il lavoro è completato quando entrambe le posizioni restituiscono esattamente la dichiarazione e la definizione out-of-line, anziché 39 riferimenti di tipo o nessun risultato.

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

Valutazione

Stack tecnologico
cpp
Ambito
devtools, search
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.