microsoft / microsoft/vscode-cpptools
User-defined keywords lead to incorrect function documentation popup text
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Brief Issue Summary
I observed that the popup on mouseover displays the class documentation instead of the function documentation after user-defined keywords while working on a project that uses Qt. The documentation would be incorrect for the first 'signal' after the 'signals' keyword or the first 'slot' after the 'slots' keyword.
After some tests it seems to me that any user defined 'keyword' in a class declaration that is non-standard can cause this. But when a semicolon is added after the keyword (see function 'baaaaz') or the ':' when the keyword is used as access specifier.
The following code should reproduce the behavior:
#define PROTECTED protected // same for Qt's 'signals' and 'slots'
#define MARKER
// class foo
class foo
{
protected:
// function bar
void bar(){} // function doc works
PROTECTED:
// function baz
void baz(){} // class doc displayed
MARKER
// function baaz
void baaz(){} // class doc displayed
public MARKER:
// function baaaz
void baaaz(){} // class doc displayed
MARKER;
// function baaaaz
void baaaaz(){} // function doc works
};
About-Info:
Version: 1.67.2 (system setup)
Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
Date: 2022-05-17T18:15:52.058Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.19044
Installed extensions:
bierner.markdown-mermaid
cschlosser.doxdocgen
fredericbonnet.cmake-test-adapter
GitHub.vscode-pull-request-github
hbenl.vscode-test-explorer
IBM.output-colorizer
idleberg.haskell-nsis
idleberg.nsis
matepek.vscode-catch2-test-adapter
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
ms-vscode.test-adapter-converter
ms-vsliveshare.vsliveshare
tht13.html-preview-vscode
twxs.cmake
vscode-icons-team.vscode-icons
yzhang.markdown-all-in-one
Disabling all extensions except ms-vscode.cpptools, twxs.cmake and ms-vscode.cmake-tools did not resolve the problem.
CMake Tools Diagnostics
{
"os": "win32",
"vscodeVersion": "1.67.2",
"cmtVersion": "1.10.5",
"configurations": [
{
"folder": "d:\\temp\\cmake_test",
"cmakeVersion": "3.20.3",
"configured": true,
"generator": "Visual Studio 15 2017",
"usesPresets": false,
"compilers": {}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug",
"Release",
"MinSizeRel",
"RelWithDebInfo"
],
"requests": [
"file:///d%3A/temp/cmake_test/main.cpp"
],
"responses": [
{
"uri": "file:///d%3A/temp/cmake_test/main.cpp",
"configuration": {
"defines": [
"WIN32",
"_WINDOWS",
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "c:/program files (x86)/microsoft visual studio/2017/professional/vc/tools/msvc/14.16.27023/bin/hostx64/x64/cl.exe",
"compilerArgs": [
"/DWIN32",
"/D_WINDOWS",
"/EHsc",
"/Zi",
"/Ob0",
"/Od",
"/RTC1",
"-MDd"
],
"forcedInclude": []
}
}
],
"partialMatches": [],
"targetCount": 3,
"executablesCount": 1,
"librariesCount": 0,
"targets": [
{
"name": "ALL_BUILD",
"type": "UTILITY"
},
{
"name": "ZERO_CHECK",
"type": "UTILITY"
},
{
"name": "cmake_test",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": false
}
]
}
Debug Log
[main] Building folder: cmake_test
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build ALL_BUILD
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/temp/cmake_test/build --config Debug --target ALL_BUILD -j 10 --
[build] Microsoft (R)-Build-Engine, Version 15.9.21+g9802d43bc3 für .NET Framework
[build] Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
[build]
[build] cmake_test.vcxproj -> D:\temp\cmake_test\build\Debug\cmake_test.exe
[cmakefileapi-parser] Read reply folder: d:\temp\cmake_test\build\.cmake\api\v1\reply
[cmakefileapi-parser] Found index files: ["cache-v2-980a6d47311a203dab4b.json","codemodel-v2-58e69dfe636bbba44f32.json","index-2022-06-01T09-31-38-0958.json","target-ALL_BUILD-Debug-91a196090d5775a66cd9.json","target-ALL_BUILD-MinSizeRel-91a196090d5775a66cd9.json","target-ALL_BUILD-Release-91a196090d5775a66cd9.json","target-ALL_BUILD-RelWithDebInfo-91a196090d5775a66cd9.json","target-cmake_test-Debug-8f03cceca3277767524a.json","target-cmake_test-MinSizeRel-843648a35f2a2201d1e2.json","target-cmake_test-Release-68bc7f63270a2e7d50a6.json","target-cmake_test-RelWithDebInfo-c52032589702cb55ae4a.json","target-ZERO_CHECK-Debug-434a17f91b7a4bbf371b.json","target-ZERO_CHECK-MinSizeRel-434a17f91b7a4bbf371b.json","target-ZERO_CHECK-Release-434a17f91b7a4bbf371b.json","target-ZERO_CHECK-RelWithDebInfo-434a17f91b7a4bbf371b.json","toolchains-v1-561ee6e580cc0310872a.json"]
[build] Build finished with exit code 0
[cache] Reading CMake cache file d:/temp/cmake_test/build/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [9721] cmake.build finished (returned 0)
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the hover behavior in main.cpp using the supplied macros, then trace the C++ extension's hover and documentation handling for user-defined class keywords. Done means function hovers show the function documentation for baz, baaz, and baaaz while preserving the working cases; add or run regression coverage if the relevant test location is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100