Sort order for files in VS Code Explorer

I just noticed another small plus for VS Code versus Sublime Text. You can sort the files displayed in your “sidebar” (aka “Explorer”) in several different ways when using VS Code. Sublime gives you no choice.

I just noticed this today because I was working with a folder that had a lot of files whose names were almost meaningless to me. I just wanted to focus on which file(s) were most recent, so I’d know where to pick up editing the most recent ones. So I wanted to sort the files by “last modified date” or “date modified”. I didn’t care whether it was ascending or descending, as long as it was sorted by modification date. Most modern “file browsers” will let you do this. If you see a list of files, you may have gotten so used to this behavior that you expect to be able to sort this way, as well as alphabetically.

I just searched around and I find that at least one person was hoping for this in Sublime in 2014. So far as I can tell, there’s still currently no way to change the sorting of files in Sublime Text’s sidebar.

VS Code hasn’t been around for very long, but it does have several sorting options for the file explorer on the left hand side of the IDE. If you want to change it, click the upper left menu File > Preferences > Settings and search for “explorer.sortOrder”. A dropdown lets you select from five possible options:

  • default – Files and folders are sorted by last modified date, in descending 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.

I understand why Sublime doesn’t have this sorting option. When you’re a small dev shop, you have to make tough decisions all the time about what features you’ll support. With the backing of Microsoft, I can see why VS Code has a richer feature set.

VS Code Explorer using default sort order
VS Code default sort order on my Gimp 2.8 directory
VS Code Explorer using modified sort order
VS Code “modified” sort order on my Gimp 2.8 directory

If you found this interesting, click the subscribe button below! I write a new post about once a week.

Leave a Reply

Your email address will not be published. Required fields are marked *