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

Show file changes as a tree in Source Control view #7505

Merged
merged 1 commit into from
May 1, 2020

Conversation

westbury
Copy link
Contributor

@westbury westbury commented Apr 6, 2020

Replaces file change list in Source Control view with tree view. This fixes #4835

What it does

The change lists are replaced by a single tree that uses TreeWidget. A toggle button has been added so the user can toggle between a flat view and a tree view.

What will not be covered by this PR

The diff widget

How to test

Try out the Source Control view. This is the only view that should have changed. The 'flat' mode should look mostly the same but even in flat mode it is now in a tree, with each group (staged, unstaged etc) being collapsable. Test with both the Git vs-code built-in and with the native Git extension.

Review checklist

Reminder for reviewers

@akosyakov
Copy link
Member

akosyakov commented Apr 8, 2020

I have not looked at code, only played a bit with it. I really like this feature, it makes code reviews so easier by checking what kind of extensions PR is addressing. Thank you ❤️

I've noticed that:

  • Files are not grouped properly for sub folders. See the screenshots below.
  • In the tree mode there should not be description, only in the flat mode.
  • I cannot only use keyboard to navigate, in similar ways like in the debug view, between different views with tab, arrow keys and enter. I hope you are using ViewContainer to inherit this logic instead of reimplementing it. You may want to check out how a new vsx-registry extension does it.
  • Styling is broken: not all rows have the same height, i.e. part headers are way to bigger than files and folders. It should be similar to the debug and extensions view. Again please reuse ViewContainer to ensure proper styling.
  • Folders are not themed properly. In final PR we have to test that we switch between different color and icon themes. It should look good in all of them. fyi theming guidelines just for reference: https://github.com/eclipse-theia/theia/wiki/Coding-Guidelines#theming

Here how changes of this PR look in VS Code for the minimal icon theme:
Screenshot 2020-04-08 at 09 32 39

The same in Theia with this PR:
Screenshot 2020-04-08 at 09 32 29

@akosyakov akosyakov added the scm issues related to the source control manager label Apr 8, 2020
@westbury
Copy link
Contributor Author

westbury commented Apr 13, 2020

Files are not grouped properly for sub folders. See the screenshots below.

That was actually deliberate design. If there was only a single file in a folder then the file is shown with the folder as the path. This might have been more obvious if the full path was not shown in the version you looked at. However, to avoid confusion I have changed this so that folders are always shown in the tree, just like VS Code.

I cannot only use keyboard to navigate

I think that has now been fixed. I can tab from the commit line then cursor around the tree.

I hope you are using ViewContainer to inherit this logic instead of reimplementing it

This logic for cursor keys is implemented in tree-widget. To fix the key cursors I only had to remove the original key cursor code that was in the old Source Control view. I have not re-implemented anything from ViewContainer.

Styling is broken: not all rows have the same height

This PR is not intended to change the styling. The height of the group headers has not been changed. The original components are used for the group headers and resource rows.

@westbury westbury marked this pull request as ready for review April 13, 2020 14:07
@akosyakov
Copy link
Member

akosyakov commented Apr 15, 2020

... However, to avoid confusion I have changed this so that folders are always shown in the tree, just like VS Code.

👍

I think that has now been fixed. I can tab from the commit line then cursor around the tree.

I meant that i can navigate to section heard and use keyboard collapse/expand it as well as move between sections. I think you fixed navigation between sections. It should be good enough for the start.

This PR is not intended to change the styling. The height of the group headers has not been changed. The original components are used for the group headers and resource rows.

But it does not look or behave nice? I think we should fix it before merging.

expand

  • header should look the same as other rows
  • expand/collapse should not cause any jumping effects
  • folders should have proper icons across all icon and color themes
  • folder and files styles should be the same, i.e. folder labels should be rendered with description color in tree mode

