Skip to content

Commit 8dff641

Browse files
authored
Convert more calls to SyncActionDescriptor.create to SyncActionDescriptor.from (microsoft#95795)
Rewrites a few of the remaining calls to `SyncActionDescriptor.create` to use the new `SyncActionDescriptor.from` helper
1 parent 4f94d11 commit 8dff641

8 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/vs/workbench/browser/parts/panel/panelActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(TogglePanelActi
282282
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(FocusPanelAction), 'View: Focus into Panel', nls.localize('view', "View"));
283283
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleMaximizedPanelAction), 'View: Toggle Maximized Panel', nls.localize('view', "View"));
284284
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(ClosePanelAction), 'View: Close Panel', nls.localize('view', "View"));
285-
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.create(ToggleMaximizedPanelAction, ToggleMaximizedPanelAction.ID, undefined), 'View: Toggle Panel Position', nls.localize('view', "View"));
285+
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleMaximizedPanelAction), 'View: Toggle Panel Position', nls.localize('view', "View"));
286286
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(PreviousPanelViewAction), 'View: Previous Panel View', nls.localize('view', "View"));
287287
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(NextPanelViewAction), 'View: Next Panel View', nls.localize('view', "View"));
288288

src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ actionRegistry.registerWorkbenchAction(listOutdatedActionDescriptor, 'Extensions
104104
const recommendationsActionDescriptor = SyncActionDescriptor.from(ShowRecommendedExtensionsAction);
105105
actionRegistry.registerWorkbenchAction(recommendationsActionDescriptor, 'Extensions: Show Recommended Extensions', ExtensionsLabel);
106106

107-
const keymapRecommendationsActionDescriptor = SyncActionDescriptor.create(ShowRecommendedKeymapExtensionsAction, ShowRecommendedKeymapExtensionsAction.ID, ShowRecommendedKeymapExtensionsAction.SHORT_LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_M) });
107+
const keymapRecommendationsActionDescriptor = SyncActionDescriptor.from(ShowRecommendedKeymapExtensionsAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_M) });
108108
actionRegistry.registerWorkbenchAction(keymapRecommendationsActionDescriptor, 'Preferences: Keymaps', PreferencesLabel);
109109

110-
const languageExtensionsActionDescriptor = SyncActionDescriptor.create(ShowLanguageExtensionsAction, ShowLanguageExtensionsAction.ID, ShowLanguageExtensionsAction.SHORT_LABEL);
110+
const languageExtensionsActionDescriptor = SyncActionDescriptor.from(ShowLanguageExtensionsAction);
111111
actionRegistry.registerWorkbenchAction(languageExtensionsActionDescriptor, 'Preferences: Language Extensions', PreferencesLabel);
112112

113-
const azureExtensionsActionDescriptor = SyncActionDescriptor.create(ShowAzureExtensionsAction, ShowAzureExtensionsAction.ID, ShowAzureExtensionsAction.SHORT_LABEL);
113+
const azureExtensionsActionDescriptor = SyncActionDescriptor.from(ShowAzureExtensionsAction);
114114
actionRegistry.registerWorkbenchAction(azureExtensionsActionDescriptor, 'Preferences: Azure Extensions', PreferencesLabel);
115115

116116
const popularActionDescriptor = SyncActionDescriptor.from(ShowPopularExtensionsAction);

