microsoft / vscode-cpptools

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

Support for vcxproj/sln projects #10140

Open wmmc88 opened 1 year ago

wmmc88 commented 1 year ago

Environment

I'm trying to use vscode with C++ projects originally created in Visual Studio. These projects are configured via .sln and .vcxproj files. The code navigation is very limited. I cannot "go to definition" or "go to delcaration" when those definitions and declarations are in other files. I believe this is because cpptools doesn't parse vcxproj and sln files in the same way that it parses compile_commands.json databases or other similar files.

Bug Summary and Steps to Reproduce

Bug Summary: "go to definition" or "go to delcaration" does not work when those definitions and declarations are in other files. This occurs in projects based on .vcxproj files

Steps to reproduce:

  1. Open a vcxproj/sln based project
  2. Click "Go To Declaration"
  3. editor doesnt show dclaration

Expected behavior

Ability to fully use all features that rely on cpptools knowing how the project is compiled.

Code sample and Logs

`c_cpp_properties.json`:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "mergeConfigurations": true
        }
    ],
    "version": 4
}


### Screenshots

_No response_

### Additional context

_No response_
sean-mcmanus commented 1 year ago

As of now I don't think we're going to add this. The workaround is to add alternative build files, such as CMakeLists.txt (or somehow generate a compile_commands.json or configure some other way).

wmmc88 commented 1 year ago

That's a shame 😕 I'm working with several large projects and it isn't feasible for me to create cmakelists manually for all iof them. I did look into generating a compile_commands json database but for msbuild, there's no 1st party support and I could not find any 3rd party support either.

github-actions[bot] commented 1 year ago

This feature request is being closed due to insufficient upvotes. Please leave a 👍-upvote or 👎-downvote reaction on the issue to help us prioritize it. When enough upvotes are received, this issue will be eligible for our backlog.

github-actions[bot] commented 1 year ago

This feature request has received enough votes to be added to our backlog.