Other issues:

  • the tree state is lost while switching between flat/tree modes:
    state
  • do a change in .theia/settings.json, try to discard them in tree mode on different levels: section header, folder and file. For me it works only on section header level.
  • navigation left/right does not as before
    • it should iterate through all changes in the file, not jump to next file immediately
    • in flat mode it does not go anywhere sometimes
    • we need to check that the diff view is not affected, since navigation code was shared before
  • what open file supposed to do for folders? it should be removed

Screenshot 2020-04-15 at 14 59 29

BTW could you file a separate issue for the diff widget? It would be super cool to have it there. At least till we cannot use the gitlens vscode extension.

@akosyakov
Copy link
Member

akosyakov commented Apr 15, 2020

@eclipse-theia/ecd-theia-committers please help with testing. We need to test that all features are working in tree and flat modes on different levels (header section, folder, sub folder, a file). We should also make sure that:

  • theming is proper
  • it is easy to operate with keyboard
  • there is no unexpected UI effects
  • it should work against @theia/git as well as again vscode built-in git extension
    • a case when they are installed together is not interesting one

@akosyakov
Copy link
Member

Filed #7581. If someone is up to open another PR against this PR which adds integration tests (as it was done during Monaco migration) please do. It does not mean that we should automate everything now, but maybe add some test for regressions. For instance this PR (in the current state) breaks how we handle left/right keys to navigate through all changes.

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of things I noticed quickly, I'll do more testing as I go:

  1. the changes section is quite large compared to master and needs to be fixed:

Screen Shot 2020-04-15 at 9 13 35 AM

  1. the icons for folders are incorrect (we should either not display icons like in vscode for folder nodes, or we should apply the correct icon by using the filestat which is able to determine if a resource is a folder). The alignment of nodes is also off (when using the seti icon theme for example).

Screen Shot 2020-04-15 at 9 20 57 AM

  1. the ordering of changes is inconsistent with vscode, we should follow the same ordering behavior as the explorer:

Screen Shot 2020-04-15 at 9 24 02 AM

  1. with the changes, I am unable to select the ellipsis toolbar item to display the context menu of actions

@westbury
Copy link
Contributor Author

the changes section is quite large compared to master and needs to be fixed:

I've removed the 5px margin that had been there.

the icons for folders are incorrect

A FileStat is now used, as you suggested, to get the icon from the label provider. It now shows as a folder icon.

the ordering of changes is inconsistent with vscode, we should follow the same ordering behavior as the explorer

Now sorted the same as vs-code with folders first then files

with the changes, I am unable to select the ellipsis toolbar item to display the context menu of actions

Yes, I saw this too. However I have also seen it on the master branch. I will need to investigate this.

@westbury
Copy link
Contributor Author

westbury commented Apr 20, 2020

I meant that i can navigate to section heard and use keyboard collapse/expand it as well as move between sections. I think you fixed navigation between sections. It should be good enough for the start.

OK. I have put back the code that uses the left-right cursor keys to move through the changes within a file. However I integrated it with the implementation in tree-widget so the keys also go in and out of folders as they do in the explorer. It does not work very well, IMO, but then neither does it work well in the existing Source Control view. We need to decide how the keys should work first as this is not at all clear to me.

But it does not look or behave nice?

That is outside my area of expertise. I can run it by our UX team if that helps?

header should look the same as other rows

Surely headers should not look the same? As long as extenders can style headers as they wish then I suppose that would be ok. I have, however, removed the 5px margin from the group headers.

expand/collapse should not cause any jumping effects

This is caused by bvaughn/react-virtualized#610

folders should have proper icons across all icon and color themes

A FileStat is now passed instead of URI to LabelProvider as per Vince's suggestion. This should fix this.

folder and files styles should be the same, i.e. folder labels should be rendered with description color in tree mode

Done

the tree state is lost while switching between flat/tree modes

vs-code loses tree state too. However vs-code expands the tree by default whereas this PR collapses by default. Perhaps I will run this by our UX team.

do a change in .theia/settings.json, try to discard them in tree mode on different levels: section header, folder and file. For me it works only on section header level.

