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

Arrows to revert changes in side by side diff editor #151826

Merged

Conversation

Mingpan
Copy link
Contributor

@Mingpan Mingpan commented Jun 11, 2022

This PR fixes

  1. Revert selected range for deleted blocks #98096, because it allows to revert a delete change.
  2. Copy/replace/add left <-> right in compare views #25887 (partially), because it allows to move a change from left to right in the compare / side-by-side-diff view.

Description

This PR adds left -> right arrows in the side-by-side diff editor. When an arrow is clicked, the corresponding change will be reverted on the right hand side editor.

Breakpoints can still exist in side-by-side editor as usual. Though a breakpoint cannot be set on a line that already has an arrow.

Screencast

arrow-revert

Example with breakpoints:
Arrow-and-brakpoint

If there's anything that needs to be improved / fixed in the code, please let me know, thanks!

@hediet hediet assigned hediet and unassigned alexdima Jun 13, 2022
@hediet hediet added this to the June 2022 milestone Jun 13, 2022
@hediet
Copy link
Member

hediet commented Jun 13, 2022

Thanks a lot for the PR!

Let's merge this and wait for feedback.
If the breakpoint thing is a blocker, we can still revert.

@Sebi2020
Copy link

Sebi2020 commented Jun 13, 2022

@hediet does this only apply to changes made with git or to the compare view in general? You've closed #25887, but the issue targeted also the "compare selection" as far as I understand.

@Mingpan
Copy link
Contributor Author

Mingpan commented Jun 13, 2022

The feature does not depend on git. Normal compare views like "Select for compare" from the explorer right click context menu should also contain these arrows.

@tarekahf
Copy link

When it'll be released?

@AnrDaemon
Copy link

I suggest you take Insiders build and check the functionality. It could be more easily adjusted when it's still hot.

@tarekahf
Copy link

I suggest you take Insiders build and check the functionality. It could be more easily adjusted when it's still hot.

How I can do that? Can you please point me to the steps?

@alexdima
Copy link
Member

@tarekahf You can install VS Code Insiders side-by-side with VS Code Stable.

@tarekahf
Copy link

@tarekahf You can install VS Code Insiders side-by-side with VS Code Stable.

Thanks a lot. I'll give it a try when possible. Fir now, I want to know the planned release date.

@hardyoyo
Copy link

The feature does not depend on git. Normal compare views like "Select for compare" from the explorer right click context menu should also contain these arrows.

While it is great to see VScode getting this very basic functionality for merging diffs from git, @Mingpan is correct, this is not the only glaring lack of an ability to merge diffs. The compare tool needs these arrows, too. I can't believe I have to manually copy/paste diffs when comparing files in VScode.

@Sebi2020
Copy link

@hardyoyo As far as I understood Mingpang's answer to my question this feature is also available in the normal compare tool.

@hardyoyo
Copy link

@Sebi2020 Oh! That would be cool. I'm downloading the Insiders version now, and we will see. I'll report back if this is correct.

@hardyoyo
Copy link

Can confirm, sort of, it looks like it makes an assumption about which way you'll want to be copying a diff, and when comparing files, that will require some awareness before selecting files to compare... I assume the order in which you click the files affects the direction of the arrow. Here's a sliver of a screenshot:
image
As you can see, the diff is presented as a deletion on one side, and an addition on the other, but you only get one arrow. Two arrows would be nice, and would be a good usability improvement.

@gulshan
Copy link

gulshan commented Jun 22, 2022

An option to switch sides in the comparison menu, when two editable files are being compared, will be helpful in this regard also, IMHO.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants