microsoft / microsoft/vscode-cpptools
Mistakenly squiggle under struct member inside a struct
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Windows10 & Linux (Ubuntu22)
- VS Code Version: 1.83.1
- C/C++ Extension Version: 1.17.5
- If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce
Bug Summary:
The pointer variable test2 is mistakenly squiggled (pointer to incomplete class type), though location of an include file that declare the TestStruct2 struct is explicit.
By opening test.h and going back to test.c, the squiggle disappears.
Note1: The struct of pointer variable test1 is also declared inside the include file, that is not squiggled.
Note2: The problem is also true on Linux with gcc.
Steps to reproduce:
- Place the
test.handtest.c(inside test.zip) at the same directory - Open
test.cwith VSCode - Wait C/C++ extension process finish
- See error
Expected behavior:
The squiggles should not appear.
Configuration and Logs
(Only for Windows version)
Log Diagnostics:
================
-------- Diagnostics - 11/1/2023, 3:26:27 PM
Version: 1.17.5
Current Configuration:
{
"name": "Win32",
"includePath": [
"c:/home/xxxxxxx/documents/Desktop/vscode/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64",
"compilerPathInCppPropertiesJson": "cl.exe",
"intelliSenseModeIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"mergeConfigurations": false,
"compilerPathIsExplicit": false,
"browse": {
"path": [
"c:/home/xxxxxxx/documents/Desktop/vscode/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.17.5.0
Translation Unit Mappings:
[ C:\home\xxxxxxx\documents\Desktop\vscode\test.c ]:
C:\home\xxxxxxx\documents\Desktop\vscode\test.c
Translation Unit Configurations:
[ C:\home\xxxxxxx\documents\Desktop\vscode\test.c ]:
Process ID: 7252
Memory Usage: 50 MB
Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
Includes:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt
Defines:
_DEBUG
UNICODE
_UNICODE
Standard Version: ms_c17
IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 50 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5097
Language Server:
=================
loggingLevel: Debug
cpptools version (TypeScript): 1.17.5
cpptools version (native): 1.17.5.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: cpptools/queryCompilerDefaults (id: 1)
LSP: cpptools/queryCompilerDefaults (id: 2)
LSP: cpptools/didChangeCppProperties (id: 3)
LSP: textDocument/didOpen: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c
LSP: cpptools/activeDocumentChange: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c
LSP: cpptools/textEditorSelectionChange
Code browsing service initialized
Attempting to get defaults from C++ compiler in "compilerPath" property: 'cl.exe'
Attempting to get defaults from C compiler in "compilerPath" property: 'cl.exe'
Folder: C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/PROFESSIONAL/VC/TOOLS/MSVC/14.29.30133/ATLMFC/INCLUDE/* will be indexed
Folder: C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/PROFESSIONAL/VC/TOOLS/MSVC/14.29.30133/INCLUDE/* will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/CPPWINRT/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/SHARED/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/UCRT/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/UM/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/WINRT/ will be indexed
Folder: C:/HOME/xxxxxxx/DOCUMENTS/DESKTOP/VSCODE/ will be indexed
Discovering files...
Processing folder (non-recursive): C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/PROFESSIONAL/VC/TOOLS/MSVC/14.29.30133/ATLMFC/INCLUDE
Processing folder (non-recursive): C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/PROFESSIONAL/VC/TOOLS/MSVC/14.29.30133/INCLUDE
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/CPPWINRT/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/SHARED/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/UCRT/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/UM/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.18362.0/WINRT/
Processing folder (recursive): C:/HOME/xxxxxxx/DOCUMENTS/DESKTOP/VSCODE/
Discovering files: 5097 file(s) processed
2 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
LSP: cpptools/getInlayHints: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 4)
LSP: cpptools/getCodeActions: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 5)
tag parsing file: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\CodeAnalysis\sourceannotations.h
sending compilation args for C:\home\xxxxxxx\documents\Desktop\vscode\test.c
include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\VC\TOOLS\MSVC\14.29.30133\INCLUDE
include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\VC\TOOLS\MSVC\14.29.30133\ATLMFC\INCLUDE
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.18362.0\UM
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.18362.0\UCRT
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.18362.0\SHARED
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.18362.0\WINRT
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.18362.0\CPPWINRT
define: _DEBUG
define: UNICODE
define: _UNICODE
stdver: ms_c17
intelliSenseMode: windows-msvc-x64
Checking for syntax errors: C:\home\xxxxxxx\documents\Desktop\vscode\test.c
Queueing IntelliSense update for files in translation unit of: C:\home\xxxxxxx\documents\Desktop\vscode\test.c
Error squiggle count: 2
Update IntelliSense time (sec): 1.972
LSP: Message ignored due to no registered handler: $/setTrace
LSP: cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
LSP: cpptools/getFoldingRanges: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 6)
LSP: Message ignored due to no registered handler: $/setTrace
LSP: cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: cpptools/getSemanticTokens: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 7)
Enhanced Colorization is enabled.
LSP: cpptools/getCodeActions: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 8)
LSP: Message ignored due to no registered handler: $/setTrace
LSP: cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: cpptools/getDocumentSymbols: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 9)
Enhanced Colorization is enabled.
tag parsing file: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\CodeAnalysis\sourceannotations.h
LSP: $/cancelRequest (<unknown/completed>, id: 6)
LSP: cpptools/getCodeActions: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 10)
LSP: cpptools/getFoldingRanges: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 11)
LSP: cpptools/getCodeActions: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 12)
LSP: cpptools/getFoldingRanges: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c (id: 13)
LSP: cpptools/activeDocumentChange: file:///c%3A/home/xxxxxxx/documents/Desktop/vscode/test.c
LSP: cpptools/textEditorSelectionChange
Other Extensions
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the test.c and test.h files from the attached test.zip and reproduce the diagnostics after opening test.c, then test.h. Compare the IntelliSense behavior and logs for test1 and test2; done means the valid test2 pointer no longer receives an incomplete-class squiggle when its included declaration is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100