I missed this comment, still need to fix it...

  • navigation left/right does not as before
  • it should iterate through all changes in the file, not jump to next file immediately
  • in flat mode it does not go anywhere sometimes

Yes, more work is needed here, though the details of how this is expected to work is not clear to me. Currently the selected change in each file is separately remembered, so as one cursors right down the file tree and into the file, it is very confusing.

what open file supposed to do for folders? it should be removed

This has now been removed

BTW could you file a separate issue for the diff widget?

#7616

@akosyakov
Copy link
Member

akosyakov commented Apr 22, 2020

Perhaps I will run this by our UX team.

I think it is good idea. I can check then your proposal with @svenefftinge and we decide?

Although could not we just align it as it on master, i.e. it should iterate through file changes, if a file does not have anymore changes, then jump to next/previous file. The tree should only reflect it. It is important for us in Gitpod in the PR context.

It does not seem to work like that with the recent changes as well. It only iterates only changes in a single file.

@akosyakov
Copy link
Member

This is caused by bvaughn/react-virtualized#610

Can we do something about it? It looks very disturbing.

vs-code loses tree state too. However vs-code expands the tree by default whereas this PR collapses by default. Perhaps I will run this by our UX team.

Let's expand i then.

@akosyakov
Copy link
Member

I cannot open diff editors with enter always.

@westbury
Copy link
Contributor Author

westbury commented Apr 26, 2020

I cannot open diff editors with enter always.

I've changed this so that the enter is processed by TreeWidget when on folder (opens folder) and opens diff when on file resource (as Source Control view previously did).

@westbury
Copy link
Contributor Author

westbury commented Apr 26, 2020

This is caused by bvaughn/react-virtualized#610

Can we do something about it? It looks very disturbing.

I removed the css for the group header that controlled the height of the header (which was carried over from the original Source Control view). By making the height the same the jump is no longer seen. If extenders were to customize the header rows to have a different height then they can turn off react-virtualized.

vs-code expands the tree by default whereas this PR collapses by default.

Let's expand i then.

Now expanded by default. I have put in an option so it is easy for extenders to collapse by default (as one of the reasons for implementing this PR was because large change sets created too many rows which locked things up)

@westbury
Copy link
Contributor Author

I think it is good idea. I can check then your proposal with @svenefftinge and we decide?

Although could not we just align it as it on master, i.e. it should iterate through file changes, if a file does not have anymore changes, then jump to next/previous file. The tree should only reflect it. It is important for us in Gitpod in the PR context.

It does not seem to work like that with the recent changes as well. It only iterates only changes in a single file.

I think it now works as well as can be. See comments in code for scm-tree-widget handleLeft and handleRight. I presume to be a bug the issue where cursor left and right between files goes not to first/last chuck in next/previous file as one would expect but goes to the current chunk selection in that file. This is the behavior on master so I have left it as is. It can be changed in another PR if necessary.

@akosyakov
Copy link
Member

@westbury It works quite well for me now. I've noticed 2 things only so far:

  • section actions are not rendered like before:
    Before: Before
    After: After
  • mode toggle disappears
    toggle

@@ -190,8 +198,6 @@
}

