microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Extract to member function doesn't undo all workspace edits #12713

Open KKhanhH opened 1 month ago

KKhanhH commented 1 month ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: Undoing extract to member function fails across multiple files.

test.h

#pragma once
class Test {
    public:
     void DoSomething();

     void NewFunction(int &x, int &y);
};

test.cpp

#include "test.h"

void Test::DoSomething() {
    int x = 0;
    int y = 1;

    x += y;
    y -= x;
}

Steps to reproduce:

  1. Select any code in DoSomething
  2. Extract to member function
  3. After extraction, ctrl-z repeatedly to undo the extraction in the same file
  4. Undo will not apply to the header file, and will fail with the given error: image

Expected behavior: Undo workspace edits to successfully undo all changes across all files

Configuration and Logs

-------- Diagnostics - 9/13/2024, 12:36:01 PM
Version: 1.21.6
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/USER/Projects/test_bugs/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22621.0",
    "compilerPath": "cl.exe",
    "cStandard": "c17",
    "compilerPathInCppPropertiesJson": "cl.exe",
    "compilerArgs": [
        "/permissive-",
        "/MT"
    ],
    "cppStandard": "c++17",
    "intelliSenseMode": "msvc-x64",
    "intelliSenseModeIsExplicit": true,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "c:/Users/USER/Projects/test_bugs/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.21.6.0
Translation Unit Mappings:
[ C:\Users\USER\Projects\test_bugs\test.cpp - source TU]:
[ C:\Users\USER\Projects\test_bugs\test.h - source TU]:
Translation Unit Configurations:
[ C:\Users\USER\Projects\test_bugs\test.cpp ]:
    Process ID: 25900
    Memory Usage: 60 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
    Includes:
    System Includes:
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
    Other Flags:
        --no_ms_permissive
[ C:\Users\USER\Projects\test_bugs\test.h ]:
    Process ID: 28848
    Memory Usage: 59 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
    Includes:
    System Includes:
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
    Other Flags:
        --no_ms_permissive
Total Memory Usage: 120 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5013

Other Extensions

No response

Additional context

No response

sean-mcmanus commented 1 month ago

Yeah, this is an issue we were not aware of.