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

Allow to undo/redo edits across multiple files #638

Closed
lukehoban opened this issue Nov 25, 2015 · 8 comments
Closed

Allow to undo/redo edits across multiple files #638

lukehoban opened this issue Nov 25, 2015 · 8 comments
Assignees
Labels
editor-textbuffer Editor text buffer feature-request Request for new features or functionality on-testplan workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@lukehoban
Copy link
Member

When you do a rename operation that makes edits in multiple files, undo does not correctly undo the edits in files other than the active document.

// In a.ts
export function foo() {}

// In b.ts
import { foo }  from './a'
foo();

Rename from the usage of foo() to foo3. Then undo. The code now reports errors on the import because the definition in a.ts is still foo3.

I believe this affects any extension which provides a WorkspaceEdit crossing multiple files.

@jrieken jrieken added the feature-request Request for new features or functionality label Nov 26, 2015
@jrieken
Copy link
Member

jrieken commented Nov 26, 2015

Yeah, we never got around doing that...

@jrieken
Copy link
Member

jrieken commented Nov 26, 2015

@alexandrudima pretty please ;-)

@egamma egamma modified the milestone: Backlog Dec 10, 2015
@alexdima alexdima removed their assignment Aug 30, 2016
@bpasero bpasero removed the workbench label Nov 16, 2017
@prmichaelsen
Copy link

I agree this would be nice to have :)

@backspaces
Copy link

I just got bit by this: did a global search, 96 results in 6 files. This was the first day using vscode.

In the file explorer, there was an odd icon that I thought was to expand/contract the results in one of the 6 files. So I used that a few times just checking out how vscode worked.

Imagine my surprise when I searched again for the same word and got no results! At first I thought it was a configuration that left those files out of the subsequent searches. Then I found out it was the result of "replacing" the search response with a blank replace field! I.e. deleting the search word.

Then I found it was not undo-able! And no warning like if I had tried to do a replace in all 6 files.

Luckily I had thought to copy over a folder to test vscode, so no data lost. Whew. I also use Dropbox which would also have let me restore the files. But this seems to be both a questionable UI/UX, and a serious design flaw.

The editor I used before (atom) did not have an option to replace only in the given file.

I would at least offer a pop-up when doing an irrevertible action.

Is there a setting I could use to make sure I don't inadvertently fall prey to this if I do chose to continue on with vscode?

@backspaces
Copy link

Edit: I just noticed this only happens if I click on the search field's arrow icon exposing the Replace field. So a vanilla search is safe, but if you drop down the replace field, the odd icon appears that performs the replace in the given file.

Search only:
snap 04 21 18-15 57 05

Replace exposed:
snap 04 21 18-15 57 37

Clicking the small square icon to the left of the X will replace all within that file.

@backspaces
Copy link

backspaces commented Apr 21, 2018

Here's a possible UX change:

  • First, make the small icon for replacing in the file a bit more obvious, clearer that it is a replace all in file.
  • Second, when it is clicked, change to the file's editor so that the replacement is obviously done there.

.. or simply use a "are you sure" dialog to replace all in that file.

It is odd having both a [] icon and an X icon so close to each other as well.

@alexdima alexdima added editor-textbuffer Editor text buffer workbench-editors Managing of editor widgets in workbench window and removed editor labels Sep 20, 2018
@bpasero bpasero changed the title Undo doesn't correctly undo multi-file edits Allow to undo/redo edits across multiple files Sep 20, 2018
@jabacchetta
Copy link

Agreed on this. VSCode simply can not be used for large refactors as is. I have to open up WebStorm (which will undo everything from that refactor command).

@alexdima
Copy link
Member

This has been implemented for workspace edits, i.e. rename across files -- test plan item - #91248

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-textbuffer Editor text buffer feature-request Request for new features or functionality on-testplan workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests

9 participants