vsc-workspace-sidebar icon indicating copy to clipboard operation
vsc-workspace-sidebar copied to clipboard

New feature: auto-close the sidebar on workspace switch

Open jtanguy opened this issue 2 years ago • 6 comments

I have a small feature request, and I'd like to run it by you first before attempting to code it.

Could it be possible to add a config option to auto-close the sidebar after a workspace change ? Closing the sidebar is often the first action I do after switching workspaces.

This would happen in the current window if the workspace is opened in the current window, or both windows if the workspace is opened on a new window.

jtanguy avatar Jun 23 '22 10:06 jtanguy

How do you mean close the sidebar? You mean the workspace sidebar? This already happens as the explorer view is selected automatically. Or do you mean the whole activity panel sidebar (everything on the left)? There is a command for this (Toogle Primary Side Bar) - same as used by the icon in the top right of the window

Bildschirmfoto 2022-06-23 um 15 46 28

Yeah, this should be an option (off by default), as I do not know how many people need this functionality. .

sketchbuch avatar Jun 23 '22 13:06 sketchbuch

"Toogle Primary Side Bar" affects only the current window. I'm not sure without looking at the API if you can close all sidebars in all windows, but there is a way to get all windows so maybe they could be iterated over.

sketchbuch avatar Jun 23 '22 13:06 sketchbuch

Feel free to fork and make a pr as I don't have time for this at the moment. If you need any help let me know.

sketchbuch avatar Jun 23 '22 13:06 sketchbuch

Thanks for the insight. I was not sure about how to do it; it's my first time working on a vscode plugin. I'll try to do it myself

jtanguy avatar Jun 23 '22 13:06 jtanguy

In the command that happens when you click the icon or the item you can execute another command

src/webviews/Workspace/WorkspaceViewProvider.ts (line 195)

Here is where I would do it... get the config value and if true, close the sidebar

sketchbuch avatar Jun 23 '22 14:06 sketchbuch

I was going to look into removing the commands from src/commands/registerCommands.ts - the switch in the WorkspaceViewProvider is just a call to my commands that execute the relevant inbuilt commands. These are left overs from the treeview class that I used to use before switching to a webview. I do not think they are needed still, so please do not add the calls to close the sidebar here. Do it in the WorkspaceViewProvider

sketchbuch avatar Jun 23 '22 14:06 sketchbuch