-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[git] Group the context menu items per Git command #8400 #9324
Conversation
@kittaakos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -204,7 +204,32 @@ export namespace GIT_COMMANDS { | |||
category: 'Git' | |||
}; | |||
} | |||
export namespace GIT_MENUS { | |||
// Main menu groups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following comment may be misleading, the main menu
is the top-level menu.
We can likely omit the comment entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. I will remove it
@vince-fugnitto This is probably because we have PULL and PUSH in favorites group and as submenu entry. Would it be fine to just create the entries with different command id's or is there a way to reference the same command in different menu items? |
The error happens when we attempt to register the same command theia/packages/core/src/common/command.ts Lines 189 to 198 in b722e4d
This happens when we call theia/packages/git/src/browser/git-contribution.ts Lines 541 to 545 in b722e4d
One solution might need to register a new command which wraps the existing, and is used in the submenu, but there might be others: export const PULL_DEFAULT_SUBMENU = {
id: 'git.pull.default.submenu',
}; registry.registerCommand(GIT_COMMANDS.PULL_DEFAULT_SUBMENU, {
execute: () => registry.executeCommand(GIT_COMMANDS.PULL_DEFAULT.id),
isEnabled: () => !!this.repositoryTracker.selectedRepository
}); |
@kittaakos Unfortunately priorities are lost due to missing @vince-fugnitto |
@kittaakos Regarding the order, I see any chance to do it properly because of alphabetical sorting due to missing SubMenuOptions here: https://github.com/eclipse-theia/theia/pull/9324/files#diff-07529f987e23173e43dafbf57a0b4b625978849167b48205fc30d3f806feec01 Missing ...because the sorting string is the MenuItem label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have verified it on Gitpod, and it worked:
- there were no warnings in the console due to the duplicate command registration,
- all menu items were there, and
- the Git commands I have tried ran successfully.
Thank you, @dhuebner 👍
@vince-fugnitto, could you please check if you're happy with the merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that the menu is correctly populated and organized when testing 👍
@dhuebner, can you please squash your commits? Thank you! |
Update packages/git/src/browser/git-contribution.ts Co-authored-by: Vincent Fugnitto <[email protected]> Signed-off-by: Dennis Hübner <[email protected]>
@kittaakos |
What it does
Groups menu items in git toolbar menu into sub-menus
How to test
Open Source Control view, open toolbar menu. Grouped menu should be shown:
Review checklist
Reminder for reviewers