microsoft / microsoft/vscode-cpptools

Mistakenly squiggle under struct member inside a struct

Aperta
#11,602 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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.
image

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.

image

Steps to reproduce:
  1. Place the test.h and test.c (inside test.zip) at the same directory
  2. Open test.c with VSCode
  3. Wait C/C++ extension process finish
  4. 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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con i file test.c e test.h dell’allegato test.zip e riproduci le diagnosi dopo aver aperto prima test.c e poi test.h. Confronta il comportamento di IntelliSense e i log per test1 e test2; il lavoro è completato quando il puntatore valido di test2 non riceve più una sottolineatura ondulata per classe incompleta quando la relativa dichiarazione inclusa è disponibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, cpp, typescript
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.