-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Suggestion: collapse unchanged regions in diff #3562
Comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
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: 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. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
related to #87944 |
This is one of the main things Magit gives me and Magit is the only reason I use Emacs anymore, please add this feature. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@jakedowns Try using the "vscode-diff" extension. It doesn't solve the problem in this issue. However it generates and opens the output of 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 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Not just git diff. Github itself, Bitbucket, Beyond Compare, pretty much all code diff tools do this. |
I left VS Code for WebStorm a few years ago. I thought I might come back, but I keep bumping into things like this. |
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. |
I kind of like this UI. I think the active zones of the divider should be not just the very edges, but rather the top and bottom halves. Dragging could gradually reveal lines like in the prototype, clicking should reveal a fixed number of additional lines (5, 10, 15, or, optimally, configurable). A tooltip could help with discoverability. The exact appearance of the divider is debatable though, I would prefer a straight edge with a hint of shadow, similar to how the sticky scroll feature is done. I think the number of context lines shown initially should have a global setting (user, workspace), that can be adjusted per file (ideally, remembered, but can be reset back to the configured value). And there should be an action (or two) to collapse/expand all unchanged regions in the current diff view. |
To me there's no debate. The wavy line looks cartoonish in an otherwise professional user interface. Is no one else against it? 😅 |
I wouldn't say I'm terribly happy with the way it looks now. But I'm also one of those who still use the official Tcl/Tk I just noticed that the draggable prototype seems to snap to whole lines. I may be in minority, but I think it should only snap when the exact number of context lines is changed (e.g., on a click to show more lines). Dragging should be smooth, even if it could end up cutting off a part of the line when let go. UI components snapping out and away from under the cursor, on the other hand, do make for a very lousy UX — one that can get in the way of what someone is trying to do. Ooh! And yet another idea: instead of having to drag, scroll and drag again (maybe, a few more times), clicking the active zone could hold it fixed in place under the cursor, scrolling the rest of the view with the revealed context lines instead. This way the user could comfortably add huge swaths of context lines by simply clicking the same spot repeatedly. |
Here another idea: The drag&drop idea can be implemented in the future on top of this design (which is technically quite involved to do it properly, so it probably won't be included in the initial release of the new diff editor) This prototype also shows how context could be included, similar to what GitHub does (current method/class). |
Loving the new clean straight-edged bar. Perfectly blends in with the UI while standing out just enough to notice without distracting. Thank you so much! I think I'm also in agreement with the new version, to click the border. Could you possibly make the click target larger though, at least 5 pixels (inside the bar at the border), even if the border itself is only 1-2 px? Then I have one more suggestion, optional but for consideration: instead of the standard tooltip that opens after a delay, consider replacing the text "32 hidden lines | 🎏 DiffEditorWidget2" with "Show more lines above/below" and "Show all lines" immediately when hovering the respective click target, then return it back to the original text when mouse is moved away or when "Show more lines above/below" is clicked (updating the number of lines). Or maybe the tooltips can appear faster or a custom popup tip can be used which appears immediately and is also themed. |
No, please don't do that. It's very un-intuitive that there are borders which are suddenly clickable. Further it needs precise pointing of the mouse to hit that thin line. I think reserving the space of two lines with one button on top of the other is totally fine. |
@hediet I'd say that hansu has a good point. Using a border to do something other than changing the width/height of a section is not normally expected. It will be a brand new behavior to learn from a UI/UX perspective - something we should avoid adding unless we're introducing a groundbreaking new UI behavior with many potential use cases. It's OK for a collapsed code bar to take up about We should also have a separate option somewhere to expand and collapse all sections of unchanged regions in the file. It's something GitHub has in the file header (because the diff page has many files in it). [Note: Although GitHub remembers the individually expanded sections and keeps them expanded when we collapse all sections across the whole file, this isn't strictly necessary.] Please give it a try, and show us a demo when you can. Thank you. |
Closing, as this has been implemented now in the new diff editor. You can try it out (restart VS Code after changing these settings):
The new diff editor will replace the old diff editor soon. |
Awesome!! 🕺 |
Which version is the minimum? Thank you for making this happen btw. |
I further wonder if it makes sense to collapse unchanged regions when having only one change. |
I don't agree with that. Collapsing unchanged code is always a good thing to reduce mental tax and ensure you've seen all the changes. Regardless if 1 or multiple changes. |
@hansu this is an old version. Please try the latest insiders! |
Why is almost everyone sticking with side-by-side view? 😂😂😂 I find inline view to be much better. Full 100% width, and no redundancy of seeing the same unchanged line twice. I hope this feature works well with inline view as I haven't seen any screenshot of that yet.
|
Oh sorry, I didn't check that. Also a bit weird that the text goes first down and then up. I hope you get back to the buttons you had before :) |
That is a bug. These sashes are actually clickable and do the same as the button! |
Oh, I didn't expect that. |
To me, it's perfect! 😍 Great work @hediet |
Really great how it looks now, really helpful 👍 I discovered a little thing, see: #187820 |
Could anyone please share screenshots / videos of how the inline (unified) diff looks like? Thank you. I'm afraid to switch because I feel like I'll be disappointed. All the talk so far have been about perfecting the side-by-side, and I only use inline diff. :) |
There are some issues with the inline view: With (I think it doesn't need two even when Switching Switch from "off" to "on": (Only shows one column of line numbers) From "on" to "off": The left line number column highlights the last selected line in the side-by-side view: Version:
|
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.
The text was updated successfully, but these errors were encountered: