Skip to content

Commit

Permalink
Merge pull request #502 from che-incubator/fix-source-control-actions
Browse files Browse the repository at this point in the history
fix: Fix 'Changes' actions of the Source Control panel
  • Loading branch information
RomanNikitenko authored Feb 7, 2025
2 parents 64d81ea + f545472 commit f6b0d3e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
14 changes: 7 additions & 7 deletions code/extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@
"title": "%command.stageAll%",
"category": "Git",
"icon": "$(add)",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.stageAllTracked",
"title": "%command.stageAllTracked%",
"category": "Git",
"icon": "$(add)",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.stageAllUntracked",
Expand Down Expand Up @@ -244,7 +244,7 @@
"title": "%command.unstageAll%",
"category": "Git",
"icon": "$(remove)",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.unstageSelectedRanges",
Expand All @@ -271,14 +271,14 @@
"title": "%command.cleanAll%",
"category": "Git",
"icon": "$(discard)",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.cleanAllTracked",
"title": "%command.cleanAllTracked%",
"category": "Git",
"icon": "$(discard)",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.cleanAllUntracked",
Expand Down Expand Up @@ -902,14 +902,14 @@
"title": "%command.viewChanges%",
"icon": "$(diff-multiple)",
"category": "Git",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.viewStagedChanges",
"title": "%command.viewStagedChanges%",
"icon": "$(diff-multiple)",
"category": "Git",
"enablement": "!operationInProgress && scmResourceGroupResourceCount > 0"
"enablement": "!operationInProgress"
},
{
"command": "git.viewUntrackedChanges",
Expand Down
20 changes: 9 additions & 11 deletions code/src/vs/workbench/contrib/scm/browser/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { IAction } from '../../../../base/common/actions.js';
import { equals } from '../../../../base/common/arrays.js';
import { Emitter } from '../../../../base/common/event.js';
import { DisposableStore, IDisposable, MutableDisposable, dispose } from '../../../../base/common/lifecycle.js';
import { DisposableStore, IDisposable, dispose } from '../../../../base/common/lifecycle.js';
import './media/scm.css';
import { localize } from '../../../../nls.js';
import { getActionBarActions } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';
Expand Down Expand Up @@ -70,14 +70,13 @@ interface IContextualResourceMenuItem {

class SCMMenusItem implements IDisposable {

private readonly _resourceGroupMenu = new MutableDisposable<IMenu>();
private _resourceGroupMenu: IMenu | undefined;
get resourceGroupMenu(): IMenu {
const contextKeyService = this.contextKeyService.createOverlay([
['scmResourceGroupResourceCount', this.group.resources.length],
]);
if (!this._resourceGroupMenu) {
this._resourceGroupMenu = this.menuService.createMenu(MenuId.SCMResourceGroupContext, this.contextKeyService);
}

this._resourceGroupMenu.value = this.menuService.createMenu(MenuId.SCMResourceGroupContext, contextKeyService);
return this._resourceGroupMenu.value;
return this._resourceGroupMenu;
}

private _resourceFolderMenu: IMenu | undefined;
Expand All @@ -93,9 +92,8 @@ class SCMMenusItem implements IDisposable {
private contextualResourceMenus: Map<string /* contextValue */, IContextualResourceMenuItem> | undefined;

constructor(
private readonly group: ISCMResourceGroup,
private readonly contextKeyService: IContextKeyService,
private readonly menuService: IMenuService
private contextKeyService: IContextKeyService,
private menuService: IMenuService
) { }

getResourceMenu(resource: ISCMResource): IMenu {
Expand Down Expand Up @@ -208,7 +206,7 @@ export class SCMRepositoryMenus implements ISCMRepositoryMenus, IDisposable {
['multiDiffEditorEnableViewChanges', group.multiDiffEditorEnableViewChanges],
]);

result = new SCMMenusItem(group, contextKeyService, this.menuService);
result = new SCMMenusItem(contextKeyService, this.menuService);
this.resourceGroupMenusItems.set(group, result);
}

Expand Down

0 comments on commit f6b0d3e

Please sign in to comment.