maoschanz / quicklists-gnome-shell-extension

Add dynamic quicklists with nautilus bookmarks or recent files.
GNU General Public License v3.0
17 stars 5 forks source link

vscode support #23

Open erenseymen opened 3 years ago

erenseymen commented 3 years ago

Visual Studio Code doesn't show file history. Can you please add? Specifically, if we are able to access last workspaces in right click menu, it'll be much appreciated.

maoschanz commented 3 years ago

This extension doesn't support specific apps*, it's a very generic code which takes all recently opened files as identified by the GTK library (same list you'd get in the "recent" page of file choosers, or in nautilus "recent" view) and it filters these files according to what file types an app launcher says it can handle

if an app declares incorrect or incomplete types (e.g. Gedit doesn't declare markdown files) you can report it to its devs or edit the app launcher (.desktop file) manually to add new types

But in the case of VSCode, it isn't about opening a "classic" file, but opening a folder.

so this kind of feature would require that the extension knows how VSCode works internally to get the list, and it isn't realistically possible to do that for all IDEs, i don't even do this for GNOME Builder. So sorry, i think this isn't possible at all.


If all your projects have a common parent folder (some ~/Code/ or ~/Projects/ or ~/VSCode/ directory) i could make it a setting and the extension would dumbly enumerate every folder in it? But even this would be a complex feature, some IDEs require CLI options to open the folder as a project workspace (-p for Builder for example)


*it does something different for a handful of apps like file managers, but even then it's reading the very generic GTK bookmarks that are in the same config file for most file managers

erenseymen commented 3 years ago

Thanks for explaining.

I don't need folder matching. I need workspace file matching.

I want to be able to see .code-workspace files in VSCode's right click menu. I opened this type of files from Nautilus (VSCode is the default app) and I can see the files in "recent view" of Nautilus as you mentioned.

image

Unfortunately, quicklists extension doesn't give me "recent files" for .code-workspace type.

or edit the app launcher (.desktop file) manually to add new types

VSCode's desktop file (/usr/share/applications/code.desktop) includes below line: MimeType=text/plain;inode/directory;application/x-code-workspace;

So, I added below to my ~/.config/mimeapps.list file (and restarted my pc), opened a .code-workspace file, but no luck again. application/x-code-workspace=code.desktop

Here's code.desktop file: code.desktop.txt

Another thing is that if I right-click to Spotify shortcut, it tells me "No recent file for this app". image

But VSCode doesn't: image

maoschanz commented 3 years ago

This special mime type is perfect, it's exactly what's needed for this extension, so it should be able to work...

maybe that line https://github.com/maoschanz/quicklists-gnome-shell-extension/blob/master/quicklists%40maestroschan.fr/content_loaders/recentFiles.js#L23 is incorrect, iirc a few apps don't open URIs but only paths, i don't remember the reason why i only support URIs

i'll install vscode tomorrow, i think i need to see the complete desktop file and experiment with it, i'll tell you if i find anything

erenseymen commented 3 years ago

Thanks for the hint. I changed %F to %U in code.desktop file and it worked.

image

Now, I'm also wondering why you intentionally only support URIs :)