sketchbuch / vsc-workspace-sidebar

An extension for VSCode to switch Workspaces with ease.
https://marketplace.visualstudio.com/items?itemName=sketchbuch.vsc-workspace-sidebar
MIT License
35 stars 3 forks source link

Condense option enhancement: remove intermediate folders with only one folder inside #57

Closed jtanguy closed 1 year ago

jtanguy commented 2 years ago

I was wondering if it would be possible to further condense the workspace tree by removing intermediate folders that contain only one folder. In my daily use of this extension, I have separate main folders for each context: personal, company, and client-related. Inside those folders I have my cloned repos. To avoid cluttering those main folders, I usually have a .vscode folder where I put my workspaces to keep the main folder self-contained.

Perso
├── .vscode
│   ├── microservices.code-workspace
│   ├── reblog.code-workspace
│   └── wordle.code-workspace
├── opentelemetry (git repo)
├── reblog (git repo)
└── wordle (git repo)

The condensed view does remove the .vscode folder when there is only one workspace inside, and I would like to condense it by either removing it, or do what github does, which is append it to its parent, i.e. Perso / .vscode

image

I can work on this feature if you want

sketchbuch commented 2 years ago

I was actually going to modify the folder tree in the same way the file explorer compresses folders: "folder a/ folder b / folder c" but haven't got round to doing it.

The setting for this is "Explorer: Compact Folders" and I was thinking of using this rather than create a new option just for this extension. What is your opinion of this? Would you rather have a separate option for workspace sidebar?

jtanguy commented 2 years ago

Either way does the job fine. On one hand, removing the unnecessary folders makes the output cleaner and more concise, on the other hand, collapsing like in the explorer view properly displays all the complexity.

I would lean more on the "reuse the explorer methods" to be consistent with the rest of the UI

jtanguy commented 2 years ago

I just re-read your question (and finally understood it). Ideally I'd think using the explorer option with a possible override for this plugin, but the override part may not be used at all.

Le'ts use the global explorer config

sketchbuch commented 2 years ago

Working version in feature/57-compact-folders-like-explorer-view

sketchbuch commented 2 years ago

You can download this version and try it. Let me know how it works with your folder structure.

sketchbuch commented 2 years ago
Bildschirmfoto 2022-06-24 um 20 24 14 Bildschirmfoto 2022-06-24 um 17 19 15
sketchbuch commented 2 years ago

To install the vsix, remove the version from market place and in the extension hamburger menu select install vsix

jtanguy commented 2 years ago

It works great ! Thanks

image

sketchbuch commented 2 years ago

OK. I shall make a new release at the weekend so that you can use the market place version again

jtanguy commented 2 years ago

I noticed you kept the old compacting behavior too. I just created a new workspace in a different folder, and the .vscode folder is missing. If I add another workspace it reappears.

image

sketchbuch commented 2 years ago

Yes, the old condense I left in as they are two different behaviours.

Not everyone will want condense, and compact uses the explorer setting and all it does is display empty folders together with slashes in between.

sketchbuch commented 1 year ago

In v1.4.2