Skip to content
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

Fix context-keys ScmProvider update, add submenu plugin contribution #8996

Merged
merged 1 commit into from
Feb 4, 2021

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Jan 27, 2021

Signed-off-by: Igor Vinokur [email protected]

What it does

Fixes #8724

  • Update the ScmProvider context-keys on SCM widget start to handle properly the when condition of the related menu items.
  • Apply submenu plugin contribution to be able to render submenus in the SCM view.

How to test

  1. Remove "@theia/git": "^1.9.0" from examples/browser/package.json file.
  2. Download vscode-git-1.49.3 and copy it to the plugins folder.
  3. Open a workspace with a git project and open the SCM panel
  4. Try the ... drop-down menu.
    See:
    screenshot-localhost_3000-2021 01 27-16_51_48

Review checklist

Reminder for reviewers

@vince-fugnitto vince-fugnitto added scm issues related to the source control manager vscode issues related to VSCode compatibility labels Jan 29, 2021
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that the submenus present in the scm view with the builtin git extensions (both git and git-ui) are now populated 👍

packages/core/src/browser/shell/tab-bar-toolbar.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/shell/tab-bar-toolbar.tsx Outdated Show resolved Hide resolved
@vinokurig
Copy link
Contributor Author

@vince-fugnitto I've reworked this PR to hanle multiple nestance level of the submenus. To test it you should add such submenu contribution to the package.json of any theia plugin:

"contributes": {
    "menus": {
      "scm/title": [
        {
          "submenu": "git.custosubmenu1",
          "group": "2_main@3",
          "when": "scmProvider == git"
        },
        {
          "command": "git.clone",
          "group": "1_header@3",
          "when": "scmProvider == git"
        }
      ],
      "git.custosubmenu1": [
        {
          "submenu": "git.custosubmenu2",
          "group": "1_sync"
        },
        {
          "command": "git.sync",
          "group": "1_sync"
        }
      ],
      "git.custosubmenu2": [
        {
          "command": "git.sync",
          "group": "1_custom"
        }
      ]
    },
    "submenus": [
      {
        "id": "git.custosubmenu1",
        "label": "Custom Submenu 1"
      },
      {
        "id": "git.custosubmenu2",
        "label": "Custom Submenu 2"
      }
    ]
  }

And it will look like:
screenshot-localhost_3000-2021 02 02-14_21_05

@vinokurig vinokurig force-pushed the che-18742 branch 2 times, most recently from 6bb4ec2 to 9328275 Compare February 2, 2021 12:25
@vince-fugnitto
Copy link
Member

@vinokurig thank you, I'll take a look at the changes shortly 👍
I believe it fixes the following issue if you'd like to track it: #8724.

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinokurig I confirmed that the pull-request works well with:

I'm not sure if you want others to review the changes as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scm issues related to the source control manager vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add VS Code API to contribute submenus
2 participants