2

I've been having this issue with vscode on my mac where when I hover or call system functions it doesn't show their description, it just shows the arguments with no explanation whatsoever. I tried using the MS C/Cpp extension and its default intellisense and switched to clangd and neither worked. In contrast, when I'm using CLion it shows everything perfectly fine. Does anyone have any ideas as to how to fix this issue? It's been driving me insane.

Reference screenshots

vscode using C/Cpp Intellisense:
vscode_1

vscode using clangd:
vscode_2

using Clion:
clion

I have gcc installed via Homebrew and I have my paths set up correctly so it's before /usr/bin and everything but my issue still persists.

Neither clang's nor gcc's headers have comments on my macOS.

starball
  • 20,030
  • 7
  • 43
  • 238
meshal
  • 33
  • 6
  • @HolyBlackCat I think their "_it does_" is saying "[that post](/q/73326790/) and its answer does explain the cause of the issue here". since they immediately followed by saying "_neither clang's nor gcc's headers have comments on my macOS_". – starball Feb 01 '23 at 09:04

1 Answers1

1

Neither clang's nor gcc's headers have comments on my macOS.

That's part of the issue. The vscode-cpptools extension creates mousover popups based on documentation comments in the headers of the standard library being used for the project (see this question and my answer there: Visual Studio Code Intellisense doesn't show function documentation for C++). The clangd extension also does this from what I can see in the screenshot on its readme's section on hover and inlay hints (the screenshot of its inlay hints shows the same doc comment above my installation of gcc's bits/basic_string.h size() function).

So if you want a solution, install a standard library where the headers have doc comments.


Side note: 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.

starball
  • 20,030
  • 7
  • 43
  • 238
  • Thanks for the explanation! I tried finding a standard library with comments for macOS but haven't had any luck. Looks like the extension is a good alternative to quickly check the definitions, thanks! – meshal Feb 01 '23 at 09:20
  • 1
    To add to this, the way CLion shows documentation is probably that they ingest it from an external source (like `man` page archives), and associate it with functions called in your code. It's a nice feature, and there's an [issue](https://github.com/clangd/clangd/discussions/1315) on file for something similar for clangd, but obviously it's not trivial to implement. – HighCommander4 Feb 03 '23 at 05:55