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

Don't re-open hidden tree-view after reload #9539

Conversation

alvsan09
Copy link
Contributor

@alvsan09 alvsan09 commented Jun 1, 2021

The PluginViewWidget has a property to suppress visibility updates
from a when clause in the case a user specifically requests to hide
it. However when the browser got reloaded, the flag was reset to
default and did not keep the hide request from the user.

This change preserves the flag mentioned above in the PluginViewWidget
state, this state is preserved and then available for use in
restoreState where the flag is now updated to the state before the
browser reloads.

Fixes: #7037
Signed-off-by: Alvaro Sanchez-Leon alvaro.sanchez-leon@ericsson.com

What it does

This change preserves the suppress updates flag mentioned above in the PluginViewWidget
state, and then restores it at reload.

How to test

  1. Have an extension that contributes a tree-view to the Explorer and gets activated by a when clause statement e.g vscode example, specifically the 'JSON OUTLINE VIEW', you can also reproduce the problem via the NPM extension.
  2. Using the master branch, Follow the steps as shown in the following '.gif' to reproduce the problem
    tree-view-reload-not-keeping-hidden
  3. Apply the fix in this PR and verify that the views can now remain hidden after a browser reload.
  4. Verify that views are visible (as per the when clause) when opening new work spaces.
  5. Make sure the views can be manually re-opened and that the visibility remains after a browser reload
  6. Make sure the default behavior returns after the user executes the command reset workbench layout.

npm_hide_reset

Review checklist

Reminder for reviewers

@alvsan09 alvsan09 force-pushed the asl/tree-view-hidden-after-reload branch 2 times, most recently from 86a9556 to 7a84fe4 Compare June 2, 2021 17:09
@vince-fugnitto vince-fugnitto added plug-in system issues related to the plug-in system vscode issues related to VSCode compatibility labels Jun 2, 2021
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 look good to me 👍

I confirmed the functionality through the following use-cases:

  • rm -rf ~/.theia and performed reset workbench layout for a clean state
  • 'npm scripts' is visible by default in a new workspace with a package.json present
  • if 'npm scripts' is explicitly hidden, the view does not re-open when reloading the application
  • if 'npm scripts' is explicitly opened, the view re-opens when reloading the application (even if no package.json exists)

The PluginViewWidget has a property to suppress visibility updates
from a `when` clause in the case a user specifically requests to hide
it. However when the browser got reloaded, the flag was reset to
default and did not keep the hide request from the user.

This change preserves the flag mentioned above in the PluginViewWidget
state, this state is preserved and then available for use in
`restoreState` where the flag is now updated to the state before the
browser reloads.

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
@alvsan09 alvsan09 force-pushed the asl/tree-view-hidden-after-reload branch from 7a84fe4 to 23f907b Compare June 2, 2021 18:48
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.

I verified the changes and they work well for me, and the code looks good to me as well 👍
I confirmed that #7037 is fixed for a given workspace, the tree-view is not re-added when a user explicitly hides the view.

@vince-fugnitto vince-fugnitto merged commit 48596e6 into eclipse-theia:master Jun 3, 2021
@vince-fugnitto vince-fugnitto deleted the asl/tree-view-hidden-after-reload branch June 3, 2021 13:09
@vince-fugnitto vince-fugnitto added this to the 1.15.0 milestone Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tree-view] hiding a tree view is re-opened on reload
2 participants