Vscode: Sort folders/projects in multi-root workspace

Created on 9 Jan 2018  路  28Comments  路  Source: microsoft/vscode

Could the ability be added to some way sort the list of folders/projects that are in a multi-root workspace? From what it seems, they only stay arranged in the order in which they are added.

feature-request file-explorer workbench-multiroot

Most helpful comment

I've created an extension with which you can sort these folders alphabetically that can be used until it's fixed in VSCode. Search for the extension WorkspaceSort or view the source on GitHub.

All 28 comments

You can edit them in the xxxx.code-workspace file, moving them around in the json array, but that's no fun.

I definitely thing that dragging the folders around to reorder them in the sidebar should update it in the .code-workspace file anyway. Hopefully you guys agree.

Also, moving them will have a subtle side-effect for the (deprecated) ${workspaceRoot} variable, which will fallback to workspaceFolders[0]. But that shouldn't really be behavior that's relied on. It'd be kinda nice for when an extension does rely on that, but you have the wrong "root" folder at the top, to be able to correct it with a drag of a folder.

+1 It's really needed.

My large workspaces have 20+ projects, trying to find the right one when it is not alphabetical is a pain. Being able to sort the workspace would help tremendously. Sorting JSON is not a user-friendly fix.

I've created an extension with which you can sort these folders alphabetically that can be used until it's fixed in VSCode. Search for the extension WorkspaceSort or view the source on GitHub.

Thanks, @iciclesoft works great! This is a must-have feature for VSCode.

@iciclesoft Thanks for this! I agree this functionality is really needed as some of my workspaces are very large and sorting through the projects is tough at times.

Any updates on this functionality?

Any updates on this?

I join the same request. Native support from Visual Studio Code would be great.

This would help a lot of developers with 20+ project folders in one workspace. Support for this would complete my way of using VSCode.

Yes this is a real pain that it's not natively implemented by the way. Just having it in the same order that Windows Explorer lists the files would be a great help.

any updates? A definite pain.

any updates? A definite pain.

@polishedwp Hey Chuck that VSCode plugin mentioned works just fine. Just add 'WorkspaceSort' to your VSCode plugins then right click on a workspace folder and choose 'Sort Workspace Folders'. Hope that helps :)

any updates? A definite pain.

@polishedwp Hey Chuck that VSCode plugin mentioned works just fine. Just add 'WorkspaceSort' to your VSCode plugins then right click on a workspace folder and choose 'Sort Workspace Folders'. Hope that helps :)

Yeh, I installed and it works fine. I was hoping that VSC would have drag and drop reordering support, but the plugin does add some functionality.

You can edit them in the xxxx.code-workspace file, moving them around in the json array, but that's no fun.

I definitely thing that dragging the folders around to reorder them in the sidebar should update it in the .code-workspace file anyway. Hopefully you guys agree.

Also, moving them will have a subtle side-effect for the (deprecated) ${workspaceRoot} variable, which will fallback to workspaceFolders[0]. But that shouldn't really be behavior that's relied on. It'd be kinda nice for when an extension does rely on that, but you have the wrong "root" folder at the top, to be able to correct it with a drag of a folder.

WorkspaceSort works great for sorting alphabetically! But in my case, where I have my ALL (WORKSPACE) with 29 production workspace folders and 1 development workspace folder (parent to all before-production projects), your solution is great, so I could move development workspace folder to the top of the list. Kudos!

any updates? A definite pain.

@polishedwp Hey Chuck that VSCode plugin mentioned works just fine. Just add 'WorkspaceSort' to your VSCode plugins then right click on a workspace folder and choose 'Sort Workspace Folders'. Hope that helps :)

Yeh, I installed and it works fine. I was hoping that VSC would have drag and drop reordering support, but the plugin does add some functionality.

vscode DOES have drag and drop reordering support

So can this be closed then? with drag-and-drop folder re-ordering now working?

@erikpaasonen Yes, we can close this one.

I disagree. Being able to click and drag them around isn't necessarily effective sorting. It's reordering, but not sorting.

Right now we're limited to 3rd party extensions.

First party support where e.g. I could shift-select a group of workspace folders and sort them would be ideal (similar to 'Sort Lines Ascending')

How can this NOT be supported? Do you even code? 馃槈

@BeyondEvil It really doesn't hurt to be respectful and congenial. No one is going to move any faster because of your comment.

@erikpaasonen @polishedwp It would be preferred to be able to actually sort as well. Every time I add an additional repo to my ever growing list of repos (literally up over 100 repos for libraries and widgets for a large project now), it'd feel clunky to try and drag it into place. My current work flow is to blow away the workspace and re-add all the repos if I want them in alphabetical order. Luckily I have a single root for my project repos instead of multiple roots per the original requester. My feedback would be that drag ordering is insufficient to fulfill the criteria of the request.

@mattgen88 Fixed it. Just for you! 馃槝

Its really a pain having more than 15 workspace folders and repos in aleatory order... It causes us an unnecessary constant effort when finding and switching between projects. Drag and drop does not solve this. It instead create another task to be done when adding new folders and repos. :-/

This might be considered a bug, although it is ambiguous. In a multi-root workspace, the folders are sorted according to the order in which they are added, and can be reordered by dragging. But there is a setting Explorer->Sort Order that says that the ordering will be (by default) that folders are sorted alphabetically.

Either provide a SEPARATE setting to allow sorting of ROOT folders in a multi-root workspace, OR have the ordering of the root folders honor the Explorer->Sort Order setting(s). Although dragging does allow for some ordering, it is not very convenient.

Now VScode could already config 5 ways to sort files and folders in Explorer:

| | |
| - | - |
| VScode setting | Folder Structure

But these files and folders are sorted in case-insensitive alphabetical order. Is it possible to add a case-sensitive setting or option to allow the files and folders to be sorted in case-sensitive alphabetical order, like the default way in Github here:

Github way of sorting files and folders

@Jonathan0wh I think your request belongs in #27286. This one here is about sorting the root-level folders of a multiroot workspace.

I wanted to point out that dragging and dropping in multi-root workspaces is confusing. To drag and drop you have to drag a folder onto another folder. The UI makes it seem like this action will move the folder into another folder, rather than just changing the order of the folders.

This behavior made me think that dragging and dropping wasn't supported, which is how I found this issue.

please read this feature request here: #95182, upvote if useful

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shanalikhan picture shanalikhan  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments

vsccarl picture vsccarl  路  3Comments

chrisdias picture chrisdias  路  3Comments

trstringer picture trstringer  路  3Comments