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 edit the left hand side of a diff editor if possible #4180

Closed
joaomoreno opened this issue Mar 14, 2016 · 30 comments
Closed

Allow to edit the left hand side of a diff editor if possible #4180

joaomoreno opened this issue Mar 14, 2016 · 30 comments
Assignees
Labels
diff-editor Diff editor issues feature-request Request for new features or functionality on-testplan workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@joaomoreno
Copy link
Member

You can hit it by using Compare with action and --diff. This is really sad. The editor on the left should only be read-only if the input behind it is really read-only (coming from the git index, for example).

cc @alexandrudima @bpasero

@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Mar 14, 2016
@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

Yes I always wanted that actually :)

@alexdima
Copy link
Member

On my side it would be pretty easy to just comment out the forcing of readOnly=true on the left-hand-side. But I need to add an option to allow the workbench to make the git diff case left-hand-side readOnly.

@alexdima
Copy link
Member

There's also the inline diff case, where I cannot make the "original" editable.

@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

@alexandrudima yeah I think we know in all places if the left hand side should be editable or not, I think it would only be the file-2-file compare where this applies.

@alexdima
Copy link
Member

Ok, there is a new option originalEditable to the diff editor. It is false by default.

@bpasero bpasero added this to the March 2016 milestone Mar 14, 2016
@bpasero bpasero self-assigned this Mar 14, 2016
@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

@alexandrudima cool, let me pick this up then...

@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

@alexandrudima so by default this option is true or false?

@alexdima
Copy link
Member

:) Wrote in comment and in jsdoc: it is false by default.

@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

👍

@bpasero bpasero modified the milestones: April 2016, March 2016 Mar 14, 2016
@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

Hm, I forgot that this adds a bit more complexity to how actions operate on the active editor and how dirty state is indicated. I think I was a bit too optimistic for March but will check. Otherwise April it will be.

@bpasero
Copy link
Member

bpasero commented Mar 14, 2016

Surprisingly lots of things actually do work in terms of dirty indication but the one for the actual editor does not because it only checks for the right hand side.

@bpasero bpasero added the file-explorer Explorer widget issues label Mar 14, 2016
@bpasero bpasero changed the title Can't edit left side of diff editor Allow to edit the left hand side of a diff editor if possible Mar 14, 2016
@nojvek
Copy link
Contributor

nojvek commented Mar 26, 2016

If this something that can be done as a first PR? Would be great if you could indicate issues that would be easy wins for an outsider to contribute. I really really really really want git diffing to work on the right side. I will buy you a coffee/beer if you fix this 😜

@bpasero
Copy link
Member

bpasero commented Mar 28, 2016

@nojvek you can always edit on the right hand side when comparing outgoing changes in git!

@bpasero
Copy link
Member

bpasero commented Mar 28, 2016

(this feature request is about being able to edit either the left hand or the right hand side when comparing 2 files)

@nojvek
Copy link
Contributor

nojvek commented Mar 29, 2016

Oh I just saw that after doing an upgrade. This seems fairly recent. This really bought me a lot of joy when it worked.

@bpasero
Copy link
Member

bpasero commented Mar 30, 2016

It was always possible to edit the right hand side of the diff editor for git changes view.

@bpasero bpasero added workbench-editors Managing of editor widgets in workbench window and removed file-explorer Explorer widget issues labels Nov 27, 2017
@bpasero bpasero removed this from the Backlog milestone Nov 27, 2017
@Yanpas
Copy link
Contributor

Yanpas commented Feb 2, 2018

It would be cool to have two buttons in the middle "copy changes from left to right" and vice versa.

Like this (Eclipse):
image

@nojvek
Copy link
Contributor

nojvek commented Feb 2, 2018

Yeah the copy changes is super useful.

@therealmarv
Copy link

So the option works

"diffEditor.originalEditable": true

but VSCode 1.20.0 (1.20.0) complains about "Unknown configuration setting":

image

@therealmarv
Copy link

What's also strange (mac here): Cmd+S does not save the original! The UX handling is really weird with the original file and I had lost my editing once. I have to close the diff window after editing and save the unsaved original which is not how I assumed the saving should work with this option turned on.

@eamodio
Copy link
Contributor

eamodio commented Mar 30, 2018

It would be nice if there was read-only on/off control of both sides of the diff editor. In GitLens, when diffing history both sides should be read-only.

@duartemolha
Copy link

Can someone explain to me where I can set originalEditable ?

Really confused. That option is not listed on my settings v1.27.1

@Gettyk
Copy link

Gettyk commented Oct 13, 2018

@duartemolha, open VSCode, open the command palette (on windows it's Ctrl + shift+ P), then type setting and open the Preferences: Open Settings (JSON).
Then you will see someting like this: https://code.visualstudio.com/assets/docs/getstarted/settings/hero.png

Then paste "diffEditor.originalEditable": true, inside the {}on the rigth part (in the image above, that would be just below editor.minimap....

Don't forget to end you line with a , !

@thomasfrobieter
Copy link

This setting is just working for the split view. If switched to inline view, i can't even just select (nor copy) the original text.

@t-hofmann
Copy link

t-hofmann commented Feb 5, 2019

would be nice to have that available also in the "ui" version of "settings"
Having both editable is very convenient for refactoring:

  1. identify common code and
  2. possibly move that to a parent-class

Nice. So Thanks :-)

To further enhance this feature, it would be nice if an edited source (left side) could consequently being saved in the "diff-view", that already works for the target-side (right).

@Paperalien
Copy link

It would be cool to have two buttons in the middle "copy changes from left to right" and vice versa.

Like this (Eclipse):
image

The ability to move code from the original to the new is pretty fundamental in vcs compare tools. I don't think I've ever found a diff tool before that doesn't have it.

@tdomhan
Copy link

tdomhan commented Jun 17, 2019

"diffEditor.originalEditable": true, works perfectly! Is there any way to make this the new default? I can't imagine ever not wanting this on.

@bpasero bpasero added this to the Backlog milestone Oct 24, 2019
@bpasero bpasero added the diff-editor Diff editor issues label Nov 8, 2019
@bpasero bpasero self-assigned this Nov 19, 2019
@bpasero bpasero modified the milestones: Backlog, November 2019 Nov 19, 2019
@bpasero
Copy link
Member

bpasero commented Nov 19, 2019

before (3)

I pushed a change to enable this by default if the left-hand editor is not readonly. Pressing CtrlCmd+S or File > Save will now save both sides of the diff editor.

Feedback welcome, it will be in tomorrows insider build: https://code.visualstudio.com/insiders/

@bpasero bpasero added the verification-needed Verification of issue is requested label Nov 19, 2019
@bpasero bpasero added on-testplan and removed verification-needed Verification of issue is requested labels Nov 20, 2019
@jharrang
Copy link

jharrang commented Dec 4, 2019

@bpasero Thanks for implementing! Now that this is closed, is it possible to finally implement #25887 and #37350? This would address a critically missing piece of editor functionality that has been heavily requested for over two years.

Also mentioning @alexandrudima who has been consolidating a number of issues to #25887

Thanks much!

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
diff-editor Diff editor issues 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