Visual Studio Code Intellisense doesn't show function documentation for C++
Asked Answered
S

1

6

I followed this C/C++ for Visual Studio Code article from Microsoft to write C++ using Visual Studio Code. Unlike the article showing that intellisense provides documentation for member functions, it doesn't show me any. Same thing also happens in Visual Studio 2019 too. Here is a screenshot of how my intellisense looks.

What I tried to fix it so far:

  • Reinstall VSCode (deleted the app data as well)

Edit*

Configuration Files

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe",
            "cStandard": "c17",
            "intelliSenseMode": "windows-msvc-x64",
            "cppStandard": "c++14"
        }
    ],
    "version": 4
}

settings.json

{
    "files.associations": {
        "xstring": "cpp"
    }
}

tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: cl.exe build active file",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "/nologo",
                "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
Sworn answered 11/8, 2022 at 20:55 Comment(8)
That seems like a very short set up considering that most folk using visual studio code need to edit a couple JSON configuration files to get the compiler and intellisence working correctly.Bangui
Required JSON files are automatically created by default values after selecting the Microsoft's compiler. I should have included them anyway, my bad. @user4581301. I'll edit the question.Sworn
Created, yes, but I supposed I've gotten used to people using VS Code over top of GCC or clang and having to fill in a few blanks that VS Code couldn't answer itself.Bangui
Any reason not to use VS proper (such an unfortunate choice of names, Microsoft)? It's way better, you know.Carmelcarmela
@PaulSanders If you meant why I don't use Visual Studio instead of Visual Studio Code, because it is more practical for me.Sworn
@Bangui Whether I use GCC or Microsoft compiler, the problem persists. I still can't see documentation.Sworn
With the GCC version I wouldn't expect documentation, there isn't any linkage between the but with the Visual Studio tools I share your confusion if it's supposed to be there. I don't get it in MSVC either and never noticed it was missing because I didn't expect it. Just the list of matching members. Perhaps we are both missing an optional package that adds in library documentation or heavily documented headers that intellisence parses to show extra information.Bangui
@Bangui That might be the reason. I really hope I can find a solution. Accessing member function documentation via IDE is so convenient.Sworn
P
6

The documentation shown in the mouseover tooltip is generated from the standard library source files configured to be used. The screenshot from the VS Code docs is from a setup using gcc's c++ standard library implementation, libstdc++, which has c++ comments containing that documentation. Since you are using Visual Studio, you are using Microsoft's implementation of the c++ standard library. Browsing through their headers, it seems that the Microsoft STL doesn't include such documentation comments.

You could ask a question on their discussion board to ask if there are good workarounds/alternatives, or (politely) ask why they don't maintain such documentation comments, or if they have plans to in the future.

I haven't used this, but you may be interested to try this VS Code extension: Guyutongxue.cpp-reference (I have no affiliation with this extension), which

is a tool to browse cppreference.com from within vscode, instead of going to the browser to do so. You can use this extension to search for library and methods documentation of the C++ standard.

Pergrim answered 15/8, 2022 at 21:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.