live-share icon indicating copy to clipboard operation
live-share copied to clipboard

Can undo changes made by others

Open JosefForkman opened this issue 5 years ago • 73 comments

I think it's not right that you can regret the last thing you've done, even if it was the friend who had done it. can it be fixed or is it a function

Product and Version VSCode OS Version Windows Live Share Extension Version: latest Target Platform or Language PHP

Steps to Reproduce / Scenario:

  1. Write something
  2. ask your friend to push undo
  3. What you just wrote is gone
  4. See error

JosefForkman avatar Dec 17 '18 19:12 JosefForkman

Currently, the undo command will revert the last change in the document made by any participant.

We have experimented with making the undo command revert only the last change that you made in the document. But then we got feedback that many people actually did want to be able to undo others' changes. It's a tricky problem that we still haven't settled on how to handle in a way that meets everyones' expectations.

jasongin avatar Dec 18 '18 19:12 jasongin

can you make a request to his friend if it is going to happen. I mean to ask permission

JosefForkman avatar Dec 18 '18 19:12 JosefForkman

I suppose that could be possible, but I think it might get annoying.

In general, we assume the participants in a Live Share session are working together toward a common goal, and that you only let people edit your code if you trust them.

We highly recommend participants also have a voice chat session at the same time, whether that is via the Live Share Audio extension or any other communication tool that you prefer. Voice chat makes it much easier to coordinate the work among multiple people. Then you could easily verbally ask someone before undoing / changing something they just typed.

jasongin avatar Dec 18 '18 20:12 jasongin

ok, that may work

JosefForkman avatar Dec 18 '18 20:12 JosefForkman

I'm going to leave this issue open as a general feature request about improving collaborative undo behavior. Hopefully if others have related questions they can find this issue and give feedback.

jasongin avatar Dec 18 '18 22:12 jasongin

I tried Live Share and this issue is one of the first thing we realized was happening - the undo stack is shared.

I personally find value in having my own undo stack as I know what I did and want to act on that - I do also understand how having a shared undo stack could be potentially helpful to some.

Could this be a setting of some sort? I believe there are use cases for both usage, and such setting could alleviate this problem. I'm guessing such setting would take effect on the initial share of the project, but if it's possible to change it on the fly while a sharing session is in progress, this would be even better!

V-ed avatar Jan 02 '19 18:01 V-ed

I'm going to merge issue 1396 into this one.

daytonellwanger avatar Jan 02 '19 18:01 daytonellwanger

@V-ed how would you feel about us presenting a dialog when you attempt an undo and the last change was made by a participant aside from yourself? Something to the effect of

The last change was made by another user. What change would you like to undo?
My Last Change (ctrl+z) - Their Change (ctrl+z+g) - Don't ask again

Do you think we should have some indicator to alert you that the last change was made by another participant?

Any other suggestions on how to most intuitively and helpfully surface this behavior?

daytonellwanger avatar Jan 02 '19 18:01 daytonellwanger

@daytonellwanger I've read the conversations over in that other issue and indeed liked the idea of having a local and global undo stack that could be assigned to different keybinds.

I don't think a dialog like this would be ideal - it would be quite obtrusive as undos are quite frequent.

The idea I've got (following the linked issue's points) changes up again the default undo behavior, so take it with a grain of salt :

  • By default, undo the local stack of changes.
  • Using another keybind (Ctrl+Z+G as an exemple) can undo the global stack at any time.
  • If the changes made by collaborators intersects with your own set of changes, the undo still follows the keybind used, but if it was a local undo with collaborators edits, it also shows a notification (not a prompt , hoping that VS has notifications like VSCode) that says something similar to what you proposed :
