Tim
Tim

Reputation: 5691

How can I manually change the order that folders are listed in Visual Studio Code Explorer?

I would like to manually change the order that folders are listed, in VSCode. For example, I want to order the sub-folders in my ./components folder like this:

EXPLORER

The bold folders should be on the top, with the rest listed in alphabetical order.

By default, VSCode lists folders in alphabetical order. Is there a way to change that?

Upvotes: 29

Views: 18566

Answers (4)

mustafa candan
mustafa candan

Reputation: 856

SortMyFiles Extension

https://marketplace.visualstudio.com/items?itemName=CanklotSoftware.SortMyFiles

After having the same problem and reading this page I decided to make my own extension. Because the other recommended extensions don't use the default VS Code file explorer. Instead they create another section.

VS Code API normally doesn't support re-ordering files. But I found a work around. My extension changes the default sort type to modified. And changes last modified date of the files listed in its config file. After installing the extension (SortMyFiles from canklotsoftware) you need to create a file named .order. Then write the name of the files in the order you want to display them.

Upvotes: 0

Kris Rivera
Kris Rivera

Reputation: 343

You can save your current workspace to *.code-workspace file and manually change the order.

VS Code File Settings VS Code Workspace Folder Settings

Upvotes: 16

Brebber
Brebber

Reputation: 3084

YES. It is possible by using a 'Favorite' extension

Organizing folder and files is possible by extensions which are named favorites. Indeed personal order is possible in one of them, but I don't know if it is the one you would prefer. Here is the overview:

Favorites by 'kdcro101'
https://marketplace.visualstudio.com/items?itemName=kdcro101.favorites

It is the most popular favorites extension as I know.

You can add files and folders to the favorite area. Special: you can create Favorites Folders to additional organize the folders and files in the favorites.

It is really intuitive as it has a very good UI. Favorites are project based organized. So it is really easy to use and I use it myself in big projects.

What maybe is a disadvantage to your demands is: favorites are not to organize in your personal order. Only traditional a-z|z-a is possible. But as you just add selected files/folders to the favorites there is a really good reduced overview and files can be accessed fast.

Favorites Manager by 'Oleg Shilo'
https://marketplace.visualstudio.com/items?itemName=oleg-shilo.favorites

It is a relative new extension. With this extension it indeed is possible to organize favorite items (folder/files) to your personal demands.

The extension is global organized. That means that all favorites can be accessed in every project. But organizing folders/files specific to single projects is able in separated lists for every project. Organizing such a list is best possible text base and very intuitive this way ... as GUI/UI could be (little) better at all.

Note: if you add folder to the favorites you should activate Show Folder Files in the settings. This is deactivated by default as there is noticed a hint to a 'bug' for VS Code. But to me it worked yet. If not activated VS Code opens every folder in 'project folder view'.


As I think that are the two extension which match your demands best you should have a look to...

Favorites panel by 'Sabitov Vladimir'
https://marketplace.visualstudio.com/items?itemName=sabitovvt.favorites-panel

Additional to folders and files you are able to add a lot more: applications, urls, vs code commands.

I used it sometimes but as the settings are complex you need to do it in the settings.json direct. At the end it has been too much work to maintain it but when it is used it is an unbelievable win of speed working in projects.

favorites by 'Howard.Zuo'
https://marketplace.visualstudio.com/items?itemName=howardzuo.vscode-favorites

It is a very simple extension which works very similar as 'Favorites** by kdcro101', - just without favorite groups ... what make it really simple, intuitive and fast to use it. So it is nearly as popular as the other one. To me the missing of the favorite groups makes it very restrictive to larger projects. But it is a really nice and fast solution if projects are limitated which feels really good when using it.

Upvotes: 13

Bo Green
Bo Green

Reputation: 51

According to VSC doc "User and Workspace Settings" the only options for display order of files and folders in settings.jsonare:

  // Controls sorting order of files and folders in the explorer.
  //  - default: Files and folders are sorted by their names, in alphabetical order. Folders are displayed before files.
  //  - mixed: Files and folders are sorted by their names, in alphabetical order. Files are interwoven with folders.
  //  - filesFirst: Files and folders are sorted by their names, in alphabetical order. Files are displayed before folders.
  //  - type: Files and folders are sorted by their extensions, in alphabetical order. Folders are displayed before files.
  //  - modified: Files and folders are sorted by last modified date, in descending order. Folders are displayed before files.
  "explorer.sortOrder": "default",

Perhaps there are VSC extensions out there which can help you, e.g. Parallel Folders by Alex Crome, didn't try that one myself yet.

Upvotes: 5

Related Questions