You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dock menu of the application separates actions and recent entries.
Actual behavior
There are entries mixed.
How to reproduce
See this:
We are using a combination of app.clearRecentDocuments and app.addRecentDocument whenever a file or folder is opened with VS Code. We always first clear all recent documents and then add all the ones in MRU order.
What further information can I provide to find out more?
@bpasero Since the recent documents menu is only updated in historyMainService.ts, can you provide a sample mru = this.getRecentlyOpened() that causes the menu to fail? I can help debug if it's something fixable within Electron's scope.
@bpasero From my testing with macOS 10.13.2 an overflowing of menu items seems working fine. What's your settings in "System Preferences" for recent items? 😕 It appears that bpaser-chokidar and bpaser-fsevents are overridden by the separator and the "Hello World!" in the screenshot...
Since MAX_MACOS_DOCK_RECENT_ENTRIES is set as 10 by default (vs/platform/history/electron-main/historyMainService.ts#L32), I'm wondering if the macOS settings may be conflicting with that. If that happens to be the case, an API may be exposed from Electron to get the actual allowance?
If it's something happening on the OS level, the Atom editor should experience a similar issue
If it's to do with VSCode specifically, probably commenting out vs/code/electron-main/menus.ts#L309-L316 would fix the broken layout... Probably worth trying this out, and see what this will point us to do next?
@sethlu how is this issue related to VS Code, I can reproduce it with the code I provided in a standalone electron application as outlined in #11159 (comment)?
Since Electron only offers a thin layer on top of the actual system API, I doubt if this is an issue with macOS itself. 😮 There was an app that I was using yesterday (OmniOutliner, non-Electron-based app) and it’s experiencing a same issue.
Mhm I’m finding difficulty reproducing the failing case. I'm wondering whether the recent document menu items are out of the scope of Electron’s layer (not set with NSApplication’s dockMenu) since they are managed with addRecentDocument/clearRecentDocuments. There seems to be also quite a short of documentation on the handling of menu model and how the dock menu we set is drawn in interference with the automatically populated items.
There are two tests whose results I’m interested in investigating however:
If we clear the recent documents first and afterwards add each link at an one-second interval, will the issue still occur?
If we do not clear the recent documents but directly add all the recent documents (since repeating entries are accepted and managed by AppKit), will the menu items still overflow?
@bpasero I think this may be an issue related to macOS rather than Electron... Can you provide a screenshot of the final result? Also did you leave the dock menu as default as well?
If we can call recentdocumenturls, then we can do a cross-comparison of what we expect to be in the dock and what's actually in the dock. Then we can tell the app to clear and recreate the dock entries if there's a mismatch. Unfortunately, it doesn't seem like the Mac OS X API lets us manipulate entries one-by-one, but it's better then nothing.
Thank you for taking the time to report this issue and helping to make Electron better.
The version of Electron you reported this on has been superseded by newer releases.
If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.
I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.
We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. I'm going to close this but don't hesitate to reach out if you have or find the answers we need, we'll be happy to reopen the issue.
Activity
sethlu commentedon Nov 21, 2017
@bpasero Since the recent documents menu is only updated in
historyMainService.ts, can you provide a samplemru = this.getRecentlyOpened()that causes the menu to fail? I can help debug if it's something fixable within Electron's scope.bpasero commentedon Nov 22, 2017
@sethlu I can reproduce by the following recent documents:
Results in:
sethlu commentedon Nov 22, 2017
@bpasero Great! 👍 Testing it now...
sethlu commentedon Nov 22, 2017
@bpasero From my testing with macOS 10.13.2 an overflowing of menu items seems working fine. What's your settings in "System Preferences" for recent items? 😕 It appears that
bpaser-chokidarandbpaser-fseventsare overridden by the separator and the "Hello World!" in the screenshot...Since
MAX_MACOS_DOCK_RECENT_ENTRIESis set as 10 by default (vs/platform/history/electron-main/historyMainService.ts#L32), I'm wondering if the macOS settings may be conflicting with that. If that happens to be the case, an API may be exposed from Electron to get the actual allowance?bpasero commentedon Nov 22, 2017
@sethlu
sethlu commentedon Nov 22, 2017
@bpasero So far I could come up with 2 tests:
bpasero commentedon Nov 23, 2017
@sethlu how is this issue related to VS Code, I can reproduce it with the code I provided in a standalone electron application as outlined in #11159 (comment)?
sethlu commentedon Nov 23, 2017
Since Electron only offers a thin layer on top of the actual system API, I doubt if this is an issue with macOS itself. 😮 There was an app that I was using yesterday (OmniOutliner, non-Electron-based app) and it’s experiencing a same issue.
sethlu commentedon Nov 24, 2017
Mhm I’m finding difficulty reproducing the failing case. I'm wondering whether the recent document menu items are out of the scope of Electron’s layer (not set with
NSApplication’sdockMenu) since they are managed withaddRecentDocument/clearRecentDocuments. There seems to be also quite a short of documentation on the handling of menu model and how the dock menu we set is drawn in interference with the automatically populated items.There are two tests whose results I’m interested in investigating however:
bpasero commentedon Nov 24, 2017
@sethlu I can still reproduce when I delay the addition of recent documents by 1s each.
sethlu commentedon Nov 24, 2017
@bpasero I think this may be an issue related to macOS rather than Electron... Can you provide a screenshot of the final result? Also did you leave the dock menu as default as well?
bpasero commentedon Nov 25, 2017
@sethlu screenshot is in #11159 (comment)
Yes, I only added recent documents
6 remaining items
bpasero commentedon Jan 9, 2019
@sofianguy yes
bpasero commentedon Mar 11, 2019
I finally figured out what is triggering it: if you add an entry to the dock that does not exist on disk, the list gets into this broken state!
@MarshallOfSound and others, I can do a PR on updating the docs or is this something that should be fixed by Electron itself?
bpasero commentedon Mar 11, 2019
Related discussion: microsoft/vscode#57272 (comment)
clshortfuse commentedon Mar 11, 2019
It could help to add support for:
https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1514976-recentdocumenturls
If we can call
recentdocumenturls, then we can do a cross-comparison of what we expect to be in the dock and what's actually in the dock. Then we can tell the app to clear and recreate the dock entries if there's a mismatch. Unfortunately, it doesn't seem like the Mac OS X API lets us manipulate entries one-by-one, but it's better then nothing.sofianguy commentedon Aug 9, 2019
@bpasero is this bug still happening on version 4.2.x or later?
bpasero commentedon Aug 9, 2019
Yeah, nothing changed. The workaround for VSCode is to make sure that every entry in the dock we add exists on disk.
electron-triage commentedon Feb 19, 2020
Thank you for taking the time to report this issue and helping to make Electron better.
The version of Electron you reported this on has been superseded by newer releases.
If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.
I'm setting the
blocked/need-infolabel for the above reasons. This issue will be closed 7 days from now if there is no response.Thanks in advance! Your help is appreciated.
electron-triage commentedon Mar 6, 2020
Thank you for your issue!
We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. I'm going to close this but don't hesitate to reach out if you have or find the answers we need, we'll be happy to reopen the issue.