microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.62k forks source link

Suggestion: collapse unchanged regions in diff #3562

Closed factormystic closed 1 year ago

factormystic commented 8 years ago

When viewing a diff (2 pane or inline) it would be useful to collapse the unchanged lines. This helps focus in on just the changes, especially when the changes are few an spread out.

bkarlson commented 6 years ago

any update on this one? Very rough transition from text-based git to VSCode because of this feature lacking.

bkarlson commented 5 years ago

bump...

benlindsay commented 5 years ago

This would be very nice to see. Right now, with big files I'm opening Vim (with fugitive plugin) in the terminal to clean up the diffs

rijk commented 4 years ago

This is something I can't live without, the collapsing along with the inline Stage/Discard buttons makes it so much easier to keep commits tidy:

image

This screenshot is from GitX — still by far my favorite Git UI. I have tried literally all the extensions in VS Code, but none comes even close. I think this is something the core editor has to provide.

aghArdeshir commented 4 years ago

no update on this issue? any one knows any extension?

this issue is open since 2016

ryran commented 4 years ago

VS Code could really stand to make some huge improvements by looking at Atom's git support -- viewing diffs, walking through changes & staging them, as well as undo/reset ... it really is quite a bummer that these features are lacking.

KayLeung commented 4 years ago

Yeah. To hide unchanged context is a very common feature for all diff editor and I think the MS developers also need this feature for each commit. I wonder why they abandoned the implementation for such a long time.

VSCode has built-in collapse/expand feature for code editor. A different algorithm would make the deal it seems.

jianboy commented 4 years ago

four year..... the function is still missing.

cristian3d commented 3 years ago

This is, by far, my most wanted feature. It is standard in many other tools, specially when doing source control diffs.

I'd appreciate some comment from the team as to why is not being considered. Is it too hard to implement?

andronat commented 3 years ago

The only reason I'm still using GitHub Desktop is because of this missing functionality. I'm often working on large files of C/C++ with 1000s of lines of code and long scrolls are just killing me.

Please make sure that the "selecting ranges to Stage" feature won't break!

ToMakeSense commented 3 years ago

related to #87944

thesoftwarephilosopher commented 3 years ago

This is one of the main things Magit gives me and Magit is the only reason I use Emacs anymore, please add this feature.

jakedowns commented 3 years ago

i know i'm not supposed to comment just to 👍 but here i am commenting simply to 👍 anyone know of a plugin to do this instead?

ADTC commented 3 years ago

@jakedowns Try using the "vscode-diff" extension. It doesn't solve the problem in this issue. However it generates and opens the output of git diff in VS Code.

Do note that if you're on Windows, you need to modify the JS file of the extension to fix the problem described in huytd/vscode-diff#1

And if you want a nicer view, you can add the "Diff Viewer" extension. You'll have to make the same change above (to "vscode-diff" regardless of environment) to change to the diff extension. Then right-click the editor tab and click Reopen Editor With... to choose Diff Editor.

saxicek commented 2 years ago

It is a shame that git diff provides better overview of changes than VS Code. 👎🏻

HebaruSan commented 2 years ago

Maybe this is waiting for community contributions. Is this the right file?

https://github.com/microsoft/vscode/blob/main/src/vs/editor/browser/widget/diffEditorWidget.ts

archon810 commented 2 years ago

It is a shame that git diff provides better overview of changes than VS Code. 👎🏻

Not just git diff. Github itself, Bitbucket, Beyond Compare, pretty much all code diff tools do this.

ThomasGHenry commented 2 years ago

I left VS Code for WebStorm a few years ago. I thought I might come back, but I keep bumping into things like this.

jordyvandomselaar commented 2 years ago

Hi @archon810 nice bumping in to you 😁

Agree, for now I just use the "jump to next change" button to work around this, but the current diff viewer makes for a cluttered experience.

rijk commented 2 years ago