A collaborator also made changes at the undo location. To undo their changes as well, you can use [Ctrl+Z+G].
{Use global undo instead} - {Don't ask again}

My wording isn't ideal (in my notification text example) and there are some flaws in that approach (such as using the global stack only on intersections might not actually undo the change in the intersection), but I'm not too sure how to handle such situation otherwise. This is heavy sided into the perspective of the local undo first and foremost, so I don't really know the best way to please everyone in this scenario. I'll keep thinking about it and bring more feedback here if I find some more ideas!

I'm heavily against dialogs that takes focus away from the project though, notifications are fine.

V-ed avatar Jan 02 '19 18:01 V-ed

Shared undo but specific to the document is the way to go imho. (I think that's the way it is today?)

lukepighetti avatar Feb 19 '19 20:02 lukepighetti

@lukepighetti this is the current behavior in VS Code, but not Visual Studio. Visual Studio implements "local" undo, meaning only your changes are undone (which is significantly more difficult to implement). Based on your comments on 1659 it sounds like you feel that global undo is always the correct behavior? Do you have any thoughts on the hybrid designs proposed in this thread? We're still really not sure about the best way to address this tricky problem.

daytonellwanger avatar Feb 19 '19 21:02 daytonellwanger

Perhaps this can be a global setting that will defer to the host's settings?

lukepighetti avatar Feb 20 '19 13:02 lukepighetti

We're currently refocusing on how to address this issue. It'd be super helpful if you all could provide scenarios where you think you would want/need global undo (that is, undo the last change regardless of who made it, not just your last change).

daytonellwanger avatar Apr 09 '19 00:04 daytonellwanger

I can't imagine a scenario where I want shared undo. When I'm using live-mode, I'm not tracking what my partner is doing closely enough to know be able to manage a shared undo. Often we are editing the same file, at different places, and talking about it. Shared undo just creates problems for us in that scenario.

lkilcher avatar Apr 26 '19 18:04 lkilcher

@daytonellwanger A few friends and I were using Live Share today to work on some small programming challenges together, where the code is often all in one file, but there are multiple methods that might be divided up among us. We frequently found that we'd try to undo something, but nothing would apparently change, and then another person would get very confused as to why the code they just wrote disappeared.

I think that at least having a setting for whether to control the global or local stack would be very useful.

dudeofawesome avatar May 16 '19 06:05 dudeofawesome

Personally, I haven't had the need for a shared undo. A setting for undo behaviour would be greatly appreciated.

Kethet avatar May 16 '19 09:05 Kethet

Yes, I think we've decided that the default behavior should be that undo undoes your last change. This is what an overwhelming percentage of users would want in an overwhelming amount of scenarios. This is the behavior in VS and we're working on making this the behavior in VS Code (it's technically a difficult problem to solve if there were edits made by other participants after your last edit).

daytonellwanger avatar May 16 '19 15:05 daytonellwanger

Very glad to hear that – I've just picked up the extension and this was the first thing my collaborators and I noticed. Whether there was a case for shared undo history at all is probably pretty questionable, but I'm happy to see this going forward.

boardfish avatar May 22 '19 11:05 boardfish

The times where I want global undo is when I'm pairing with a friend and showing them something, but want to take over after they're done typing and undo their change so I can fix it. I agree that local undo is overwhelmingly the desired thing to do, but it would be nice if there were a different hotkey for global undo.

skorokithakis avatar Feb 11 '20 12:02 skorokithakis

Has there been any progress on this?

I think this is the most annoying "feature" for me. It makes co-editing code in the same file very sticky. It'd be nice if there were multiple hotkeys (with the setting to choose the default) or at least a setting to disable this. At least for me, Pressing ctrl+z is a habitual thing if I realize I made a mistake (instead of selecting and deleting it). So if I and someone else are editing at the same time, it's pretty likely that I'll start undoing things that they are writing as they write them.

GeraldNDA avatar Mar 05 '20 19:03 GeraldNDA

Undo is a central part of the development process which involves trying and reverting if needed. Having a global undo makes it very difficult for two people to work on separate parts of the same file, which, to me, is an important scenario for using live-share.

artidoro avatar Mar 06 '20 20:03 artidoro

Thanks all for continuing to share your feedback. This helps greatly in our prioritization.

I think it's safe to say we've reached the agreement that undo should undo your changes by default (and we surface global undo via a separate command/shortcut).

The only reason that's not the behavior today is that it's a very technically challenging thing to implement and we haven't found cycles to tackle it yet. But it's on our radar and we really hope to get to it soon.

Thanks again for all the input on this thread!

daytonellwanger avatar Mar 06 '20 22:03 daytonellwanger

I know this is a slightly old issue, but I wanted to add a perspective that I didn't see mentioned. When people use LiveShare for the first time (or if they forget stuff in the moment) they will likely make some assumptions based on similar software they have previously used. Google Docs and Word Online are two popular examples, both of which have separate undo-stacks for each user. So personal preference aside, I would argue that it is at least likely to be more familiar (and thus more intuitive) to most users.

Anyway, just my two cents. Very much looking forward to the day where this is implemented 👍

tobloef avatar Aug 25 '20 10:08 tobloef

Thanks for your perspective @tobloef ! Definitely agreed.

daytonellwanger avatar Aug 25 '20 16:08 daytonellwanger

Having spent more time with VSCode Live Share I agree that the undo feature should match what people are used to from Google Drive applications.

lukepighetti avatar Aug 26 '20 19:08 lukepighetti

I came to this repo to file an issue about this topic, so I'm glad to see that there's been a lot of discussion already! My take after dozens of hours on Live Share is that I personally would prefer separate undo stacks, even though it does sound technically challenging. Hope to see it eventually!

nschmeller avatar Nov 02 '20 04:11 nschmeller

I'm probably not adding a new insight, but I do want to support the "local undo" choice and I hope that it get's implemented soon 😉 Due to Corona I've never used Live Share so intensely before, and it's absolutely awesome, but the global undo is quite frustrating. Basically we now have to tell each other: "Oops sorry I just un-did what you were doing, can you please stop typing so that I can fix it again and also fix my own edit that I was trying to undo." Get's annoying quickly 😅

But let me also stress again that I love Live Share and I'm super-grateful for all the work you're doing!

svdo avatar Nov 03 '20 20:11 svdo

Internal Tracking devdivcsef 412378

scgbear avatar Feb 03 '21 20:02 scgbear

@svdo - definitely echo your experience having come from shared office docs behaviour and looking at using this for some collaborative programming. Looks super useful though!

arjclark avatar Feb 12 '21 11:02 arjclark

Wouldn't it be the best solution to let the host choose in settings how it should be?

adelinn avatar Mar 28 '21 18:03 adelinn