I'm using VS Code 1.25.1 on Win10. When I open the Explorer icon and look at a list of files in a folder, it shows the files listed alphabetically. I want to sort them by date modified, but I don't see any options to sort by other fields. Are there keyboard shortcuts? Any other options? Thanks.
3 Answers
- Open user settings (Mac: cmd+, Windows/Linux: ctrl+,).
- If you want this new sort order to apply to all VSCode projects, continue to step three. If you want it to apply only to the currently opened folder/workspace, first click on the "Workspace" tab that's directly below the settings search bar, then continue to step three.
- Using the settings search bar, search for the following setting ID:
explorer.sortOrder
. - Click the dropdown for that setting and select your preferred sort order (in your case,
modified
). - If you'd like to quickly toggle this setting between different values (via a keyboard shortcut), use the Settings Cycler extension.
-
1Thx for responding. I see the options now: 'mixed' (files and folders sorted combined) 'type' (by file type) 'modified' (by last modified date) 'filesFirst' (sort files before folders) The next logical question is can we toggle between values with keyboard shortcuts or another technique?– TomJul 26, 2018 at 20:36
-
Updated answer with option for adding a keyboard shortcut to toggle between the different values. Dec 4, 2019 at 19:48
-
A more user friendly approach can be:
So interestingly the Sort Order
setting only seems to impact folders and files within the top-level workspace folders, if those top-level folders were added via the Add folder to workspace
option.
For ex I had
Workspace
- ProjectA
- ProjectB
- ProjectC
Then I added another folder to the workspace, and it appeared at the bottom of the list. Because it was a top-level folder the Sort Order
setting would not impact its order in the list. The Sort Order
would only impact the files and folders within each of those ProjectX
folders.
To fix this I directly edited the workspace file. To do so, open it with a text editor other than VSCode, and change the order of listed files.
For ex, mine looked like:
{
"folders": [
{
"path": "../../Desktop/ProjectA"
},
{
"path": "../../Desktop/ProjectB"
},
{
"path": "../../Desktop/ProjectC"
},
{
"path": "../../Desktop/NewProject"
}
],
"settings": {}
}
and all I had to do was change it to:
{
"folders": [
{
"path": "../../Desktop/NewProject"
},
{
"path": "../../Desktop/ProjectA"
},
{
"path": "../../Desktop/ProjectB"
},
{
"path": "../../Desktop/ProjectC"
}
],
"settings": {}
}