References and Call Hierarchy are wrong for constructors
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- cpp, typescript
- Área
- devtools
Línea de trabajo
Extrae P1-ctor-Widget-int.zip y reproduce las consultas de src/widget.h contra los sitios de construcción de main.cpp y la definición en widget.cpp. Compara textDocument/references y callHierarchy/incomingCalls con los recuentos esperados documentados. Se considera terminado cuando el constructor devuelve únicamente su declaración, definición y dos sitios de construcción, y aparecen ambos llamadores entrantes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
cpptools — References and Call Hierarchy are wrong for the constructor ui::Widget::Widget(int)
| Field | Value |
|---|---|
| Symbol (spec id) | ctor-Widget-int |
| Declaration | explicit Widget(int id); |
| Query position | src/widget.h:13:14 (cursor on Widget) |
| Affected LSP requests | textDocument/references, callHierarchy/incomingCalls |
| Repro archive | P1-P1-ctor-Widget-int.zip (this folder) |
Summary
Two independent defects hit the same constructor when it is queried in VS Code with the C/C++ extension (cpptools):
- Find All References returns every mention of the
Widgettype instead of the actual construction sites (over-count). - Show Call Hierarchy → Show Incoming Calls returns nothing, so the constructor looks like it is never called (false "no callers").
The correct (expected) results are shown below.
Environment
- Editor: Visual Studio Code 1.33.5
- Extension: C/C++ (
ms-vscode.cpptools), default IntelliSense engine - Language standard: C++20 — the fixture is freestanding (no STL/toolchain needed to parse)
Steps to reproduce
- Extract
P1-P1-ctor-Widget-int.zipand open thecpp-projectfolder in VS Code with the C/C++ extension enabled. - Optionally configure with CMake Tools (preset
cdb) so cpptools picks upcompile_commands.json; the freestanding fixture also parses under default C++20 IntelliSense. - Open
src/widget.h, place the cursor onWidgetinexplicit Widget(int id);(line 13, col 14).
Adding a full repro in P1-ctor-Widget-int.zip attached file.
P1-ctor-Widget-int.zip
Defect 1 — textDocument/references
- Invoke Find All References (
Shift+Alt+F12).
| Source | Result count |
|---|---|
| Expected | 4 |
| VS Code / cpptools | 28 |
Expected (4): the declaration (widget.h:13), the out-of-line definition (widget.cpp:9, Widget::Widget(int id)), and the two Widget(int) construction sites in main.cpp — the static ui::Widget storage(42); initializer in allocWidget() and ui::Widget b(7); in main().
Actual (28): every occurrence of the ui::Widget type — the typedef, the g_current pointer, the takeWidget/makeDefault/allocWidget/asConst parameter and return types, the Serializer<ui::Widget> specialization, and the type-mention lines in widget.cpp — none of which construct an object. A references query on the constructor collapses to "every mention of the enclosing type."
Defect 2 — callHierarchy/incomingCalls
- With the cursor at the same position, invoke Show Call Hierarchy and expand Incoming Calls.
| Source | Result count |
|---|---|
| Expected | 2 |
| VS Code / cpptools | 0 |
Expected (2): incoming calls from allocWidget() (the storage(42) construction at main.cpp:29) and from main() (the b(7) construction at main.cpp:55).
Actual (0): the Call Hierarchy view shows no callers, i.e. the constructor appears to be dead.
Why it matters
- The empty incoming-calls result is a false "no callers" on live code: an automated agent (or a developer) can conclude
Widget(int)is never used and delete/prune construction paths that are actually exercised. - The reference over-count means "where is this object constructed?" cannot be answered, the list is dominated by unrelated type mentions.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode-cpptools
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Abiertobug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 asignado ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 comentario · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
microsoft/vscode-cpptools#14769 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
microsoft/vscode-cpptools#14768 · 1 comentario ·
Todos los issues de microsoft/vscode-cpptools
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
copse-dev/agent-pane#2953 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Abiertobug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Client support matrix inclusion Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
calcite-components needs triage refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Esri/calcite-design-system#15203 ·