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

navigator: handle empty multi-root workspace #8608

Merged
merged 1 commit into from
Oct 14, 2020

Conversation

paul-marechal
Copy link
Member

When a multi-root workspace is opened, the navigator will try to draw
the file tree because model.root is a WorkspaceRootNode with no
children.

This commit handles this case by adding a bit of ui to help the user add
folders to his workspace, instead of displaying a blank view.

Signed-off-by: Paul Maréchal paul.marechal@ericsson.com

How to test

  • Open multi-root workspace.
  • Remove all folders from it.
  • A button to add folders should be displayed.

Review checklist

Reminder for reviewers

@paul-marechal paul-marechal added the navigator issues related to the navigator/explorer label Oct 8, 2020
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

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

When I tried running this, I still got to an empty file tree:
image

My steps were:

  1. Open a folder as a workspace.
  2. Add another folder to the workspace.
  3. Save the workspace as a workspace file.
  4. Remove both folders from the workspace.

packages/navigator/src/browser/navigator-widget.tsx Outdated Show resolved Hide resolved
@paul-marechal
Copy link
Member Author

When I tried running this, I still got to an empty file tree:

There seems to be something funny happening here. I'll look into it, thanks!

@paul-marechal
Copy link
Member Author

@colin-grant-work @vince-fugnitto ok I added a bit of documentation because I got confused with how the tree model worked for single vs multi root workspaces. The logic should be fixed.

@colin-grant-work
Copy link
Contributor

The functionality is working for me, and the code looks good. 👍 This message and behavior is very similar to the 'no workspace' message, so a case could be made for combining the two renderers, but I think it's likely better to keep them separate.

Copy link
Contributor

@DucNgn DucNgn left a comment

Choose a reason for hiding this comment

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

I tested and confirm the functionality works as described. The code also looks good to me.
Just a small nitpick is I dont know if we should avoid contractions in theia UI?
Your workspace doesn't contain any folders.

When a multi-root workspace is opened, the navigator will try to draw
the file tree because `model.root` is a `WorkspaceNode` with no
children.

This commit handles this case by adding a bit of ui to help the user add
folders to his workspace, instead of displaying a blank view.

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
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.

The changes work well 👍
Thank you for also including documentation in the updates.

@paul-marechal paul-marechal merged commit 694d231 into master Oct 14, 2020
@paul-marechal paul-marechal deleted the mp/close-multi-root branch October 14, 2020 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
navigator issues related to the navigator/explorer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants