Vscode: Windows: Jump list misses files and folders in the recent category when opened

Created on 19 Nov 2015  路  30Comments  路  Source: microsoft/vscode

Somehow on Windows we do not show up with files and folders in the jump list. I think this is some docs what to do to make it happen: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx

bug electron-2-update verified

Most helpful comment

add recent folders as custom tasks to the list as I am not able to make folders show natively

It's showing up in Recent Folders, not under Tasks for me (which is nicer!).

image

All 30 comments

Maybe someone can enlighten me how to tell Windows that an application can handle files/folders :)

Does electron API method app.addRecentDocument() not working ? I tried to debug the app but didn't find how to debug other than UI thread...

It does but there is more requirements for this to work on Windows.

The task jumplist seems to work (where you can ask for a new window). Why is it different ?

Yes, tasks seem to be a different concept that work without issues.

It's either

1) An issue with vscode in the registry
2) Electron is failing at SHAddToRecentDocs. Problem with SHAddToRecentDocs is that it doesn't return a result so it's hard to determine whats going on.

or both.

same issue is happening to me on atom too https://github.com/atom/atom/issues/4241#issuecomment-204981921

@bpasero Just tried with latest Atom beta and i can get files to appear in the jump list but only using the file menu - https://github.com/atom/atom/issues/4241#issuecomment-204994777

VS Code switched away from using Squirrel for Windows for installation so it is well possible that Atom includes installation procedures that make it possible to show files in the jump list and VS Code's installer needs to do the same. Would still like to find out what exactly is needed.

Any updates on this issue?

At the moment, I have to: Right-click the taskbar icon -> select New Window* -> maximize the window -> open the folder from File > Open Recent. It could be faster =).

* or use Ctrl+Shift+N/file menu.

I have not been able to get any help from other Microsoft people. Why it fails remains a mystery to me.

SHAddToRecentDocs says that folders will only appear in the Windows Explorer jump list, so the Recent / Frequent jump lists won't work for opening projects. It looks like it might be possible to create a custom jump list containing folders using the setJumpList function. (need to be careful to check getJumpListSettings for removed items before updating it else the category will get blacklisted)

I've been reading through Adding Support for Windows 7 Jump Lists & Taskbar Tabs trying to figure out why recent files don't appear in the jump list - my best guess is its something to do with the file / application registration (recent items will only show in the jump list for applications associated with that file type). Listing 2 indicates that AppUserModelID needs to be set on the ProgID for that file type - this isn't being set for any of the VSCode.* ProgIDs, but adding this to the registry isn't fixing the jump list for me at the moment.

It could be there is some other application registration that is missing, or maybe I have the AppUserModelID wrong (as far as I can tell it should be "Microsoft.CodeOSS"?). Its pretty late now, hopefully it will make more sense in the morning.

Bringing folders to the jump list could easily be a better alternative to having several open folders in one window. At least for Windows of course. MS folks, please give this item some love.

According to the documentation registering under HKCR\Applications means SHAddToRecentDocs will attempt to register applications to handle file types that it is not registered to handle, which seems like the best solution because that lets any file type appear in the recent list rather than just file types explicitly registered. I created a scratch electron app with these registry keys to try it out:

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe]

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe\shell]

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe\shell\open]

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe\shell\open\command]
@="\"E:\\Git\\apf-electron\\electron-quick-start-win32-x64\\electron-quick-start.exe\" \"%1\""

This worked as expected, but broke when used setUserTasks to add a custom task - it looks like this totally replaces the jump list and so it no longer includes the recent section. Using setJumpList instead let me define custom tasks while also keeping the recent section, so something a bit like this might fix it:

app.setJumpList([
  { type: 'recent' },
  {
    items: [
      {
        title: nls.localize('newWindow', "New Window"),
        program: process.execPath,
        arguments: '-n', // force new window
        iconPath: process.execPath,
        iconIndex: 0
      }
    ]
  }
]);

I'm struggling to build VSCode at the moment so I've not been able to check if this actually works.

Looks like setJumpList was only introduced in v1.3.5:

electron v1.3.5

Yeah, maybe a better idea to just set our own custom jump list instead of relying on Windows to do it. Even if we update Electron this release, I would wait one release before using new API in case we have to revert.

@JustinPealing thanks for looking into this, can you clarify how your application registers differently from VS Code? Our installer is setting quite a bit of keys and I wonder how your registration differs (see https://github.com/Microsoft/vscode/blob/master/build/win32/code.iss#L74)

Btw we recently updated our instructions how to build VS Code on windows and it should work fine now: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source

I see atom has fixed the recent items issue I had. But there is another separate bug I've opened but with re-opening recent items https://github.com/atom/atom/issues/12655
They are using Electron: 0.37.8

I don't see atom using the custom jump lists api

@bpasero I find that I also have to include --arch=ia32 switch as I have 64bit nodejs installed. It wont build compatible node 32bit binaries for electron otherwise

@pflannery thanks for letting us know.

@joaomoreno didn't we use to have the arch inside npm.sh at one point?

We have it in scripts\npm.bat

@bpasero The only key my dummy app registered was under HKCR\Applications, specifically the shell\verb registration MSDN documentation here

Here is a .reg dump of the relevant key:

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe]

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe\shell]

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe\shell\open]

[HKEY_CLASSES_ROOT\Applications\electron-quick-start.exe\shell\open\command]
@="\"E:\\Git\\apf-electron\\electron-quick-start-win32-x64\\electron-quick-start.exe\" \"%1\""

@JustinPealing the root cause of this issue is that we call setUserTasks from the electron API and this seems to disable the recent category. Fix is possible by using the new setJumpList API. Still, folders will not show up, but files.

Verification: right click on the task icon on Windows and see recent files showing up. Recent files are added e.g. by right click on a file and open with Code or by using the "File > Open File" dialog.

For folders: we show them as custom tasks.

I pushed a change to add recent folders as custom tasks to the list as I am not able to make folders show natively. This is a good workaround imho, even though it is not 100% the same as letting Windows show folders in the recent category.

add recent folders as custom tasks to the list as I am not able to make folders show natively

It's showing up in Recent Folders, not under Tasks for me (which is nicer!).

image

@octref yes I decided to put folders into their own category to simulate the behaviour of the explorer where files and folders are also separate. You say this should be changed?

@bpasero

Oh I thought by this

I pushed a change to add recent folders as custom tasks

You meant the folders would show up under the category "Tasks" in the screenshot above.
But now I understand the current "Recent Folders" are actually custom tasks.

Which is of course a good change. Only thing I'd say is to change the icons to folder icons if you could.

Yes, if someone can provide me with good looking folder icons, I can add them. @bgashler1 maybe? I think the format needs to be *.ico

Was this page helpful?
0 / 5 - 0 ratings