Create Declaration / Definition with wrong name space (and possibly scope) in C
还没有人认领这个 Issue。
评估
调研方向
在 main.c 中使用 static 函数和 struct 参数复现该问题,然后调用 “C/C++: Create Declaration/Definition” 命令并检查生成的 main.h。跟踪该命令的声明生成入口,并添加覆盖,以确保 static 声明保留在 main.c 中且保留 struct 说明符;完成标准是生成的两个声明都仍然是有效的 C。
由索引模型根据 Issue 内容生成。
描述
Environment
- OS and Version: Windows 11 Pro 22H2
- VS Code Version: 1.79.2
- C/C++ Extension Version: 1.16.3
Bug Summary and Steps to Reproduce
Bug Summary:
Steps to reproduce:
- Create a new C source file, as "main.c"
- Add the definition of some
staticfunctions; create some with astructtype parameter - Position the cursor on a function name
- Recall with ctrl+shift+P the function "C/C++: Create Declaration/Definition"
- A file named "main.h" is opened and the prototype added
- Note that
- even if the function is declared as
statica prototype is created in another file/header ("main.h") - only if you have the precedent function already declared in "main.c" then the prototype goes to "main.c" as well (expected behavior)
- if your function has
structparameters thestructtype specifier is removed, e.g.static int foo(struct MyStruct *p) {}becomesstatic int foo(MyStruct *p);which is unlikely workable, as tag space differs from identifiers space in C
Expected behavior:
- The declaration of
staticfunctions shall/should always be directed to the same file the functions are in - The
structtype specifier shall always be retained in C, as it directs identifiers in the tag namespace
Configuration and Logs
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.22621.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x86",
"configurationProvider": "ms-vscode.makefile-tools",
}
],
"version": 4
}
Other Extensions
No response
Additional context
No response
- 主要语言
- 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 小时 新手友好度 78/100
-
area:tools bug good first issue help wanted priority:P2
难度 2/5 1-3 小时 新手友好度 90/100
TaewoooPark/Motifcode#14 ·
-
bug 🐞
难度 2/5 1-3 小时 新手友好度 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
BasedHardware/omi#15320 ·
-
难度 2/5 半天 新手友好度 78/100
vercel/vercel-plugin#199 ·