theia
theia copied to clipboard
builtin-git: add support for missing menu paths
Bug Description:
There are issues when using the vscode.git and vscode.git-ui builtins as it references unsupported menu paths:
Failed to register a menu item for plugin vscode.git contributed to scm/sourceControl
Failed to register a menu item for plugin vscode.git contributed to editor/content
Failed to register a menu item for plugin vscode.git contributed to scm/change/title
Steps to Reproduce:
- remove
vscode.git
andvscode.git-ui
from the exclusion list
https://github.com/eclipse-theia/theia/blob/978a3a0d504f5f54425175d88afee2cdf1617d02/package.json#L119-L120
- remove
@theia/git
and@theia/scm-extra
from the example applications - rebuild, and confirm that the
download:script
pulls the git builtins - notice the errors related to not being able to set the toolbar items
Hi @vince-fugnitto, @colin-grant-work I have a similar or maybe the same issue. I am getting this error when trying to press on the 3 dots toolbar menu on the git/source control:
Uncaught Error: 'git.tags' is not a menu group.
at MenuModelRegistry.findSubMenu (menu-model-registry.ts:250:19)
at MenuModelRegistry.findGroup (menu-model-registry.ts:235:32)
at MenuModelRegistry.getMenuNode (menu-model-registry.ts:112:25)
at MenuModelRegistry.linkSubmenu (menu-model-registry.ts:170:28)
at TabBarToolbar.renderMoreContextMenu (tab-bar-toolbar.tsx:183:53)
at TabBarToolbar.showMoreContextMenu (tab-bar-toolbar.tsx:166:14)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom.development.js:4277:1)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1)
Can I fix this issue in my Theia extension (by overriding some methods)? If so, can you point out where can I start from?
Thanks in advance
@safisa, I think I've tracked down the source of your problem. I'll make a PR for it in a bit.
Hi,
Also the following warn messages in the console (copied from the forum https://community.theia-ide.org/t/many-vscode-git-extension-warning-messages-in-console-log/3032):
WARN Failed to register a menu item for plugin vscode.git contributed to scm/sourceControl Object Error: Could not find submenu with id scm/sourceControl
{command: 'git.acceptMerge', submenu: undefined, alt: undefined, group: undefined, when: 'isMergeEditor && mergeEditorBaseUri =~ /^(git|file):/ && mergeEditorResultUri in git.mergeChanges'}
WARN Failed to register a menu item for plugin vscode.git contributed to merge/toolbar Object Error: Could not find submenu with id merge/toolbar
{command: 'git.stageChange', submenu: undefined, alt: undefined, group: undefined, when: 'config.git.enabled && !git.missing && originalResourceScheme == git'}
WARN Failed to register a menu item for plugin vscode.git contributed to scm/change/title Object Error: Could not find submenu with id scm/change/title
{command: 'git.revertChange', submenu: undefined, alt: undefined, group: undefined, when: 'config.git.enabled && !git.missing && originalResourceScheme == git'}
Thanks
The 2 scm menus are listed in the missing vscode declarative APIs issue (#13051 ), and more specifically in the comment https://github.com/eclipse-theia/theia/issues/13051#issuecomment-1875063218.
editor/content is a proposed API (see https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts)
documentation for the source control menus: https://code.visualstudio.com/api/extension-guides/scm-provider#menus
@dhuebner Would you be interested in looking at this? IIRC, you added some declarative API in the past or am I mistaken?
@JonasHelming Sure, I can take a look this week.
@JonasHelming I did some investigation regarding the missing sub menu entries. The problem is that we have missing functionality in this area and there is simply no place where we can register this menu contribution. @rschnekenbu please correct me if I'm wrong.
Following the list of Failed to register a menu item
warning logs I found by following the "Steps to reproduce" instructions. In parenthesis I listed the command ids:
- scm/sourceControl/title (git.reopenClosedRepositories) - not supported needs multi repo support
- scm/sourceControl (git.closeOtherRepositories) - not supported needs multi repo support
- scm/incomingChanges (git.fetchRef, git.pullRef) - Incoming/Outgoing section is missing in SCM view
- scm/incomingChanges/context (git.pullRef) - Incoming/Outgoing section is missing in SCM view
- scm/incomingChanges/allChanges/context (git.viewAllChanges) - Incoming/Outgoing section is missing in SCM view
- scm/incomingChanges/historyItem/context (git.viewCommit) - no Incoming/Outgoing section
- scm/outgoingChanges - same as scm/incomingChanges, see above
- editor/content (git.acceptMerge, git.openMergeEditor) - experimental API? Seem to be the blue rectangle button in the editors bottom right conner, not supported
- multiDiffEditor/resource/title (git.stageFile, git.unstageFile) - multiDiffEditor is not supported
- diffEditor/gutter/hunk (git.diff.stageHunk) - no idea where is this menu need to be added
- diffEditor/gutter/selection (git.diff.stageSelection) - no idea where is this menu need to be added
So it is not just adding a new sub menu, but implementing missing scm, editor and diff-editor features that IMHO should be tracked in separate enhancement issues. I would suggest to remove this issue from the epic container issue.
@dhuebner That makes a lot of sense, thank you for the investigation! Would you mind creating the new issue, now that you have all the details at hand? I will remove the issue from the epic.