eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.85k stars 2.49k forks source link

builtin-git: add support for missing menu paths #11730

Open vince-fugnitto opened 1 year ago

vince-fugnitto commented 1 year ago

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:

  1. remove vscode.git and vscode.git-ui from the exclusion list

https://github.com/eclipse-theia/theia/blob/978a3a0d504f5f54425175d88afee2cdf1617d02/package.json#L119-L120

  1. remove @theia/git and @theia/scm-extra from the example applications
  2. rebuild, and confirm that the download:script pulls the git builtins
  3. notice the errors related to not being able to set the toolbar items
safisa commented 1 year ago

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

colin-grant-work commented 1 year ago

@safisa, I think I've tracked down the source of your problem. I'll make a PR for it in a bit.

safisa commented 1 year ago

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

rschnekenbu commented 7 months ago

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

JonasHelming commented 3 months ago

@dhuebner Would you be interested in looking at this? IIRC, you added some declarative API in the past or am I mistaken?

dhuebner commented 3 months ago

@JonasHelming Sure, I can take a look this week.

dhuebner commented 3 months ago

@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:

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.

JonasHelming commented 3 months ago

@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.