Closing open workspace & folders

Hi all,

It seems like calling WorkspaceService.close() causes browser window to refresh & reload (calls reloadWindow()).
Is there a way I can close the workspaces or folders without reloading the window? (i.e., the File navigator should become empty)

Will removeRoots() or spliceRoots() work ? Could you please provide examples?

Thanks in advance.

[original thread by rs]

IIRC many things in various Theia platform extensions depend on the workspace being set - e.g. in some extensions nothing will be done until this happens. For these, there is no “putting the Genie back in the bottle” once the workspace becomes “un-set”, hence the app reload.

[rs]

when i close a workspace, i would like the filenavigator to go blank without reload, but when i open a workspace, reload is fine …

@che-theia-new the framework uses the reload() as a way to properly set the state, initialize components correctly, and also restart plugins and language-servers. If your use-case requires removing the reload it will require additional implementation effort to also ensure the framework falls on it’s feet.

[rs]

Thank you, @vince-fugnitto & @marc-dumais

[rs]

i would like the filenavigator to go blank (i.,e it should stop watching the current folder that is open). i’m sure the system would go to an inconsistent state, but i would like to try to see what happens.

Any ideas on how to accomplish this ?

@che-theia-new you can try by making changes directly to the sources, or if you’d prefer you should be able to rebind the close workspace command to instead handle it differently (without the reload). I believe that you should not only close the workspace, but also make sure as to clear the widget itself as well (blank state).