Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KKhanhH opened this issue Sep 13, 2024 · 1 comment
Open

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

KKhanhH opened this issue Sep 13, 2024 · 1 comment
Assignees
Labels
bug Feature: Extract to function Extract to function (free function or member function) investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service
Milestone

Comments

@KKhanhH
Copy link

KKhanhH commented Sep 13, 2024

Environment

  • OS and Version: Windows 10
  • VS Code Version: 1.91.1
  • C/C++ Extension Version: 1.21.6
  • If using SSH remote, specify OS of remote machine:

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 sean-mcmanus added bug Language Service investigate: repro This issue's repro steps needs to be investigated/confirmed Feature: Extract to function Extract to function (free function or member function) labels Sep 13, 2024
@sean-mcmanus sean-mcmanus added this to the 1.22 milestone Sep 13, 2024
@sean-mcmanus
Copy link
Collaborator

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

@sean-mcmanus sean-mcmanus self-assigned this Sep 13, 2024
@sean-mcmanus sean-mcmanus modified the milestones: 1.22, 1.23 Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Feature: Extract to function Extract to function (free function or member function) investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service
Projects
Status: Triage
Development

No branches or pull requests

2 participants