microsoft / microsoft/vscode-cpptools

Extract to member function doesn't undo all workspace edits

Open
#12,713 1 comment 0 reactions 1 assignee View on GitHub

@sean-mcmanus is already working on this.

Since Sep 13, 2024.

bug Feature: Extract to function investigate: repro Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.