Add Visual Studio Code as directory handler (open with context menu)

Hello Ubuntu community,

I noticed that the “Open with Visual Studio Code” option is no longer available when I right-click on folders in GNOME Files (Nautilus) in Ubuntu 24.04.

If I select Open With…, I can find Visual Studio Code in the list of applications, but it’s buried far down, and selecting it every time is a bit tedious. Moreover, opening a folder with Visual Studio Code doesn’t add it to the “Recommended” or “Default” lists, which I recall should happen automatically after opening a file or folder with a new application first the time.

What I’d like to do is register Visual Studio Code as a folder handler so it appears as an option in the right-click menu, but I do not want to make it the default application for folders. I still want GNOME Files to remain the default handler for folders.

Since I haven’t tried modifying MIME types yet (to avoid breaking defaults), I’m looking for advice on how to configure this correctly.

Any help on how to achieve this would be greatly appreciated!

Thanks in advance!

Here is one way. I have Krusader dual panel file manager installed in Ubuntu 22.04. I use it as my general purpose asset handler and I can also add UserActions. I have just tried it to open file in Visual Studio Code and since I don’t use VSCode often it had to be added to the “Open with” list. Now I have Open With Visual Studio Code working so I will revisit my experience with VSCode. My last choice was Atom but that was “sunset” by GitHub.

Might I add another suggestion? Navigating many files scattered throughout desktop and linking file types to applications is an exercise in “order out of chaos”. I learned about Recoll indexing engine from old mothership UbuntuForums and I now use Recoll (in parallel with Krusader) as my main launchpad/orchestrator. The indexing of either a dedicated directory or several directories or entire desktop (including Thunderbird messages) influences the size of indexing file and time to index from standing start. Ensure that you exclude files you do not need such as logs. But after indexing (worst case) the entire desktop (take a few hours break because of load on your PC and ensure that you have enough headroom in your drive for the index file). Then thereafter when indexing ceases it is easy to associate any mime type in GUI (or CLI - recollq --help) with an application. You can customise linking mime types to custom viewers rather than default viewers. So map VSCode to mime types you want to view.