microsoft / microsoft/vscode-cpptools

User-defined keywords lead to incorrect function documentation popup text

Offen
#9,386 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug Language Service Visual Studio
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das Hover-Verhalten in main.cpp mithilfe der bereitgestellten Makros und verfolge anschließend die Hover- und Dokumentationsverarbeitung der C++-Erweiterung für benutzerdefinierte Klassen-Schlüsselwörter. Als erledigt gilt die Aufgabe, wenn Funktions-Hover die Funktionsdokumentation für baz, baaz und baaaz anzeigen und dabei die bereits funktionierenden Fälle erhalten bleiben; füge Regressionstests hinzu oder führe sie aus, falls der relevante Testort identifiziert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, typescript, vscode
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.