Header file with duplicate name but unique directory not identified by intellisense

未关闭
#14,539 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
cpp, vscode

调研方向

在不同项目中放置重复的 Resources/common.h 文件,以复现报告中的布局,然后在比较 ProjectA/SourceA.cpp 和 ProjectB/SourceB.cpp 的同时检查扩展的 IntelliSense 诊断和调试日志。跟踪扩展如何识别并索引 header:此时 go-to-definition 可以成功,但标识符仍无法解析。完成标准是两个项目本地 header 都已建立索引,并且引用解析时没有红色波浪线。

由索引模型根据 Issue 内容生成。

描述

by design Feature: Configuration Language Service
Bug Summary

I am using VSCode to work on source files from a large Visual Studio solution with many projects. Each project has its its own directory with various source files, and a subfolder for resource headers.

Solution/
├─ ProjectA/
│ ├─ Resources/
│ │ ├─ common.h
│ ├─ SourceA.cpp
├─ ProjectB/
│ ├─ Resources/
│ │ ├─ common.h
│ ├─ SourceB.cpp

ProjectA/Resources/common.h will only ever be referenced by source files within the ProjectA directory.
The issue with this is each of these resource headers has the same filename, so the intellisense database will only process the first one it finds. This is usually the first project folder alphabetically.
When running intellisense, on the above example, references to ProjectA/Resources/common.h by ProjectA/SourceA.cpp are resolved.
References to ProjectB/Resources/common.h by ProjectB/SourceB.cpp are not resolved and result in red squiggles with "identifier XYZ is undefined"

However when I click on the identifier in Source.B and select "go to definition" the extension correctly opens ProjectB/Resources/common.h and jumps to the selected identifier.

Configuration and Logs

This behavior is found in the default configurations. I have not been able to find a change to the configuration that alters this behavior.

Debug log diagnostics do not display anything unusual or useful.

Environment
  • OS and Version: Win 11 25H2
  • VS Code Version: 1.125.1 (issue identified on earlier versions)
  • C/C++ Extension Version: 1.33.0 (issue identified on earlier versions)
主要语言
TypeScript
星标
6.2k
派生
1.7k
平均合并
14 小时 46 分钟
30 天内合并 PR
61

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/vscode-cpptools 的其他 Issue

查看 microsoft/vscode-cpptools 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。