This is not a tutorial, it’s more of a note so I’m going to remember how to do something the next time I stumble again on the problem.
When you open a project (or folder) in Visual Studio Code it will show you all the files and folders in that project. Normally they’re sorted alfabetically, but I had the necessity of having the sorted by the last modified date.
Open settings from VSCode and add the line at the bottom:
Remember to add the comma at the end of the line.
Controls sorting order of files and folders in the explorer. In addition to the default sorting, you can set the order to ‘mixed’ (files and folders sorted combined), ‘type’ (by file type), ‘modified’ (by last modified date) or ‘filesFirst’ (sort files before folders).
The neat trick is that you can have a .vscode file for every project and specify specific settings for each. That is useful if you want to have files sorted by last modified date on only specific projects. If you are collaborating on a project with somebody else instead it allows you to share all the settings between the team. It is also useful if you work on more than one machine and need to keep the settings in sync in different environments.