Skip to content

Comment tooltip not shown with variable defined though a preprocessor macro. #12949

Open
@arandomdev

Description

@arandomdev

Environment

  • OS and Version: Windows 11
  • VS Code Version: 1.95.2
  • C/C++ Extension Version: 1.22.11
  • If using SSH remote, specify OS of remote machine: N/A

Bug Summary and Steps to Reproduce

Bug Summary: When defining variables using a preprocessor macro, the comment doesn't get shown in the tool tip.

Steps to reproduce:

#define SBIT(x) int x

/// @brief This comment is not shown
SBIT(foo);
/// @brief This comment is shown
int bar;

void main() {
  foo = 0;
  bar = 0;
}

Image
Image

Expected behavior:
It would be great if the comment for the macro based definition was viewable, which would help greatly when documenting register names and their function.

Configuration and Logs

c_cpp_properties.json

{
    "C_Cpp.default.compilerPath": "cl.exe"
}


-------- Diagnostics - 11/10/2024, 11:32:59 AM
Version: 1.22.11
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/haow6/Desktop/projects/Test/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22621.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPath": "cl.exe",
    "compilerPathIsExplicit": true,
    "browse": {
        "path": [
            "c:/Users/haow6/Desktop/projects/Test/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.compilerPath": "cl.exe"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.11.0
Current database path: C:\USERS\HAOW6\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\552EB1B157B66100E3B6FBE5D82B5329\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\Users\haow6\Desktop\projects\Test\main.c - source TU]:
Translation Unit Configurations:
[ C:\Users\haow6\Desktop\projects\Test\main.c ]
    Process ID: 32920
    Memory Usage: 58 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe
    Includes:
    System Includes:
        C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 58 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 4958


loggingLevel: Debug
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.22.11
cpptools version (native): 1.22.11.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: Sending response (id: 1)
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
Compiler info database not connected - skipping load.
Compiler info database not connected - skipping load.
LSP: Sending response (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 3)
LSP: (received) cpptools/didChangeCppProperties (id: 4)
LSP: (received - deferred) textDocument/didOpen: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
Compiler info database not connected - skipping load.
LSP: (received - deferred) cpptools/didChangeVisibleTextEditors
LSP: (received - deferred) cpptools/getDocumentSymbols: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 5)
LSP: (received - deferred) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 6)
Compiler info database not connected - skipping load.
LSP: Sending response (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 4)
Code browsing service initialized
Populating file name cache...
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\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.40.33807\INCLUDE\* will be indexed
  Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT\ will be indexed
  Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\ will be indexed
  Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT\ will be indexed
  Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM\ will be indexed
  Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT\ will be indexed
  Folder: C:\USERS\HAOW6\DESKTOP\PROJECTS\TEST\ will be indexed
LSP: (queued) textDocument/didOpen: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
LSP: (queued) cpptools/didChangeVisibleTextEditors
LSP: (queued) cpptools/getDocumentSymbols: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 5)
LSP: (queued) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 6)
LSP: Sending response (id: 4)
LSP: (invoked) cpptools/getDocumentSymbols: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 5)
Discovering files...
LSP: (invoked) textDocument/didOpen: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: Sending response (id: 5)
Intellisense update pending for: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 6)
LSP: Sending response (id: 6)
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\
  Processing folder (non-recursive): C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.40.33807\INCLUDE
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT\
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT\
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM\
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT\
  Processing folder (recursive): C:\USERS\HAOW6\DESKTOP\PROJECTS\TEST\
  Discovering files: 4958 file(s) processed
  0 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
Done populating filename cache. Elapsed time: 103 ms
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 7)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 7)
LSP: Sending response (id: 7)
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
Resolving recursive includes...
Done resolving recursive includes.
sending compilation args for C:\Users\haow6\Desktop\projects\Test\main.c
  system include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.40.33807\INCLUDE
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT
  define: _DEBUG
  define: UNICODE
  define: _UNICODE
  stdver: ms_c17
  intelliSenseMode: windows-msvc-x64
Update IntelliSense time (sec): 0.044
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 8)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 8)
LSP: Sending response (id: 8)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
LSP: (received) cpptools/didChangeActiveEditor: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
LSP: (invoked) cpptools/didChangeActiveEditor: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
LSP: (received) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 9)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 9)
LSP: Sending response (id: 9)
LSP: (invoked) cpptools/didChangeTextEditorSelection
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c
Update IntelliSense time (sec): 0.002
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 10)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 10)
LSP: Sending response (id: 10)
LSP: (received) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 11)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 11)
LSP: Sending response (id: 11)
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 12)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 12)
LSP: Sending response (id: 12)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/hover: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 13)
LSP: (invoked) cpptools/hover: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 13)
LSP: Sending response (id: 13)
LSP: (received) cpptools/hover: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 14)
LSP: (invoked) cpptools/hover: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 14)
LSP: Sending response (id: 14)
LSP: (received) cpptools/hover: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 15)
LSP: (invoked) cpptools/hover: file:///c%3A/Users/haow6/Desktop/projects/Test/main.c (id: 15)
LSP: Sending response (id: 15)

Other Extensions

No other extensions were enabled.

Additional context

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Doc commentsAn issue related to code comments shown in hover, completion, and signature help.Language ServiceWorks in VSSo we'd need to fix it for VS Code to reach parity.bug

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions