microsoft / microsoft/vscode-cpptools

Adding implementation to a method that is an override of a virtual method doesn't work.

Aperta
#13,573 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Feature: Create Declaration or Definition Language Service regression
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Environment
  • OS and Version: Windows 11 (build 26120)
  • VS Code Version: 1.99.3
  • C/C++ Extension Version: 1.25.3

I have C++ header file with ".hpp" extension, the header is included by the implementation file with ".cpp" extension. Both file exist and I can easily switch between them with appropriate functions.

Now, when I type:

void test();

Move cursor to the first letter of the test function and press Ctrl+. I get Implement option, that will automatically create the implementation of MyClass::test() method, but ONLY if it's not a virtual method. If in the base class virtual void test() { } exists, then the the option doesn't show and I can't create automatic implementation, that is clearly a regression, because I'm almost sure it worked in previous version of the extension.

It also doesn't work properly for code like this:

void test() override;
Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior:

Configuration and Logs
-------- Diagnostics - 4/30/2025, 1:13:27 PM
Version: 1.25.3
Current Configuration:
{
    "name": "STM32H757",
    "includePath": [
        "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include",
        "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/include",
        "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/include-fixed",
        "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include/c++/13.3.1",
        "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include/c++/13.3.1/arm-none-eabi",
        "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7e-m+dp/hard",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Configuration",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Tools",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Tools/c",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/HMI",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/HMI/c",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Drivers/Custom",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Drivers/HAL_EX",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Drivers/CMSIS/Include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Drivers/CMSIS/Device/ST/STM32H7xx/Include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Drivers/STM32H7xx_HAL_Driver/Inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Drivers/STM32H7xx_HAL_Driver/Inc/Legacy",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/Core/Inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/AZURE_RTOS/App",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/FileX/App",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/FileX/Target",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/USBX/App",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/USBX/Target",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/App",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/target/generated",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/target",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Utilities/JPEG",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/Middlewares/ST/touchgfx/framework/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/generated/fonts/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/generated/gui_generated/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/generated/images/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/generated/texts/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/generated/videos/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/CM7/TouchGFX/gui/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/threadx/common/inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/threadx/ports/cortex_m7/gnu/inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/filex/common/inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/filex/ports/generic/inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/usbx/common/core/inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/usbx/common/usbx_host_classes/inc",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/usbx/common/usbx_stm32_host_controllers",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Middlewares/ST/usbx/ports/generic/inc",
        "D:/Tools/vcpkg/packages/catch2_x64-windows-static/include",
        "d:/Source/CodeDog/Products/GMD_H757_Riverdi/Tests/Helpers"
    ],
    "defines": [
        "STM32H757xx",
        "USE_HAL_DRIVER",
        "CORE_CM7",
        "TX_INCLUDE_USER_DEFINE_FILE",
        "TX_SINGLE_MODE_NON_SECURE=1",
        "FX_INCLUDE_USER_DEFINE_FILE",
        "UX_INCLUDE_USER_DEFINE_FILE",
        "__weak=__attribute__((weak))",
        "__packed=__attribute__((__packed__))",
        "__FPU_PRESENT=1U",
        "DEVICE=1",
        "DEBUG"
    ],
    "compilerPath": "d:/arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-g++.exe",
    "compilerArgs": [
        "-Wall",
        "-Wextra",
        "-Wsign-compare",
        "-Wconversion",
        "-Wsign-conversion",
        "-mcpu=cortex-m7",
        "-mfpu=fpv5-d16",
        "-mfloat-abi=hard",
        "-mthumb"
    ],
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "gcc-arm",
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    },
    "mergeConfigurations": false,
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPathInCppPropertiesJson": "d:/arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-g++.exe",
    "recursiveIncludes": {}
}
Modified Settings:
{
    "C_Cpp.inlayHints.autoDeclarationTypes.enabled": true,
    "C_Cpp.inlayHints.autoDeclarationTypes.showOnLeft": true,
    "C_Cpp.inlayHints.parameterNames.enabled": true,
    "C_Cpp.inlayHints.referenceOperator.enabled": true,
    "C_Cpp.suggestSnippets": false,
    "C_Cpp.default.intelliSenseMode": "windows-gcc-arm",
    "C_Cpp.default.compilerPath": "d:/arm/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-g++.exe",
    "C_Cpp.default.cStandard": "c17",
    "C_Cpp.default.cppStandard": "c++17",
    "C_Cpp.vcFormat.indent.gotoLabels": "none",
    "C_Cpp.vcFormat.indent.namespaceContents": false,
    "C_Cpp.clang_format_path": "clang-format.exe",
    "C_Cpp.formatting": "disabled",
    "C_Cpp.clang_format_fallbackStyle": "Microsoft",
    "C_Cpp.debugShortcut": false
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.h": "c",
        "*.hpp": "cpp",
        "*.c": "c",
        "*.cpp": "cpp",
        "ostream": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "bit": "cpp",
        "*.tcc": "cpp",
        "cctype": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "compare": "cpp",
        "concepts": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "unordered_map": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "algorithm": "cpp",
        "functional": "cpp",
        "iterator": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "random": "cpp",
        "string": "cpp",
        "string_view": "cpp",
        "system_error": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "utility": "cpp",
        "initializer_list": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "new": "cpp",
        "ranges": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "cinttypes": "cpp",
        "typeinfo": "cpp",
        "stm32u5xx_hal.h": "c",
        "ctime": "cpp",
        "chrono": "cpp",
        "format": "cpp",
        "span": "cpp",
        "charconv": "cpp",
        "ratio": "cpp",
        "variant": "cpp",
        "sstream": "cpp",
        "numbers": "cpp",
        "map": "cpp",
        "set": "cpp",
        "iomanip": "cpp"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.25.3.0
Current database path: C:\USERS\ADAM\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\2911F51978AED1FC09A96040C3686F2D\.BROWSE.VC.DB
No active translation units.

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 18287
Other Extensions

No response

Additional context

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo l’azione Ctrl+. nella configurazione .hpp e .cpp segnalata, confrontando un metodo normale con dichiarazioni virtual e override. Il lavoro è completato quando l’azione viene proposta per entrambi i casi virtual e crea correttamente l’implementazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, typescript
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.