Find All References on a variable template returns nothing
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- cpp, typescript
调研方向
从 P1-var-template-zeroValue.zip 开始,检查 src/extras.h:22 以及 main.cpp:150-151 中的使用位置。跟踪针对 variable-template 符号的 textDocument/references 处理,并将报告的结果与预期的三个引用进行比较。当 Find All References 返回声明和两个实例化使用位置时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Environment
cpptools — Find All References on the variable template ex::zeroValue returns nothing
| Field | Value |
|---|---|
| Symbol (spec id) | var-template-zeroValue |
| Declaration | template <class T> constexpr T zeroValue = T(0); (variable template) |
| Query position | src/extras.h:22:13 (cursor on zeroValue) |
| Affected LSP request | textDocument/references |
| Repro archive | P1-var-template-zeroValue.zip (this folder) |
Summary
Find All References on the variable template ex::zeroValue returns no references in VS Code with the C/C++ extension (cpptools), missing both instantiation uses. The symbol appears unused even though it is instantiated twice.
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
- Extract
P1-var-template-zeroValue.zipand open thecpp-projectfolder in VS Code (C/C++ extension enabled). - Optionally configure with CMake Tools (preset
cdb); the fixture also parses under default C++20 IntelliSense. - Open
src/extras.h, place the cursor onzeroValueinconstexpr T zeroValue = T(0);(line 22, col 13). - Invoke Find All References (
Shift+Alt+F12).
Expected vs actual
| Source | Result count |
|---|---|
| Expected | 3 |
| VS Code / cpptools | 0 (no references) |
Expected (3): the template declaration (extras.h:22) and its two instantiation uses in main() — ex::zeroValue<int> (main.cpp:150) and ex::zeroValue<double> (main.cpp:151).
Actual (0): "Find All References" reports no results (the instantiation uses are not found).
Why it matters
A false "no references" on a live symbol is high risk: an automated agent (or a developer) can conclude the variable template is dead and delete it, breaking the two instantiations.
Bug Summary and Steps to Reproduce
- 主要语言
- TypeScript
- 星标
- 6.2k
- 派生
- 1.7k
- 平均合并
- 14 小时 46 分钟
- 30 天内合并 PR
- 61
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/vscode-cpptools 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries 未关闭bug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 已指派 1 人 ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 条评论 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 64/100
microsoft/vscode-cpptools#14769 ·
-
难度 3/5 1-2 天 新手友好度 68/100
microsoft/vscode-cpptools#14768 · 1 条评论 ·
查看 microsoft/vscode-cpptools 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
calcite-components needs triage refactor
难度 2/5 1-3 小时 新手友好度 75/100
Esri/calcite-design-system#15203 ·
-
难度 2/5 1-3 小时 新手友好度 90/100
danielmiessler/LifeOS#2218 ·