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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCM - SCMInputWidget toolbar 馃拕 #199885

Merged
merged 1 commit into from
Dec 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1769,10 +1769,14 @@ class HistoryItemViewChangesAction extends Action2 {

registerAction2(HistoryItemViewChangesAction);

const enum SCMInputCommandId {
const enum SCMInputWidgetCommandId {
CancelAction = 'scm.input.cancelAction'
}

const enum SCMInputWidgetStorageKey {
LastActionId = 'scm.input.lastActionId'
}

class SCMInputWidgetActionRunner extends ActionRunner {

private readonly _runningActions = new Set<IAction>();
Expand All @@ -1794,7 +1798,7 @@ class SCMInputWidgetActionRunner extends ActionRunner {
if (this.runningActions.size !== 0) {
this._cts?.cancel();

if (action.id === SCMInputCommandId.CancelAction) {
if (action.id === SCMInputWidgetCommandId.CancelAction) {
return;
}
}
Expand All @@ -1817,7 +1821,7 @@ class SCMInputWidgetActionRunner extends ActionRunner {

// Save last action
if (this._runningActions.size === 0) {
this.storageService.store('scm.input.lastActionId', action.id, StorageScope.PROFILE, StorageTarget.USER);
this.storageService.store(SCMInputWidgetStorageKey.LastActionId, action.id, StorageScope.PROFILE, StorageTarget.USER);
}
}
}
Expand Down Expand Up @@ -1854,12 +1858,11 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {

this._dropdownAction = new Action(
'scmInputMoreActions',
localize('scmInputMoreActions', 'More Actions...'),
'codicon-chevron-down',
true);
localize('scmInputMoreActions', "More Actions..."),
'codicon-chevron-down');

const cancelAction = new MenuItemAction({
id: SCMInputCommandId.CancelAction,
id: SCMInputWidgetCommandId.CancelAction,
title: localize('scmInputCancelAction', "Cancel"),
icon: Codicon.debugStop,
}, undefined, undefined, undefined, contextKeyService, commandService);
Expand All @@ -1882,7 +1885,7 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
if (actions.length === 1) {
primaryAction = actions[0];
} else if (actions.length > 1) {
const lastActionId = storageService.get('scm.input.lastActionId', StorageScope.PROFILE, '');
const lastActionId = storageService.get(SCMInputWidgetStorageKey.LastActionId, StorageScope.PROFILE, '');
primaryAction = actions.find(a => a.id === lastActionId) ?? actions[0];
}

Expand Down