src/vs/workbench/contrib/extensions/browser/extensionsActions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ export class UndoIgnoreExtensionRecommendationAction extends Action {
18441844
export class ShowRecommendedKeymapExtensionsAction extends Action {
18451845

18461846
static readonly ID = 'workbench.extensions.action.showRecommendedKeymapExtensions';
1847-
static readonly SHORT_LABEL = localize('showRecommendedKeymapExtensionsShort', "Keymaps");
1847+
static readonly LABEL = localize('showRecommendedKeymapExtensionsShort', "Keymaps");
18481848

18491849
constructor(
18501850
id: string,
@@ -1867,7 +1867,7 @@ export class ShowRecommendedKeymapExtensionsAction extends Action {
18671867
export class ShowLanguageExtensionsAction extends Action {
18681868

18691869
static readonly ID = 'workbench.extensions.action.showLanguageExtensions';
1870-
static readonly SHORT_LABEL = localize('showLanguageExtensionsShort', "Language Extensions");
1870+
static readonly LABEL = localize('showLanguageExtensionsShort', "Language Extensions");
18711871

18721872
constructor(
18731873
id: string,
@@ -1890,7 +1890,7 @@ export class ShowLanguageExtensionsAction extends Action {
18901890
export class ShowAzureExtensionsAction extends Action {
18911891

18921892
static readonly ID = 'workbench.extensions.action.showAzureExtensions';
1893-
static readonly SHORT_LABEL = localize('showAzureExtensionsShort', "Azure Extensions");
1893+
static readonly LABEL = localize('showAzureExtensionsShort', "Azure Extensions");
18941894

18951895
constructor(
18961896
id: string,

src/vs/workbench/contrib/remote/browser/remote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class OpenRemoteViewletAction extends ShowViewletAction {
591591

592592
// Register Action to Open Viewlet
593593
Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction(
594-
SyncActionDescriptor.create(OpenRemoteViewletAction, VIEWLET_ID, nls.localize('toggleRemoteViewlet', "Show Remote Explorer"), {
594+
SyncActionDescriptor.from(OpenRemoteViewletAction, {
595595
primary: 0
596596
}),
597597
'View: Show Remote Explorer',

src/vs/workbench/contrib/scm/browser/scm.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { Codicon } from 'vs/base/common/codicons';
3232
class OpenSCMViewletAction extends ShowViewletAction {
3333

3434
static readonly ID = VIEWLET_ID;
35-
static readonly LABEL = localize('toggleGitViewlet', "Show Git");
35+
static readonly LABEL = localize('toggleSCMViewlet', "Show SCM");
3636

3737
constructor(id: string, label: string, @IViewletService viewletService: IViewletService, @IEditorGroupsService editorGroupService: IEditorGroupsService, @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService) {
3838
super(id, label, VIEWLET_ID, viewletService, editorGroupService, layoutService);
@@ -63,7 +63,7 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
6363

6464
// Register Action to Open Viewlet
6565
Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction(
66-
SyncActionDescriptor.create(OpenSCMViewletAction, VIEWLET_ID, localize('toggleSCMViewlet', "Show SCM"), {
66+
SyncActionDescriptor.from(OpenSCMViewletAction, {
6767
primary: 0,
6868
win: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G },
6969
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G },

src/vs/workbench/contrib/search/browser/search.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.Workbenc
557557

558558
// Show Search and Find in Files are redundant, but we can't break keybindings by removing one. So it's the same action, same keybinding, registered to different IDs.
559559
// Show Search 'when' is redundant but if the two conflict with exactly the same keybinding and 'when' clause, then they can show up as "unbound" - #51780
560-
registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenSearchViewletAction, VIEWLET_ID, OpenSearchViewletAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F }, Constants.SearchViewVisibleKey.toNegated()), 'View: Show Search', nls.localize('view', "View"));
560+
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenSearchViewletAction, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_F }, Constants.SearchViewVisibleKey.toNegated()), 'View: Show Search', nls.localize('view', "View"));
561561
KeybindingsRegistry.registerCommandAndKeybindingRule({
562562
id: Constants.FindInFilesActionId,
563563
weight: KeybindingWeight.WorkbenchContrib,

src/vs/workbench/contrib/search/browser/searchActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { IReplaceService } from 'vs/workbench/contrib/search/common/replace';
2222
import { FolderMatch, FileMatch, FolderMatchWithResource, Match, RenderableMatch, searchMatchComparer, SearchResult } from 'vs/workbench/contrib/search/common/searchModel';
2323
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
2424
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
25-
import { ISearchConfiguration, VIEW_ID } from 'vs/workbench/services/search/common/search';
25+
import { ISearchConfiguration, VIEW_ID, VIEWLET_ID } from 'vs/workbench/services/search/common/search';
2626
import { ISearchHistoryService } from 'vs/workbench/contrib/search/common/searchHistoryService';
2727
import { ITreeNavigator } from 'vs/base/browser/ui/tree/tree';
2828
import { IViewsService } from 'vs/workbench/common/views';
@@ -182,6 +182,7 @@ export const FindInFilesCommand: ICommandHandler = (accessor, args: IFindInFiles
182182

183183
export class OpenSearchViewletAction extends FindOrReplaceInFilesAction {
184184

185+
static readonly ID = VIEWLET_ID;
185186
static readonly LABEL = nls.localize('showSearch', "Show Search");
186187

187188
constructor(id: string, label: string,

src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ registerSingleton(IWebviewService, ElectronWebviewService, true);
1919
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
2020

2121
actionRegistry.registerWorkbenchAction(
22-
SyncActionDescriptor.create(webviewCommands.OpenWebviewDeveloperToolsAction, webviewCommands.OpenWebviewDeveloperToolsAction.ID, webviewCommands.OpenWebviewDeveloperToolsAction.LABEL),
22+
SyncActionDescriptor.from(webviewCommands.OpenWebviewDeveloperToolsAction),
2323
webviewCommands.OpenWebviewDeveloperToolsAction.ALIAS,
2424
webviewDeveloperCategory);
2525

0 commit comments

Comments
 (0)