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

add a setting for only using a single tab for diffs #620

Closed
ianhi opened this issue Apr 24, 2020 · 7 comments · Fixed by #1184
Closed

add a setting for only using a single tab for diffs #620

ianhi opened this issue Apr 24, 2020 · 7 comments · Fixed by #1184
Labels
enhancement Good first issue Good first issue to be tackled by new contributors pkg:Frontend

Comments

@ianhi
Copy link
Collaborator

ianhi commented Apr 24, 2020

Description

Currently every diff is opened in a new jupyter tab. I propose a setting that would enable behavior similar to github desktop where there is only one tab for diffs, and opening a new diff would change what diff is displayed but not create a new tab.
single_tab

@ianhi
Copy link
Collaborator Author

ianhi commented Apr 24, 2020

Contrast with the tab explosion when viewing the same commits in jupyterlab-git:
tab_explosion

Often this multitab behavior is pretty nice, but I'd like to be able to toggle it on and off.

@fcollonval
Copy link
Member

fcollonval commented Apr 25, 2020

That is a nice idea. But a better approach instead of all or none would be to set a maximum number of diff tab to be kept opened using a queue. If the setting is 0, then the behavior would be the actual. And if it is one, it will be the one you propose. And if it is something else, it would probably make more sense like looking at all changes in a commit (especially as diffing big file can be quite slow) but keeping the number of opened tabs acceptable.

@jaipreet-s
Copy link
Member

jaipreet-s commented Apr 27, 2020

VSCode shows each file diff as a separate tab as well (on double-click)
Screen Shot 2020-04-27 at 11 22 08 AM

I like this idea as a setting for the opinionated user, but it's important to not over-index on GitHub Desktop or a particular Git GUI.

@dhirschfeld
Copy link
Member

In VSCode when you click on a file it shows the diff in a separate diff tab. If you click on another file it shows the diff in the same diff tab. A new diff tab is only opened if you double-click on a file (or if no diff tab is already open).

I would love for jupyterlab-git to replicate this UX as I think it's pretty perfect:
#252 (comment)

@telamonian
Copy link
Member

telamonian commented Apr 28, 2020

@dhirschfeld As you said in the other issue, what you're describing is part of a more complex feature in vscode called preview mode. Implementation of our own preview mode would probably best be first tackled in core before we implement our own flavor of it here in the git extension.

Some thoughts:

  • the "open in preview tab" behavior could be implemented as new flavor of the filebrowser:open cmd from @jupyterlab/filebrowser-extension. Say, filebrowser:open-preview
  • we could then reuse filebrowser:open-preview in the git extension's file listing widgets
  • this way, it would be easy to implement a single user setting that could turn on/off the "open in preview tab" behavior everywhere

@jaipreet-s
Copy link
Member

Agreed with what @telamonian said above.

In the VSCode file browser, a single-click opens a file in the so-called "preview mode" tab, leading to a nice consistency between the regular file browser and the Git one.

Since a single-click doesn't do the same in the JupyterLab file browser, I'd also vote that this is first handled in core and then we can aim to have consistency between the the regular and the Git file browser.

@fcollonval
Copy link
Member

I agree too with @telamonian.

the "open in preview tab" behavior could be implemented as new flavor of the filebrowser:open cmd from @jupyterlab/filebrowser-extension. Say, filebrowser:open-preview

It will actually be more work than that as some widgets are inserted from as deep as LabShell (

model.shell.add(nbDiffWidget, 'main');
) for non-trivial content like diff. It may even make sense to add that ability directly in the lumino DockPanel.

So quite some work to achieve it... Therefore I would accept a simpler approach within the extension from now.

@fcollonval fcollonval added this to the 0.21.0 milestone May 28, 2020
@fcollonval fcollonval removed this from the 0.21.0 milestone Jul 13, 2020
@fcollonval fcollonval added the Good first issue Good first issue to be tackled by new contributors label Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Good first issue Good first issue to be tackled by new contributors pkg:Frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants