Skip to content

Commit

Permalink
SCM - use overlay with scmProvider context key (#200642)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Dec 12, 2023
1 parent c8d3de5 commit c9419b7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,7 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {

constructor(
container: HTMLElement,
input: ISCMInput,
menuId: MenuId,
options: IMenuWorkbenchToolBarOptions | undefined,
@IMenuService menuService: IMenuService,
Expand All @@ -1824,7 +1825,13 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
) {
super(container, { resetMenu: menuId, ...options }, menuService, contextKeyService, contextMenuService, keybindingService, telemetryService);

const menu = this._store.add(menuService.createMenu(menuId, contextKeyService, { emitEventsForSubmenuChanges: true }));
const contextKeyServiceWithOverlay = contextKeyService.createOverlay([
['scmProvider', input.repository.provider.contextValue],
['scmProviderRootUri', input.repository.provider.rootUri?.toString()],
['scmProviderHasRootUri', !!input.repository.provider.rootUri]
]);

const menu = this._store.add(menuService.createMenu(menuId, contextKeyServiceWithOverlay, { emitEventsForSubmenuChanges: true }));

const cancelAction = new MenuItemAction({
id: SCMInputCommandId.CancelAction,
Expand Down Expand Up @@ -2095,7 +2102,7 @@ class SCMInputWidget {
const actionRunner = instantiationService2.createInstance(SCMInputWidgetActionRunner, input);
this.repositoryDisposables.add(actionRunner);

const toolbar: SCMInputWidgetToolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, MenuId.SCMInputBox, {
const toolbar: SCMInputWidgetToolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, input, MenuId.SCMInputBox, {
actionRunner,
actionViewItemProvider: action => {
if (action instanceof MenuItemAction && toolbar.dropdownActions.length > 1) {
Expand Down

0 comments on commit c9419b7

Please sign in to comment.