.theia-scm .scmItem:hover {
background-color: var(--theia-list-hoverBackground);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove VS Code theming? Did you check that VS Code don't apply it? The same for scm-theia-header:hover

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary because otherwise the theming from the original source control view messes with the tree selection and looks awful.
Screenshot from 2020-04-28 15-35-41

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you file a follow-up issue? We need to double check how it should be applied and do it. But I don't want to hinder this PR with it.

@@ -107,14 +105,4 @@ export class ScmService {
return repository;
}

protected updateContextKeys(): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test VS Code extensions? I.e. that commands are available in the command palette properly. The PR seems to change the semantic when we assign it. We need to test that it still confirms to VS Code extensions' expectations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work. I had to hack the builtin I built myself to check the new menu location but it would be good to see the folder menu working when the 1.39 builtin works. I left the 'string' URI though I don't know if it is used.

@azatsarynnyy
Copy link
Member

I've used the one published on Open VSX registry https://open-vsx.org/api/vscode/git/1.39.1/file/vscode.git-1.39.1.vsix

I've just tried that one with master branch and I see the same blank source control view there. Is this extension working in master for you?

@westbury in master it displays the warning message and also doesn't work
image

@akosyakov
Copy link
Member

What is the summary? We don't test vs-code built-in git support for now or someone to test https://registry.npmjs.org/@theia/vscode-builtin-git/-/vscode-builtin-git-0.2.1.tgz at least?

#7505 (comment)

@westbury Do you know this yellow box warning was coming from our widget?

@azatsarynnyy
Copy link
Member

What is the summary?

@akosyakov from #7505 (comment) I see that VS Code built-in git extension, which is currently used by Che, works w/o any regression with this PR changes.
And https://open-vsx.org/api/vscode/git/1.39.1/file/vscode.git-1.39.1.vsix doesn't work on both: master and with this PR. There's almost the same blank source control view.
So, the PR doesn't affect Che. @vinokurig correct me if I'm wrong, please. Thx!

@westbury
Copy link
Contributor Author

@westbury Do you know this yellow box warning was coming from our widget?

Yes. This is shown when there is no selected repository. In this case we are not getting any repositories found by any providers because the builtin, for whatever unknown reason, is not finding any.

@akosyakov
Copy link
Member

Yes. This is shown when there is no selected repository. In this case we are not getting any repositories found by any providers because the builtin, for whatever unknown reason, is not finding any.

@westbury I meant this box is displayed on master, but not with this branch. I think it is caused by #7505 (comment) Could you have a look at comments please?

I've tested today the diff view as well. It does not seem to be affected as well.

@westbury
Copy link
Contributor Author

  • section actions are not rendered like before:

That was because the notification-count-container, when in a tree-widget, was explicitely hidden by css in search-in-workspace. I assume that the intent was that it should only have been hidden for search-in-workspace, not globally, so I've refined the rule with an additional class.

  • mode toggle disappears

Sorry. Last minute cleanup that broke it. I reverted that. The code in scm-contribution to get the ScmWidget from the ViewContainer is necessary because it is not otherwise passed on to ScmWidget without changing ViewContainer.

@akosyakov
Copy link
Member

@westbury I will wait till next release is through and then test again (hope last time). I believe the release should be tomorrow evening. @marcdumais-work ?

@akosyakov
Copy link
Member

btw the build does not compile on travis for any platform

@akosyakov
Copy link
Member

There is no commit input anymore and amend is also gone:
Screenshot 2020-04-30 at 09 21 21

I've tried to reset layout, but it does not help.

Signed-off-by: Nigel Westbury <nigelipse@miegel.org>
@westbury
Copy link
Contributor Author

There is no commit input anymore and amend is also gone

I have not been able to reproduce this.

@akosyakov
Copy link
Member

@westbury It seems something was cached in my browser, cleaning caches and reload helped.

@akosyakov
Copy link
Member

Is there a preference to configure it? If I want to enable tree mode for my user always? It would be good to reuse from VS Code: https://github.com/microsoft/vscode/blob/8dff64169dfc8170e28ee59f0131001ad6e43954/src/vs/workbench/contrib/scm/browser/scm.contribution.ts#L138

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, that's very cool feature! ❤️ Hope we will have it for the diff view one day too.

@westbury
Copy link
Contributor Author

westbury commented May 1, 2020

Thank you @akosyakov for reviewing this. Based also on Eclipse Che's testing of the builtins (#7505 (comment)), I'm merging.

@westbury westbury merged commit 87677a2 into eclipse-theia:master May 1, 2020
@westbury westbury deleted the scm-tree branch May 1, 2020 08:45
@akosyakov
Copy link
Member

@westbury Could you file a follow-up for #7505 (comment) please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scm issues related to the source control manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[scm] show changes as a tree
6 participants