Cluttered and a little stressful, because I never feel 100% sure I've seen everything.

FarisHijazi commented 1 year ago

this would definitely be a much needed feature

Something similar to Intellij diff as shown bellow:

ivnsch commented 1 year ago

Please..? I've tried to get used to this, but with collapsed regions the UX is just much better. I keep going back to Sourcetree just because of this.

vsambor commented 1 year ago

The problem is that the folding does not even work inside a diff file. In my case I would like to get a screenshot for a small diff, the diffs are in the same file, but in different far locations, so it's not possible to fold irrelevant code, or to have some option to show only the diffs as in other tools.

thomashbrnrd commented 1 year ago

This is currently the only reason why I got some trouble to move from Atom to VS Code :( It would be awesome to have this feature implemented !

ADTC commented 1 year ago

@thomashbrnrd I just use another tool for diff. VSCode is better than Atom so this one thing shouldn't stop you.

(Also I believe Atom is retired.)

thomashbrnrd commented 1 year ago

@ADTC Yes Atom is retired, but Atom was really better than VS Code on the versioning / git side. This feature that we request here was implemented long time ago in Atom ...

May I ask what tool you are using for the git diff and stage / commit only some parts of a file ?

ADTC commented 1 year ago

@thomashbrnrd I prefer to use Git in terminal command line (external) and visually in another tool. In VS Code I use some Git related extensions but only to get information about the current history.

If you're on Windows, you can try Git Extensions. It's very good and can do line by line staging. It's also possible to use it on Mac with some strange emulation but I didn't want that so I switched to Fork on my new Mac.

antichris commented 1 year ago

@thomashbrnrd If you're comfortable with text mode tools, you could use interactive add (git add -i).

If you prefer GUI and you're fine with the tool not being exceptionally pretty, I'd recommend the official git-gui, which comes out of the box with Git on some platforms (on many Linux distros you'd have to manually install the corresponding package, typically, git-gui). It's what I use and it works reasonably well.

It really does suck that it has taken so long for VSCode to still have no support for hiding/collapsing unchanged diff regions. Evidently, garbage like "custom Explorer autoreveal logic", "hide Activity bar and Panel badges" or "new font setting for OpenType fonts" is more essential to the development workflow for some; since this issue was opened almost 7 years ago there have been tens of releases with hundreds of superfluous insignificant features like those. :disappointed:

jeesusonherraturku commented 1 year ago

I use Winmerge to compare. It can show only differences (set context to 0). Beyond Compare should also have this essential feature.

Edit: Notepad++ also has this feature with comparePlus plugin

https://github.com/pnedev/comparePlus

mtazzari commented 1 year ago

How is it possible that this hasn't been done in 6 years! Much needed feature to be competitive with, e.g., PyCharm. Please have a go at implementing it :pray: Thanks!

aviallon commented 1 year ago

Why is this still a missing feature?

ADTC commented 1 year ago

Why is this still a missing feature?

To encourage us to use git diff or other tools so we don't miss this feature as much. 😄

Personally I use ~Fork~ GitKraken now. I used to use Git Extensions. Sometimes I use Beyond Compare for more complex diffs that Git can't properly show changes on.

fr-an-k commented 1 year ago

This is essential; what is going on?

situ-s commented 1 year ago

This is very much needed when there are lots of untracked files generated via scripts. Any update?

Rocamonde commented 1 year ago

Lol how is this not implemented?

casnix commented 1 year ago

This would be super useful, even outside of git tracked repositories (for e.g. folders). Maybe we have not given enough thumbs up to have this added?

llu025 commented 1 year ago

I'll be posting a comment every day until this is solved, this is absurd

Edit: apparently some need to be explained that this was joke

antichris commented 1 year ago

@llu025

I'll be posting a comment every day until this is solved, this is absurd

Don't. You're not five, you understand that all that's going to achieve is annoy the hell out of the people who have subscribed to this issue until getting yourself blocked.

FarisHijazi commented 1 year ago

How is this not solved yet? Do we need to get more thumbs ups? Do we need to open new issues eith the same request? What do we need to do to get done?

Share this with friends so they can thumbs up

rijk commented 1 year ago

While I also really want this feature (it's the only part of my coding flow I still use another app for), I feel adding "why is this not implemented yet" comments is not really helping. Maybe we should relax this discussion a bit, and realize we are not entitled to making demands of the maintainers. VS Code is a piece of free software that no one forces you to use, and you're free to contribute if you wish to spend the time on this feature yourself.

Rocamonde commented 1 year ago

@rijk I disagree. Adding "why is this not implemented" comments reflect the actual demand for the feature, and is extremely useful information for maintainers, whose goal is to prioritize what features should be worked on. This should not be conflated with being rude or unfriendly, which should be discouraged.

Expecting everyone to either contribute through a PR or shut up is naive and toxic behavior. Demands from the community, feedback forums, etc. are the signals that OSS has to decide on the allocation of resources and human capital, since there's no price signal unlike commercial software.

NuclearPhoenixx commented 1 year ago

While I also really want this feature (it's the only part of my coding flow I still use another app for), I feel adding "why is this not implemented yet" comments is not really helping. Maybe we should relax this discussion a bit, and realize we are not entitled to making demands of the maintainers. VS Code is a piece of free software that no one forces you to use, and you're free to contribute if you wish to spend the time on this feature yourself.

Asking "what do we need to get this done" has nothing to do with being entitled. If feature requests and the respective community demand were unwanted then this whole thread wouldn't exist. Yet here we are seeing that many people would love this feature. No more, no less.

antichris commented 1 year ago

@Rocamonde

toxic behavior

That choice of words is... interesting.

No, friend. It is a well-know and very common convention in many virtual social spaces — that one can like/thumbs-up/"heart"/upvote/etc. to signal their reaction to a post/thread/comment/issue without having to squirt a worthless "+1"/"same here"/"me too!" in the discussion. In fact, many community guidelines explicitly advise against, if not outright prohibit the latter.

One's "me too!" comment adds exactly zero new feedback to the discussion that couldn't have been added by a simple and polite upvote (or downvote, if that's the sentiment). It just rudely wastes everyone else's digital and mental bandwidth. Including the developers, who might have to scroll through screenfuls of that sort of crap in a vain effort to find any actually useful feedback.

Please, don't post if you don't have anything to say that hasn't been said already. Upvote :+1: the issue instead!

ivnsch commented 1 year ago

Just noting - I just learned that this exists, that you can sort the issues by upvotes: https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+

We're somewhere in the second page now.

ivnsch commented 1 year ago

Just noting - I just learned that this exists, that you can sort the issues by upvotes: https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+

We're somewhere in the second page now.

It's probably worth noting too that the most upvoted issue is also from 2016, and was locked in 2018, mentioning that it's probably "on the team's radar" and to just upvote it, so questions about how the team is prioritizing things are not entirely inappropriate..

rijk commented 1 year ago

No, I agree. As @antichris mentioned as well, it's somewhat puzzling to see which features do appear on the changelog each month and not getting even a response by the team on this one. Are they even looking at Github issues for determining the feature roadmap?

I found this document outlining their overall roadmap, and they work off of monthly "iteration plans" like this one.

So the question is: how do we get this on the next one? 🤠 It seems @lszomoru is working on the source control related issues, maybe we can get his take on this suggestion?

rasborgdk commented 1 year ago

Trying to make sure that the EDI is getting setup - done correctly

adam-rocska commented 1 year ago

pls pls pls

rijk commented 1 year ago

They're working on it! (it's on the April iteration plan) 🙌

We made it peeps

sashahilton00 commented 1 year ago

They're working on it! (it's on the April iteration plan) 🙌

We made it peeps

Had to check this wasn't an April fools...