microsoft / microsoft/vscode-cpptools

Variable annotation hint error

Open
#14,066 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Ubuntu 24.04.3 LTS
  • VS Code Version:1.106.3 bf9252a2fb45be6893dd8870c0bf37e2e1766d61 x64
  • C/C++ Extension Version: 1.28.3
  • If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce

Bug Summary:

Image

Using similar
(int a, //asd
b, //dx
)
The method creates multiple variables, when using variable b later, it displays the comment of variable a, i.e., asd, but it should be dx

Configuration and Logs
No configuration in c_cpp_properties.json

Running C/C++: Log Diagnostics :
-------- Diagnostics - 2025/11/30 11:10:31
Version: 1.28.3
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/fufu/项目/C/c4/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "linux-clang-x64",
    "compilerPathInCppPropertiesJson": "/usr/bin/clang",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.toml": "toml"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": 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.28.3.0
Current database path: /home/fufu/.cache/vscode-cpptools/6e915ae8f1608d34a99382d070a9ccfc/.browse.VC.db
Translation Unit Mappings:
[ /home/fufu/项目/C/c4/c4.c - source TU]:
Translation Unit Configurations:
[ /home/fufu/项目/C/c4/c4.c ]
    Process ID: 13134
    Memory Usage: 24 MB
    Compiler Path: /usr/bin/clang
    Include paths:
        system include: /usr/lib/llvm-18/lib/clang/18/include
        system include: /usr/local/include
        system include: /usr/include/x86_64-linux-gnu
        system include: /usr/include
    Standard Version: c17
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=180103
Total Memory Usage: 24 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 8537
Other Extensions

background: Background Modification Plugin(The issue still exists after disabling the plugin)
Chinese (Simplified) (简体中文) Language Pack for Visual Studio Code: Provide Chinese pages for Chinese developers

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in c4.c using the reported C17 and clang configuration, with the parameter comments shown in the report; c_cpp_properties.json has no custom configuration. Start from the C/C++ extension's variable annotation or inlay-hint handling, and consider the issue done when variable b displays its own comment, dx, rather than a's asd.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.