microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.46k stars 1.53k forks source link

Inaccurate Go-to-Implementation for Functions with the Same Name in C++ #12715

Open feng-xys opened 6 days ago

feng-xys commented 6 days ago

Environment

Bug Summary and Steps to Reproduce

Description: When working on a C++ project in Visual Studio Code, I encounter an issue where clicking on a function call in a header file does not directly navigate to the correct function definition when there are multiple functions with the same name across different classes. Instead, VSCode presents a list of all matching functions, requiring manual selection. Steps to Reproduce:

  1. Create two or more C++ classes each containing a function with the same name.

  2. Include these headers in a source file.

  3. Attempt to navigate to the implementation of the function by clicking on its declaration in the header file. Expected Behavior: Visual Studio Code should ideally be able to discern the correct function implementation based on context and directly navigate to it without needing user intervention.

Actual Behavior: A dropdown appears listing all implementations of the function with the same name, necessitating manual selection of the intended function.

Expected Behavior: Visual Studio Code should ideally be able to discern the correct function implementation based on context and directly navigate to it without needing user intervention. Actual Behavior: A dropdown appears listing all implementations of the function with the same name, necessitating manual selection of the intended function.

Configuration and Logs

c_cpp_properties.json
{
    "configurations": [
        {
            "name": "M33",
            "includePath": [
                "${workspaceFolder}/**",

            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "USE_HAL_DRIVER",
                "STM32H563xx",
                "PLATFORM_CORTEX_M33",
                "_GNU_SOURCE",
                "_POSIX_TIMERS"
            ],
            "compilerPath": "/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-g++",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-arm"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

sean-mcmanus commented 4 days ago

I don't repro the bug. This normally is supposed to work if everything is working properly. Can you provide more repro info, such as the contents of the repro files?