From 9e101caf8524899419ce9a0cfdaea0012a4a29df Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Wed, 20 Sep 2023 12:40:21 +0800 Subject: [PATCH 01/11] fix: to #157015 fix view label command localized --- .../api/browser/mainThreadComments.ts | 2 +- .../api/browser/viewsExtensionPoint.ts | 2 +- .../test/browser/mainThreadTreeViews.test.ts | 2 +- .../browser/actions/layoutActions.ts | 8 +- .../browser/parts/views/viewPaneContainer.ts | 2 +- .../browser/parts/views/viewsService.ts | 4 +- src/vs/workbench/common/views.ts | 2 +- .../browser/preview/bulkEdit.contribution.ts | 2 +- .../browser/chatContributionServiceImpl.ts | 2 +- .../debug/browser/debug.contribution.ts | 14 ++-- .../editSessions/browser/editSessionsViews.ts | 2 +- .../extensions/browser/extensionsViewlet.ts | 55 +++++++------ .../contrib/files/browser/explorerViewlet.ts | 6 +- .../contrib/files/browser/views/emptyView.ts | 1 + .../files/browser/views/openEditorsView.ts | 1 + .../markers/browser/markers.contribution.ts | 2 +- .../outline/browser/outline.contribution.ts | 2 +- .../output/browser/output.contribution.ts | 2 +- .../quickaccess/browser/viewQuickAccess.ts | 2 +- .../remote/browser/explorerViewItems.ts | 2 +- .../contrib/remote/browser/remote.ts | 3 +- .../contrib/remote/browser/tunnelView.ts | 2 +- .../contrib/scm/browser/scm.contribution.ts | 4 +- .../search/browser/search.contribution.ts | 2 +- .../terminal/browser/terminal.contribution.ts | 2 +- .../testing/browser/testing.contribution.ts | 4 +- .../timeline/browser/timeline.contribution.ts | 2 +- .../userDataSync/browser/userDataSyncViews.ts | 16 ++-- .../userDataProfileImportExportService.ts | 2 +- .../views/browser/viewDescriptorService.ts | 2 +- .../views/common/viewContainerModel.ts | 2 +- .../test/browser/viewContainerModel.test.ts | 80 +++++++++---------- .../browser/viewDescriptorService.test.ts | 72 ++++++++--------- 33 files changed, 158 insertions(+), 150 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadComments.ts b/src/vs/workbench/api/browser/mainThreadComments.ts index 68455a45e4284..1e3413f1ec96e 100644 --- a/src/vs/workbench/api/browser/mainThreadComments.ts +++ b/src/vs/workbench/api/browser/mainThreadComments.ts @@ -611,7 +611,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ id: COMMENTS_VIEW_ID, - name: COMMENTS_VIEW_TITLE, + name: { value: COMMENTS_VIEW_TITLE, original: COMMENTS_VIEW_ORIGINAL_TITLE }, canToggleVisibility: false, ctorDescriptor: new SyncDescriptor(CommentsPanel), canMoveView: true, diff --git a/src/vs/workbench/api/browser/viewsExtensionPoint.ts b/src/vs/workbench/api/browser/viewsExtensionPoint.ts index 23d64b26b76eb..c17a247e22cc5 100644 --- a/src/vs/workbench/api/browser/viewsExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsExtensionPoint.ts @@ -535,7 +535,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution { type: type, ctorDescriptor: type === ViewType.Tree ? new SyncDescriptor(TreeViewPane) : new SyncDescriptor(WebviewViewPane), id: item.id, - name: item.name, + name: { value: item.name, original: item.name }, when: ContextKeyExpr.deserialize(item.when), containerIcon: icon || viewContainer?.icon, containerTitle: item.contextualTitle || (viewContainer && (typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.value)), diff --git a/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts b/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts index 249e6316dba63..dcac8d58fd98f 100644 --- a/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts +++ b/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts @@ -60,7 +60,7 @@ suite('MainThreadHostTreeView', function () { const viewDescriptor: ITreeViewDescriptor = { id: testTreeViewId, ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, treeView: disposables.add(instantiationService.createInstance(CustomTreeView, 'testTree', 'Test Title', 'extension.id')), }; ViewsRegistry.registerViews([viewDescriptor], container); diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index 348b59cc12cb9..800d5ac6b2c40 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -683,7 +683,7 @@ registerAction2(class extends Action2 { results.push({ id: viewDescriptor.id, - label: viewDescriptor.name + label: viewDescriptor.name.value }); } }); @@ -707,7 +707,7 @@ registerAction2(class extends Action2 { results.push({ id: viewDescriptor.id, - label: viewDescriptor.name + label: viewDescriptor.name.value }); } }); @@ -732,7 +732,7 @@ registerAction2(class extends Action2 { results.push({ id: viewDescriptor.id, - label: viewDescriptor.name + label: viewDescriptor.name.value }); } }); @@ -806,7 +806,7 @@ class MoveFocusedViewAction extends Action2 { const quickPick = quickInputService.createQuickPick(); quickPick.placeholder = localize('moveFocusedView.selectDestination', "Select a Destination for the View"); - quickPick.title = localize({ key: 'moveFocusedView.title', comment: ['{0} indicates the title of the view the user has selected to move.'] }, "View: Move {0}", viewDescriptor.name); + quickPick.title = localize({ key: 'moveFocusedView.title', comment: ['{0} indicates the title of the view the user has selected to move.'] }, "View: Move {0}", viewDescriptor.name.value); const items: Array = []; const currentContainer = viewDescriptorService.getViewContainerByViewId(focusedViewId)!; diff --git a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts index f23c48b7db104..590973d5e2b80 100644 --- a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts +++ b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts @@ -770,7 +770,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { const pane = this.createView(viewDescriptor, { id: viewDescriptor.id, - title: viewDescriptor.name, + title: viewDescriptor.name.value, fromExtensionId: (viewDescriptor as Partial).extensionId, expanded: !collapsed }); diff --git a/src/vs/workbench/browser/parts/views/viewsService.ts b/src/vs/workbench/browser/parts/views/viewsService.ts index ed0b160656bce..90f561fadeb3d 100644 --- a/src/vs/workbench/browser/parts/views/viewsService.ts +++ b/src/vs/workbench/browser/parts/views/viewsService.ts @@ -240,7 +240,7 @@ export class ViewsService extends Disposable implements IViewsService { getFocusedViewName(): string { const viewId: string = this.contextKeyService.getContextKeyValue(FocusedViewContext.key) ?? ''; - return this.viewDescriptorService.getViewDescriptorById(viewId.toString())?.name ?? ''; + return this.viewDescriptorService.getViewDescriptorById(viewId.toString())?.name?.value ?? ''; } async openView(id: string, focus?: boolean): Promise { @@ -485,7 +485,7 @@ export class ViewsService extends Disposable implements IViewsService { private registerFocusViewAction(viewDescriptor: IViewDescriptor, category?: string | ILocalizedString): IDisposable { return registerAction2(class FocusViewAction extends Action2 { constructor() { - const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name); + const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.value); super({ id: viewDescriptor.focusCommand ? viewDescriptor.focusCommand.id : `${viewDescriptor.id}.focus`, title: { original: `Focus on ${viewDescriptor.name} View`, value: title }, diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index 8633aac784a74..76b08aafb2482 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -264,7 +264,7 @@ export interface IViewDescriptor { readonly id: string; - readonly name: string; + readonly name: ILocalizedString; readonly ctorDescriptor: SyncDescriptor; diff --git a/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts b/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts index ff63502983bfc..c6ffd890a6b09 100644 --- a/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts +++ b/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts @@ -338,7 +338,7 @@ const container = Registry.as(ViewContainerExtensions.V Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: BulkEditPane.ID, - name: localize('panel', "Refactor Preview"), + name: { value: localize('panel', "Refactor Preview"), original: 'Refactor Preview' }, when: BulkEditPreviewContribution.ctxEnabled, ctorDescriptor: new SyncDescriptor(BulkEditPane), containerIcon: refactorPreviewViewIcon, diff --git a/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts b/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts index a16591501b534..4c02c8882333b 100644 --- a/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts +++ b/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts @@ -129,7 +129,7 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution { id: viewId, containerIcon: this._viewContainer.icon, containerTitle: this._viewContainer.title.value, - name: providerDescriptor.label, + name: { value: providerDescriptor.label, original: providerDescriptor.label }, canToggleVisibility: false, canMoveView: true, ctorDescriptor: new SyncDescriptor(ChatViewPane, [{ providerId: providerDescriptor.id }]), diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts index 987705921bdcd..4f6e8f1e88e41 100644 --- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts @@ -375,7 +375,7 @@ const VIEW_CONTAINER: ViewContainer = Registry.as(ViewE Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ id: REPL_VIEW_ID, - name: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"), + name: { value: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"), original: 'Debug Console' }, containerIcon: icons.debugConsoleViewIcon, canToggleVisibility: false, canMoveView: true, @@ -407,12 +407,12 @@ const viewContainer = Registry.as(ViewExtensions.ViewCo // Register default debug views const viewsRegistry = Registry.as(ViewExtensions.ViewsRegistry); -viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: nls.localize('variables', "Variables"), containerIcon: icons.variablesViewIcon, ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); -viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: nls.localize('watch', "Watch"), containerIcon: icons.watchViewIcon, ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); -viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: nls.localize('callStack', "Call Stack"), containerIcon: icons.callStackViewIcon, ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); -viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: nls.localize('breakpoints', "Breakpoints"), containerIcon: icons.breakpointsViewIcon, ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default'), CONTEXT_HAS_DEBUGGED) }], viewContainer); -viewsRegistry.registerViews([{ id: WelcomeView.ID, name: WelcomeView.LABEL, containerIcon: icons.runViewIcon, ctorDescriptor: new SyncDescriptor(WelcomeView), order: 1, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer); -viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize('loadedScripts', "Loaded Scripts"), containerIcon: icons.loadedScriptsViewIcon, ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer); +viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: { value: nls.localize('variables', "Variables"), original: 'Variables' }, containerIcon: icons.variablesViewIcon, ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); +viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: { value: nls.localize('watch', "Watch"), original: 'Watch' }, containerIcon: icons.watchViewIcon, ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); +viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: { value: nls.localize('callStack', "Call Stack"), original: 'Call Stack' }, containerIcon: icons.callStackViewIcon, ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); +viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: { value: nls.localize('breakpoints', "Breakpoints"), original: 'Breakpoints' }, containerIcon: icons.breakpointsViewIcon, ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default'), CONTEXT_HAS_DEBUGGED) }], viewContainer); +viewsRegistry.registerViews([{ id: WelcomeView.ID, name: { value: WelcomeView.LABEL, original: 'Run' }, containerIcon: icons.runViewIcon, ctorDescriptor: new SyncDescriptor(WelcomeView), order: 1, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer); +viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: { value: nls.localize('loadedScripts', "Loaded Scripts"), original: 'Loaded Scripts' }, containerIcon: icons.loadedScriptsViewIcon, ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer); // Register disassembly view diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts b/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts index a043ec34b849d..8552eb700f08d 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts @@ -47,7 +47,7 @@ export class EditSessionsDataViews extends Disposable { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([{ id: viewId, - name, + name: { value: name, original: name }, ctorDescriptor: new SyncDescriptor(TreeViewPane), canToggleVisibility: true, canMoveView: false, diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index 8f4b29443a94b..92f8fff073b8e 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -154,7 +154,12 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio /* Installed extensions view */ viewDescriptors.push({ id, - get name() { return getInstalledViewName(); }, + get name() { + return { + value: getInstalledViewName(), + original: getViewName('Installed', server) + }; + }, weight: 100, order: 1, when: ContextKeyExpr.and(DefaultViewsContext), @@ -214,7 +219,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.popular', - name: localize('popularExtensions', "Popular"), + name: { value: localize('popularExtensions', "Popular"), original: 'Popular' }, ctorDescriptor: new SyncDescriptor(DefaultPopularExtensionsView, [{ hideBadge: true }]), when: ContextKeyExpr.and(DefaultViewsContext, ContextKeyExpr.not('hasInstalledExtensions'), CONTEXT_HAS_GALLERY), weight: 60, @@ -229,7 +234,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'extensions.recommendedList', - name: localize('recommendedExtensions', "Recommended"), + name: { value: localize('recommendedExtensions', "Recommended"), original: 'Recommended' }, ctorDescriptor: new SyncDescriptor(DefaultRecommendedExtensionsView, [{ flexibleHeight: true }]), when: ContextKeyExpr.and(DefaultViewsContext, SortByUpdateDateContext.negate(), ContextKeyExpr.not('config.extensions.showRecommendationsOnlyOnDemand'), CONTEXT_HAS_GALLERY), weight: 40, @@ -245,7 +250,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.enabled', - name: localize('enabledExtensions', "Enabled"), + name: { value: localize('enabledExtensions', "Enabled"), original: 'Enabled' }, ctorDescriptor: new SyncDescriptor(EnabledExtensionsView, [{}]), when: ContextKeyExpr.and(DefaultViewsContext, ContextKeyExpr.has('hasInstalledExtensions')), hideByDefault: true, @@ -260,7 +265,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.disabled', - name: localize('disabledExtensions', "Disabled"), + name: { value: localize('disabledExtensions', "Disabled"), original: 'Disabled' }, ctorDescriptor: new SyncDescriptor(DisabledExtensionsView, [{}]), when: ContextKeyExpr.and(DefaultViewsContext, ContextKeyExpr.has('hasInstalledExtensions')), hideByDefault: true, @@ -282,7 +287,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.marketplace', - name: localize('marketPlace', "Marketplace"), + name: { value: localize('marketPlace', "Marketplace"), original: 'Marketplace' }, ctorDescriptor: new SyncDescriptor(SearchMarketplaceExtensionsView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchMarketplaceExtensions')), }); @@ -292,7 +297,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchInstalled', - name: localize('installed', "Installed"), + name: { value: localize('installed', "Installed"), original: 'Installed' }, ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchInstalledExtensions')), }); @@ -302,7 +307,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchRecentlyUpdated', - name: localize('recently updated', "Recently Updated"), + name: { value: localize('recently updated', "Recently Updated"), original: 'Recently Updated' }, ctorDescriptor: new SyncDescriptor(RecentlyUpdatedExtensionsView, [{}]), when: ContextKeyExpr.or(SearchExtensionUpdatesContext, ContextKeyExpr.has('searchRecentlyUpdatedExtensions')), order: 2, @@ -313,7 +318,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchEnabled', - name: localize('enabled', "Enabled"), + name: { value: localize('enabled', "Enabled"), original: 'Enabled' }, ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchEnabledExtensions')), }); @@ -323,7 +328,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchDisabled', - name: localize('disabled', "Disabled"), + name: { value: localize('disabled', "Disabled"), original: 'Disabled' }, ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchDisabledExtensions')), }); @@ -333,7 +338,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: OUTDATED_EXTENSIONS_VIEW_ID, - name: localize('availableUpdates', "Available Updates"), + name: { value: localize('availableUpdates', "Available Updates"), original: 'Available Updates' }, ctorDescriptor: new SyncDescriptor(OutdatedExtensionsView, [{}]), when: ContextKeyExpr.or(SearchExtensionUpdatesContext, ContextKeyExpr.has('searchOutdatedExtensions')), order: 1, @@ -344,7 +349,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchBuiltin', - name: localize('builtin', "Builtin"), + name: { value: localize('builtin', "Builtin"), original: 'Builtin' }, ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchBuiltInExtensions')), }); @@ -354,7 +359,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchWorkspaceUnsupported', - name: localize('workspaceUnsupported', "Workspace Unsupported"), + name: { value: localize('workspaceUnsupported', "Workspace Unsupported"), original: 'Workspace Unsupported' }, ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchWorkspaceUnsupportedExtensions')), }); @@ -367,7 +372,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: WORKSPACE_RECOMMENDATIONS_VIEW_ID, - name: localize('workspaceRecommendedExtensions', "Workspace Recommendations"), + name: { value: localize('workspaceRecommendedExtensions', "Workspace Recommendations"), original: 'Workspace Recommendations' }, ctorDescriptor: new SyncDescriptor(WorkspaceRecommendedExtensionsView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('recommendedExtensions'), WorkbenchStateContext.notEqualsTo('empty')), order: 1 @@ -375,7 +380,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.otherRecommendations', - name: localize('otherRecommendedExtensions', "Other Recommendations"), + name: { value: localize('otherRecommendedExtensions', "Other Recommendations"), original: 'Other Recommendations' }, ctorDescriptor: new SyncDescriptor(RecommendedExtensionsView, [{}]), when: ContextKeyExpr.has('recommendedExtensions'), order: 2 @@ -389,21 +394,21 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.builtinFeatureExtensions', - name: localize('builtinFeatureExtensions', "Features"), + name: { value: localize('builtinFeatureExtensions', "Features"), original: 'Features' }, ctorDescriptor: new SyncDescriptor(BuiltInFeatureExtensionsView, [{}]), when: ContextKeyExpr.has('builtInExtensions'), }); viewDescriptors.push({ id: 'workbench.views.extensions.builtinThemeExtensions', - name: localize('builtInThemesExtensions', "Themes"), + name: { value: localize('builtInThemesExtensions', "Themes"), original: 'Themes' }, ctorDescriptor: new SyncDescriptor(BuiltInThemesExtensionsView, [{}]), when: ContextKeyExpr.has('builtInExtensions'), }); viewDescriptors.push({ id: 'workbench.views.extensions.builtinProgrammingLanguageExtensions', - name: localize('builtinProgrammingLanguageExtensions', "Programming Languages"), + name: { value: localize('builtinProgrammingLanguageExtensions', "Programming Languages"), original: 'Programming Languages' }, ctorDescriptor: new SyncDescriptor(BuiltInProgrammingLanguageExtensionsView, [{}]), when: ContextKeyExpr.has('builtInExtensions'), }); @@ -416,28 +421,28 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.untrustedUnsupportedExtensions', - name: localize('untrustedUnsupportedExtensions', "Disabled in Restricted Mode"), + name: { value: localize('untrustedUnsupportedExtensions', "Disabled in Restricted Mode"), original: 'Disabled in Restricted Mode' }, ctorDescriptor: new SyncDescriptor(UntrustedWorkspaceUnsupportedExtensionsView, [{}]), when: ContextKeyExpr.and(SearchUnsupportedWorkspaceExtensionsContext), }); viewDescriptors.push({ id: 'workbench.views.extensions.untrustedPartiallySupportedExtensions', - name: localize('untrustedPartiallySupportedExtensions', "Limited in Restricted Mode"), + name: { value: localize('untrustedPartiallySupportedExtensions', "Limited in Restricted Mode"), original: 'Limited in Restricted Mode' }, ctorDescriptor: new SyncDescriptor(UntrustedWorkspacePartiallySupportedExtensionsView, [{}]), when: ContextKeyExpr.and(SearchUnsupportedWorkspaceExtensionsContext), }); viewDescriptors.push({ id: 'workbench.views.extensions.virtualUnsupportedExtensions', - name: localize('virtualUnsupportedExtensions', "Disabled in Virtual Workspaces"), + name: { value: localize('virtualUnsupportedExtensions', "Disabled in Virtual Workspaces"), original: 'Disabled in Virtual Workspaces' }, ctorDescriptor: new SyncDescriptor(VirtualWorkspaceUnsupportedExtensionsView, [{}]), when: ContextKeyExpr.and(VirtualWorkspaceContext, SearchUnsupportedWorkspaceExtensionsContext), }); viewDescriptors.push({ id: 'workbench.views.extensions.virtualPartiallySupportedExtensions', - name: localize('virtualPartiallySupportedExtensions', "Limited in Virtual Workspaces"), + name: { value: localize('virtualPartiallySupportedExtensions', "Limited in Virtual Workspaces"), original: 'Limited in Virtual Workspaces' }, ctorDescriptor: new SyncDescriptor(VirtualWorkspacePartiallySupportedExtensionsView, [{}]), when: ContextKeyExpr.and(VirtualWorkspaceContext, SearchUnsupportedWorkspaceExtensionsContext), }); @@ -450,7 +455,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.deprecatedExtensions', - name: localize('deprecated', "Deprecated"), + name: { value: localize('deprecated', "Deprecated"), original: 'Deprecated' }, ctorDescriptor: new SyncDescriptor(DeprecatedExtensionsView, [{}]), when: ContextKeyExpr.and(SearchDeprecatedExtensionsContext), }); @@ -734,14 +739,14 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE break; case 1: if (view) { - alert(localize('extensionFoundInSection', "1 extension found in the {0} section.", view.name)); + alert(localize('extensionFoundInSection', "1 extension found in the {0} section.", view.name.value)); } else { alert(localize('extensionFound', "1 extension found.")); } break; default: if (view) { - alert(localize('extensionsFoundInSection', "{0} extensions found in the {1} section.", count, view.name)); + alert(localize('extensionsFoundInSection', "{0} extensions found in the {1} section.", count, view.name.value)); } else { alert(localize('extensionsFound', "{0} extensions found.", count)); } diff --git a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts index af0be566a8b5f..124c6466ae507 100644 --- a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts @@ -104,7 +104,7 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor private createOpenEditorsViewDescriptor(): IViewDescriptor { return { id: OpenEditorsView.ID, - name: OpenEditorsView.NAME, + name: { value: OpenEditorsView.NAME, original: OpenEditorsView.ORIGINAL_NAME }, ctorDescriptor: new SyncDescriptor(OpenEditorsView), containerIcon: openEditorsViewIcon, order: 0, @@ -122,7 +122,7 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor private createEmptyViewDescriptor(): IViewDescriptor { return { id: EmptyView.ID, - name: EmptyView.NAME, + name: { value: EmptyView.NAME, original: EmptyView.ORIGINAL_NAME }, containerIcon: explorerViewIcon, ctorDescriptor: new SyncDescriptor(EmptyView), order: 1, @@ -136,7 +136,7 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor private createExplorerViewDescriptor(): IViewDescriptor { return { id: VIEW_ID, - name: localize('folders', "Folders"), + name: { value: localize('folders', "Folders"), original: 'Folders' }, containerIcon: explorerViewIcon, ctorDescriptor: new SyncDescriptor(ExplorerView), order: 1, diff --git a/src/vs/workbench/contrib/files/browser/views/emptyView.ts b/src/vs/workbench/contrib/files/browser/views/emptyView.ts index f5d418630f58f..cc7d0badb6a93 100644 --- a/src/vs/workbench/contrib/files/browser/views/emptyView.ts +++ b/src/vs/workbench/contrib/files/browser/views/emptyView.ts @@ -25,6 +25,7 @@ import { DragAndDropObserver } from 'vs/base/browser/dom'; export class EmptyView extends ViewPane { static readonly ID: string = 'workbench.explorer.emptyView'; + static readonly ORIGINAL_NAME = 'No Folder Opened'; static readonly NAME = nls.localize('noWorkspace', "No Folder Opened"); private _disposed: boolean = false; diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index 3304ca861975a..b907195a8ca9d 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -59,6 +59,7 @@ export class OpenEditorsView extends ViewPane { private static readonly DEFAULT_VISIBLE_OPEN_EDITORS = 9; private static readonly DEFAULT_MIN_VISIBLE_OPEN_EDITORS = 0; static readonly ID = 'workbench.explorer.openEditorsView'; + static readonly ORIGINAL_NAME = 'Open Editors'; static readonly NAME = nls.localize({ key: 'openEditors', comment: ['Open is an adjective'] }, "Open Editors"); private dirtyCountElement!: HTMLElement; diff --git a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts index ef2f37cee8c49..d66edb87ae6d4 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts @@ -139,7 +139,7 @@ const VIEW_CONTAINER: ViewContainer = Registry.as(ViewC Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: Markers.MARKERS_VIEW_ID, containerIcon: markersViewIcon, - name: Messages.MARKERS_PANEL_TITLE_PROBLEMS, + name: { value: Messages.MARKERS_PANEL_TITLE_PROBLEMS, original: Messages.MARKERS_PANEL_ORIGINAL_TITLE_PROBLEMS }, canToggleVisibility: false, canMoveView: true, ctorDescriptor: new SyncDescriptor(MarkersView), diff --git a/src/vs/workbench/contrib/outline/browser/outline.contribution.ts b/src/vs/workbench/contrib/outline/browser/outline.contribution.ts index 51085e4a66023..354c621fc7bb5 100644 --- a/src/vs/workbench/contrib/outline/browser/outline.contribution.ts +++ b/src/vs/workbench/contrib/outline/browser/outline.contribution.ts @@ -25,7 +25,7 @@ const outlineViewIcon = registerIcon('outline-view-icon', Codicon.symbolClass, l Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ id: IOutlinePane.Id, - name: localize('name', "Outline"), + name: { value: localize('name', "Outline"), original: 'Outline' }, containerIcon: outlineViewIcon, ctorDescriptor: new SyncDescriptor(OutlinePane), canToggleVisibility: true, diff --git a/src/vs/workbench/contrib/output/browser/output.contribution.ts b/src/vs/workbench/contrib/output/browser/output.contribution.ts index 44b292ed5b1ab..8aeeaf754a53f 100644 --- a/src/vs/workbench/contrib/output/browser/output.contribution.ts +++ b/src/vs/workbench/contrib/output/browser/output.contribution.ts @@ -64,7 +64,7 @@ const VIEW_CONTAINER: ViewContainer = Registry.as(ViewC Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: OUTPUT_VIEW_ID, - name: nls.localize('output', "Output"), + name: { value: nls.localize('output', "Output"), original: 'Output' }, containerIcon: outputViewIcon, canMoveView: true, canToggleVisibility: false, diff --git a/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts b/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts index 66c38b0fb9137..fe9a1fb68e4d3 100644 --- a/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts +++ b/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts @@ -104,7 +104,7 @@ export class ViewQuickAccessProvider extends PickerQuickAccessProvider this.viewsService.openView(view.id, true) }); diff --git a/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts b/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts index a1da7375df7be..a5d01c5e353eb 100644 --- a/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts +++ b/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts @@ -100,7 +100,7 @@ export class SwitchRemoteViewItem extends SelectActionViewItem { if (view.group && view.group.startsWith('targets') && view.remoteAuthority && (!view.when || contextKeyService.contextMatchesRules(view.when))) { - options.push({ text: view.name, authority: isStringArray(view.remoteAuthority) ? view.remoteAuthority : [view.remoteAuthority], virtualWorkspace: view.virtualWorkspace }); + options.push({ text: view.name.value, authority: isStringArray(view.remoteAuthority) ? view.remoteAuthority : [view.remoteAuthority], virtualWorkspace: view.virtualWorkspace }); } }); return options; diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index c9cd0c348a2cd..0e1bc48fd673f 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -499,6 +499,7 @@ class IssueReporterItem extends HelpItemBase { class HelpPanel extends ViewPane { static readonly ID = '~remote.helpPanel'; + static readonly ORIGINAL_TITLE = 'Help and feedback'; static readonly TITLE = nls.localize('remote.help', "Help and feedback"); private tree!: WorkbenchAsyncDataTree; @@ -565,7 +566,7 @@ class HelpPanel extends ViewPane { class HelpPanelDescriptor implements IViewDescriptor { readonly id = HelpPanel.ID; - readonly name = HelpPanel.TITLE; + readonly name = { value: HelpPanel.TITLE, original: HelpPanel.ORIGINAL_TITLE }; readonly ctorDescriptor: SyncDescriptor; readonly canToggleVisibility = true; readonly hideByDefault = false; diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index be89affe5e268..38590878cf938 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -1083,7 +1083,7 @@ export class TunnelPanel extends ViewPane { export class TunnelPanelDescriptor implements IViewDescriptor { readonly id = TunnelPanel.ID; - readonly name = TunnelPanel.TITLE; + readonly name = { value: TunnelPanel.TITLE, original: 'Ports' }; readonly ctorDescriptor: SyncDescriptor; readonly canToggleVisibility = true; readonly hideByDefault = false; diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index eeffaa40d445d..9fc78c60a4e0c 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -76,7 +76,7 @@ viewsRegistry.registerViewWelcomeContent(VIEW_PANE_ID, { viewsRegistry.registerViews([{ id: VIEW_PANE_ID, - name: localize('source control', "Source Control"), + name: { value: localize('source control', "Source Control"), original: 'Source Control' }, ctorDescriptor: new SyncDescriptor(SCMViewPane), canToggleVisibility: true, canMoveView: true, @@ -98,7 +98,7 @@ viewsRegistry.registerViews([{ viewsRegistry.registerViews([{ id: REPOSITORIES_VIEW_PANE_ID, - name: localize('source control repositories', "Source Control Repositories"), + name: { value: localize('source control repositories', "Source Control Repositories"), original: 'Source Control Repositories' }, ctorDescriptor: new SyncDescriptor(SCMRepositoriesViewPane), canToggleVisibility: true, hideByDefault: true, diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index a2f41a98fac6c..112121082c84d 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -66,7 +66,7 @@ const viewContainer = Registry.as(ViewExtensions.ViewCo const viewDescriptor: IViewDescriptor = { id: VIEW_ID, containerIcon: searchViewIcon, - name: nls.localize('search', "Search"), + name: { value: nls.localize('search', "Search"), original: 'Search' }, ctorDescriptor: new SyncDescriptor(SearchView), canToggleVisibility: false, canMoveView: true, diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index 1bb341555ef0f..ecfac62949505 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -132,7 +132,7 @@ const VIEW_CONTAINER = Registry.as(ViewContainerExtensi }, ViewContainerLocation.Panel, { doNotRegisterOpenCommand: true, isDefault: true }); Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: TERMINAL_VIEW_ID, - name: nls.localize('terminal', "Terminal"), + name: { value: nls.localize('terminal', "Terminal"), original: 'Terminal' }, containerIcon: terminalViewIcon, canToggleVisibility: false, canMoveView: true, diff --git a/src/vs/workbench/contrib/testing/browser/testing.contribution.ts b/src/vs/workbench/contrib/testing/browser/testing.contribution.ts index f628cbf59eca5..1d39abe283d7c 100644 --- a/src/vs/workbench/contrib/testing/browser/testing.contribution.ts +++ b/src/vs/workbench/contrib/testing/browser/testing.contribution.ts @@ -86,7 +86,7 @@ const viewsRegistry = Registry.as(ViewContainerExtensions.ViewsR viewsRegistry.registerViews([{ id: Testing.ResultsViewId, - name: localize('testResultsPanelName', "Test Results"), + name: { value: localize('testResultsPanelName', "Test Results"), original: 'Test Results' }, containerIcon: testingResultsIcon, canToggleVisibility: false, canMoveView: true, @@ -105,7 +105,7 @@ viewsRegistry.registerViewWelcomeContent(Testing.ExplorerViewId, { viewsRegistry.registerViews([{ id: Testing.ExplorerViewId, - name: localize('testExplorer', "Test Explorer"), + name: { value: localize('testExplorer', "Test Explorer"), original: 'Test Explorer' }, ctorDescriptor: new SyncDescriptor(TestingExplorerView), canToggleVisibility: true, canMoveView: true, diff --git a/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts b/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts index f04d0d4165146..c8d4465793033 100644 --- a/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts +++ b/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts @@ -26,7 +26,7 @@ const timelineOpenIcon = registerIcon('timeline-open', Codicon.history, localize export class TimelinePaneDescriptor implements IViewDescriptor { readonly id = TimelinePaneId; - readonly name = TimelinePane.TITLE; + readonly name = { value: TimelinePane.TITLE, original: 'Timeline' }; readonly containerIcon = timelineViewIcon; readonly ctorDescriptor = new SyncDescriptor(TimelinePane); readonly order = 2; diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts index e3ae0c168a90a..be504091b2aa6 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts @@ -60,7 +60,7 @@ export class UserDataSyncDataViews extends Disposable { private registerConflictsView(container: ViewContainer): void { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); - const viewName = localize('conflicts', "Conflicts"); + const viewName = { value: localize('conflicts', "Conflicts"), original: 'Conflicts' }; viewsRegistry.registerViews([{ id: SYNC_CONFLICTS_VIEW_ID, name: viewName, @@ -68,7 +68,7 @@ export class UserDataSyncDataViews extends Disposable { when: ContextKeyExpr.and(CONTEXT_ENABLE_SYNC_CONFLICTS_VIEW, CONTEXT_HAS_CONFLICTS), canToggleVisibility: false, canMoveView: false, - treeView: this.instantiationService.createInstance(TreeView, SYNC_CONFLICTS_VIEW_ID, viewName), + treeView: this.instantiationService.createInstance(TreeView, SYNC_CONFLICTS_VIEW_ID, viewName.value), collapsed: false, order: 100, }], container); @@ -76,8 +76,8 @@ export class UserDataSyncDataViews extends Disposable { private registerMachinesView(container: ViewContainer): void { const id = `workbench.views.sync.machines`; - const name = localize('synced machines', "Synced Machines"); - const treeView = this.instantiationService.createInstance(TreeView, id, name); + const name = { value: localize('synced machines', "Synced Machines"), original: 'Synced Machines' }; + const treeView = this.instantiationService.createInstance(TreeView, id, name.value); const dataProvider = this.instantiationService.createInstance(UserDataSyncMachinesViewDataProvider, treeView); treeView.showRefreshAction = true; treeView.canSelectMany = true; @@ -140,8 +140,8 @@ export class UserDataSyncDataViews extends Disposable { private registerActivityView(container: ViewContainer, remote: boolean): void { const id = `workbench.views.sync.${remote ? 'remote' : 'local'}Activity`; - const name = remote ? localize('remote sync activity title', "Sync Activity (Remote)") : localize('local sync activity title', "Sync Activity (Local)"); - const treeView = this.instantiationService.createInstance(TreeView, id, name); + const name = remote ? { value: localize('remote sync activity title', "Sync Activity (Remote)"), original: 'Sync Activity (Remote)' } : { value: localize('local sync activity title', "Sync Activity (Local)"), original: 'Sync Activity (Local)' }; + const treeView = this.instantiationService.createInstance(TreeView, id, name.value); treeView.showCollapseAllAction = true; treeView.showRefreshAction = true; treeView.dataProvider = remote ? this.instantiationService.createInstance(RemoteUserDataSyncActivityViewDataProvider) @@ -296,8 +296,8 @@ export class UserDataSyncDataViews extends Disposable { private registerTroubleShootView(container: ViewContainer): void { const id = `workbench.views.sync.troubleshoot`; - const name = localize('troubleshoot', "Troubleshoot"); - const treeView = this.instantiationService.createInstance(TreeView, id, name); + const name = { value: localize('troubleshoot', "Troubleshoot"), original: 'Troubleshoot' }; + const treeView = this.instantiationService.createInstance(TreeView, id, name.value); const dataProvider = this.instantiationService.createInstance(UserDataSyncTroubleshootViewDataProvider); treeView.showRefreshAction = true; treeView.dataProvider = dataProvider; diff --git a/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts b/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts index 9dc107dd7fbfd..6ba1f61a2f8fa 100644 --- a/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts +++ b/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts @@ -899,7 +899,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU const actionRunner = new ActionRunner(); const descriptor: ITreeViewDescriptor = { id, - name, + name: { value: name, original: name }, ctorDescriptor: new SyncDescriptor(UserDataProfilePreviewViewPane, [userDataProfilesData, primary, secondary, actionRunner]), canToggleVisibility: false, canMoveView: false, diff --git a/src/vs/workbench/services/views/browser/viewDescriptorService.ts b/src/vs/workbench/services/views/browser/viewDescriptorService.ts index 248e5db87bec5..72cae3c1ca440 100644 --- a/src/vs/workbench/services/views/browser/viewDescriptorService.ts +++ b/src/vs/workbench/services/views/browser/viewDescriptorService.ts @@ -793,7 +793,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor super({ id: `${viewDescriptor.id}.removeView`, viewPaneContainerId: viewContainerModel.viewContainer.id, - title: localize('hideView', "Hide '{0}'", viewDescriptor.name), + title: localize('hideView', "Hide '{0}'", viewDescriptor.name.value), precondition: viewDescriptor.canToggleVisibility && (!viewContainerModel.isVisible(viewDescriptor.id) || viewContainerModel.visibleViewDescriptors.length > 1) ? ContextKeyExpr.true() : ContextKeyExpr.false(), menu: [{ id: MenuId.ViewTitleContext, diff --git a/src/vs/workbench/services/views/common/viewContainerModel.ts b/src/vs/workbench/services/views/common/viewContainerModel.ts index 101672ef05866..9b8b9fd61524d 100644 --- a/src/vs/workbench/services/views/common/viewContainerModel.ts +++ b/src/vs/workbench/services/views/common/viewContainerModel.ts @@ -368,7 +368,7 @@ export class ViewContainerModel extends Disposable implements IViewContainerMode private updateContainerInfo(): void { /* Use default container info if one of the visible view descriptors belongs to the current container by default */ const useDefaultContainerInfo = this.viewContainer.alwaysUseContainerInfo || this.visibleViewDescriptors.length === 0 || this.visibleViewDescriptors.some(v => Registry.as(ViewExtensions.ViewsRegistry).getViewContainer(v.id) === this.viewContainer); - const title = useDefaultContainerInfo ? (typeof this.viewContainer.title === 'string' ? this.viewContainer.title : this.viewContainer.title.value) : this.visibleViewDescriptors[0]?.containerTitle || this.visibleViewDescriptors[0]?.name || ''; + const title = useDefaultContainerInfo ? (typeof this.viewContainer.title === 'string' ? this.viewContainer.title : this.viewContainer.title.value) : this.visibleViewDescriptors[0]?.containerTitle || this.visibleViewDescriptors[0]?.name?.value || ''; let titleChanged: boolean = false; if (this._title !== title) { this._title = title; diff --git a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts index 9a39dda2611f0..5e1db257ee5c0 100644 --- a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts @@ -79,7 +79,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1' + name: { value: 'Test View 1', original: 'Test View 1' } }; ViewsRegistry.registerViews([viewDescriptor], container); @@ -105,7 +105,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true) }; @@ -143,8 +143,8 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: 'Test View 1' }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: 'Test View 2', when: ContextKeyExpr.equals('showview2', true) }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' } }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' }, when: ContextKeyExpr.equals('showview2', true) }; ViewsRegistry.registerViews([view1, view2], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view1], 'only view1 should be visible'); @@ -166,8 +166,8 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: 'Test View 1', when: ContextKeyExpr.equals('showview1', true) }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: 'Test View 2' }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true) }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' } }; ViewsRegistry.registerViews([view1, view2], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view2], 'only view2 should be visible'); @@ -189,9 +189,9 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: 'Test View 1', canToggleVisibility: true }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: 'Test View 2', canToggleVisibility: true }; - const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: 'Test View 3', canToggleVisibility: true }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' }, canToggleVisibility: true }; + const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: { value: 'Test View 3', original: 'Test View 3' }, canToggleVisibility: true }; ViewsRegistry.registerViews([view1, view2, view3], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view1, view2, view3]); @@ -234,9 +234,9 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: 'Test View 1' }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: 'Test View 2' }; - const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: 'Test View 3' }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' } }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' } }; + const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: { value: 'Test View 3', original: 'Test View 3' } }; ViewsRegistry.registerViews([view1, view2, view3], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view1, view2, view3], 'model views should be OK'); @@ -271,7 +271,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1' + name: { value: 'Test View 1', original: 'Test View 1' } }; ViewsRegistry.registerViews([viewDescriptor], container); @@ -291,7 +291,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true) }; @@ -321,18 +321,18 @@ suite('ViewContainerModel', () => { const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview', true) }; const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, }; const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, when: ContextKeyExpr.equals('showview', true) }; @@ -362,7 +362,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -392,7 +392,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -419,7 +419,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -446,7 +446,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -478,13 +478,13 @@ suite('ViewContainerModel', () => { ViewsRegistry.registerViews([{ id: 'view5', ctorDescriptor: null!, - name: 'Test View 5', + name: { value: 'Test View 5', original: 'Test View 5' }, canToggleVisibility: true, order: 5 }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canToggleVisibility: true, order: 2 }], container); @@ -496,19 +496,19 @@ suite('ViewContainerModel', () => { ViewsRegistry.registerViews([{ id: 'view4', ctorDescriptor: null!, - name: 'Test View 4', + name: { value: 'Test View 4', original: 'Test View 4' }, canToggleVisibility: true, order: 4 }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canToggleVisibility: true, order: 3 }, { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true, order: 1 }], container); @@ -528,7 +528,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -559,7 +559,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -587,7 +587,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; @@ -611,19 +611,19 @@ suite('ViewContainerModel', () => { const viewDescriptor1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; const viewDescriptor2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canToggleVisibility: true }; const viewDescriptor3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canToggleVisibility: true }; @@ -669,19 +669,19 @@ suite('ViewContainerModel', () => { const viewDescriptor1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; const viewDescriptor2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canToggleVisibility: true }; const viewDescriptor3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canToggleVisibility: true }; @@ -737,25 +737,25 @@ suite('ViewContainerModel', () => { const viewDescriptor1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; const viewDescriptor2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canToggleVisibility: true }; const viewDescriptor3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canToggleVisibility: true }; const viewDescriptor4: IViewDescriptor = { id: 'view4', ctorDescriptor: null!, - name: 'Test View 4', + name: { value: 'Test View 4', original: 'Test View 4' }, canToggleVisibility: true }; @@ -812,7 +812,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; storageService.store(getViewsStateStorageId('test.state'), JSON.stringify([{ diff --git a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts index 481b0c25bd5b5..261a7f1adef11 100644 --- a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts @@ -60,19 +60,19 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true } ]; @@ -102,19 +102,19 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true } ]; @@ -142,19 +142,19 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true } ]; @@ -202,19 +202,19 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true } ]; @@ -283,21 +283,21 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true, order: 1 }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true, order: 2 }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true, order: 3 } @@ -346,25 +346,25 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true }, { id: 'view4', ctorDescriptor: null!, - name: 'Test View 4', + name: { value: 'Test View 4', original: 'Test View 4' }, canMoveView: true } ]; @@ -395,25 +395,25 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true }, { id: 'view4', ctorDescriptor: null!, - name: 'Test View 4', + name: { value: 'Test View 4', original: 'Test View 4' }, canMoveView: true } ]; @@ -457,21 +457,21 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true, order: 1 }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true, order: 2 }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true, order: 3 } @@ -503,7 +503,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true, order: 1 } @@ -540,25 +540,25 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: 'Test View 3', + name: { value: 'Test View 3', original: 'Test View 3' }, canMoveView: true }, { id: 'view4', ctorDescriptor: null!, - name: 'Test View 4', + name: { value: 'Test View 4', original: 'Test View 4' }, canMoveView: true } ]; @@ -602,7 +602,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true } ]; @@ -640,13 +640,13 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true } ]; @@ -672,14 +672,14 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: 'Test View 1', + name: { value: 'Test View 1', original: 'Test View 1' }, canMoveView: true, canToggleVisibility: true }, { id: 'view2', ctorDescriptor: null!, - name: 'Test View 2', + name: { value: 'Test View 2', original: 'Test View 2' }, canMoveView: true } ]; From 52148ae756ed05d58c681b8a8ce2a2d2964ffe38 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Wed, 20 Sep 2023 20:11:37 +0800 Subject: [PATCH 02/11] chore: save --- .../common/standalone/standaloneEnums.ts | 36 +++++++++---------- src/vs/monaco.d.ts | 36 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index 44f9fb9b43406..ec6cf6914929b 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -572,28 +572,28 @@ export enum KeyCode { * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ IntlBackslash = 97, - Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key - Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key - Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key - Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key - Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key - Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key - Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key - Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key - Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key - Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key - NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key - NumpadAdd = 109,// VK_ADD, 0x6B, Add key - NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key - NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key - NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key - NumpadDivide = 113,// VK_DIVIDE, 0x6F, + Numpad0 = 98, + Numpad1 = 99, + Numpad2 = 100, + Numpad3 = 101, + Numpad4 = 102, + Numpad5 = 103, + Numpad6 = 104, + Numpad7 = 105, + Numpad8 = 106, + Numpad9 = 107, + NumpadMultiply = 108, + NumpadAdd = 109, + NUMPAD_SEPARATOR = 110, + NumpadSubtract = 111, + NumpadDecimal = 112, + NumpadDivide = 113, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 114, - ABNT_C1 = 115,// Brazilian (ABNT) Keyboard - ABNT_C2 = 116,// Brazilian (ABNT) Keyboard + ABNT_C1 = 115, + ABNT_C2 = 116, AudioVolumeMute = 117, AudioVolumeUp = 118, AudioVolumeDown = 119, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index ab0e838f80848..2a6218c8de508 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -419,28 +419,28 @@ declare namespace monaco { * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ IntlBackslash = 97, - Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key - Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key - Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key - Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key - Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key - Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key - Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key - Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key - Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key - Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key - NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key - NumpadAdd = 109,// VK_ADD, 0x6B, Add key - NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key - NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key - NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key - NumpadDivide = 113,// VK_DIVIDE, 0x6F, + Numpad0 = 98, + Numpad1 = 99, + Numpad2 = 100, + Numpad3 = 101, + Numpad4 = 102, + Numpad5 = 103, + Numpad6 = 104, + Numpad7 = 105, + Numpad8 = 106, + Numpad9 = 107, + NumpadMultiply = 108, + NumpadAdd = 109, + NUMPAD_SEPARATOR = 110, + NumpadSubtract = 111, + NumpadDecimal = 112, + NumpadDivide = 113, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 114, - ABNT_C1 = 115,// Brazilian (ABNT) Keyboard - ABNT_C2 = 116,// Brazilian (ABNT) Keyboard + ABNT_C1 = 115, + ABNT_C2 = 116, AudioVolumeMute = 117, AudioVolumeUp = 118, AudioVolumeDown = 119, From c7515e273058511639408a1c92faa47b77a57e6a Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Fri, 22 Sep 2023 10:27:02 +0800 Subject: [PATCH 03/11] Fixes #157015 --- .../common/standalone/standaloneEnums.ts | 36 +++++++++---------- src/vs/monaco.d.ts | 36 +++++++++---------- .../contrib/scm/browser/scm.contribution.ts | 2 +- .../userDataSync/browser/userDataSyncViews.ts | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index ec6cf6914929b..44f9fb9b43406 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -572,28 +572,28 @@ export enum KeyCode { * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ IntlBackslash = 97, - Numpad0 = 98, - Numpad1 = 99, - Numpad2 = 100, - Numpad3 = 101, - Numpad4 = 102, - Numpad5 = 103, - Numpad6 = 104, - Numpad7 = 105, - Numpad8 = 106, - Numpad9 = 107, - NumpadMultiply = 108, - NumpadAdd = 109, - NUMPAD_SEPARATOR = 110, - NumpadSubtract = 111, - NumpadDecimal = 112, - NumpadDivide = 113, + Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key + Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key + Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key + Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key + Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key + Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key + Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key + Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key + Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key + Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key + NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key + NumpadAdd = 109,// VK_ADD, 0x6B, Add key + NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key + NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key + NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key + NumpadDivide = 113,// VK_DIVIDE, 0x6F, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 114, - ABNT_C1 = 115, - ABNT_C2 = 116, + ABNT_C1 = 115,// Brazilian (ABNT) Keyboard + ABNT_C2 = 116,// Brazilian (ABNT) Keyboard AudioVolumeMute = 117, AudioVolumeUp = 118, AudioVolumeDown = 119, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 2a6218c8de508..ab0e838f80848 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -419,28 +419,28 @@ declare namespace monaco { * Either the angle bracket key or the backslash key on the RT 102-key keyboard. */ IntlBackslash = 97, - Numpad0 = 98, - Numpad1 = 99, - Numpad2 = 100, - Numpad3 = 101, - Numpad4 = 102, - Numpad5 = 103, - Numpad6 = 104, - Numpad7 = 105, - Numpad8 = 106, - Numpad9 = 107, - NumpadMultiply = 108, - NumpadAdd = 109, - NUMPAD_SEPARATOR = 110, - NumpadSubtract = 111, - NumpadDecimal = 112, - NumpadDivide = 113, + Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key + Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key + Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key + Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key + Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key + Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key + Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key + Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key + Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key + Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key + NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key + NumpadAdd = 109,// VK_ADD, 0x6B, Add key + NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key + NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key + NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key + NumpadDivide = 113,// VK_DIVIDE, 0x6F, /** * Cover all key codes when IME is processing input. */ KEY_IN_COMPOSITION = 114, - ABNT_C1 = 115, - ABNT_C2 = 116, + ABNT_C1 = 115,// Brazilian (ABNT) Keyboard + ABNT_C2 = 116,// Brazilian (ABNT) Keyboard AudioVolumeMute = 117, AudioVolumeUp = 118, AudioVolumeDown = 119, diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index 9fc78c60a4e0c..0603535cd47ee 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -112,7 +112,7 @@ viewsRegistry.registerViews([{ viewsRegistry.registerViews([{ id: SYNC_VIEW_PANE_ID, - name: localize('source control sync', "Source Control Sync"), + name: { value: localize('source control sync', "Source Control Sync"), original: 'Source Control Sync' }, ctorDescriptor: new SyncDescriptor(SCMSyncViewPane), canToggleVisibility: true, canMoveView: true, diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts index be504091b2aa6..a276b5c649499 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts @@ -180,7 +180,7 @@ export class UserDataSyncDataViews extends Disposable { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([{ id, - name, + name: { value: name, original: name }, ctorDescriptor: new SyncDescriptor(TreeViewPane), when: CONTEXT_ENABLE_ACTIVITY_VIEWS, canToggleVisibility: true, From f1b0fbf78213b406d81b770d3aff222676448f78 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Mon, 25 Sep 2023 10:52:13 +0800 Subject: [PATCH 04/11] Fixes #157015 --- .../contrib/editSessions/browser/editSessionsViews.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts b/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts index 8552eb700f08d..eb1184dccb570 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts @@ -10,7 +10,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati import { Registry } from 'vs/platform/registry/common/platform'; import { TreeView, TreeViewPane } from 'vs/workbench/browser/parts/views/treeView'; import { Extensions, ITreeItem, ITreeViewDataProvider, ITreeViewDescriptor, IViewsRegistry, TreeItemCollapsibleState, TreeViewItemHandleArg, ViewContainer } from 'vs/workbench/common/views'; -import { ChangeType, EDIT_SESSIONS_DATA_VIEW_ID, EDIT_SESSIONS_SCHEME, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_TITLE, EditSession, IEditSessionsStorageService } from 'vs/workbench/contrib/editSessions/common/editSessions'; +import { ChangeType, EDIT_SESSIONS_DATA_VIEW_ID, EDIT_SESSIONS_SCHEME, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_TITLE, EDIT_SESSIONS_ORIGINAL_TITLE, EditSession, IEditSessionsStorageService } from 'vs/workbench/contrib/editSessions/common/editSessions'; import { URI } from 'vs/base/common/uri'; import { fromNow } from 'vs/base/common/date'; import { Codicon } from 'vs/base/common/codicons'; @@ -47,7 +47,7 @@ export class EditSessionsDataViews extends Disposable { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([{ id: viewId, - name: { value: name, original: name }, + name: { value: name, original: EDIT_SESSIONS_ORIGINAL_TITLE }, ctorDescriptor: new SyncDescriptor(TreeViewPane), canToggleVisibility: true, canMoveView: false, From 896e2eae6042564cfb1f7f27cdbc984c29e62de1 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Mon, 25 Sep 2023 12:37:20 +0800 Subject: [PATCH 05/11] Fixes #157015 --- .../workbench/contrib/userDataSync/browser/userDataSyncViews.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts index a276b5c649499..c4324bba24697 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts @@ -180,7 +180,7 @@ export class UserDataSyncDataViews extends Disposable { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([{ id, - name: { value: name, original: name }, + name: { value: name, original: 'Sync Activity (Developer)' }, ctorDescriptor: new SyncDescriptor(TreeViewPane), when: CONTEXT_ENABLE_ACTIVITY_VIEWS, canToggleVisibility: true, From 5bd253e1bd0b5d745bd88f35ce692637a862958a Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Tue, 26 Sep 2023 14:36:12 +0800 Subject: [PATCH 06/11] Fixes #157015 --- src/vs/workbench/browser/parts/views/viewsService.ts | 2 +- src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/views/viewsService.ts b/src/vs/workbench/browser/parts/views/viewsService.ts index 7c9aa80276621..5924e95ef23dc 100644 --- a/src/vs/workbench/browser/parts/views/viewsService.ts +++ b/src/vs/workbench/browser/parts/views/viewsService.ts @@ -484,7 +484,7 @@ export class ViewsService extends Disposable implements IViewsService { private registerFocusViewAction(viewDescriptor: IViewDescriptor, category?: string | ILocalizedString): IDisposable { return registerAction2(class FocusViewAction extends Action2 { constructor() { - const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.value); + const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.original); super({ id: viewDescriptor.focusCommand ? viewDescriptor.focusCommand.id : `${viewDescriptor.id}.focus`, title: { original: `Focus on ${viewDescriptor.name} View`, value: title }, diff --git a/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts b/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts index fe9a1fb68e4d3..3f7e8e9147c5f 100644 --- a/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts +++ b/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts @@ -104,7 +104,7 @@ export class ViewQuickAccessProvider extends PickerQuickAccessProvider this.viewsService.openView(view.id, true) }); From c89cb5ab808ecce4614a8bc955e9ef1bbdd2d68c Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Tue, 26 Sep 2023 15:23:50 +0800 Subject: [PATCH 07/11] Fixes #157015 --- src/vs/workbench/browser/parts/views/viewsService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/views/viewsService.ts b/src/vs/workbench/browser/parts/views/viewsService.ts index 5924e95ef23dc..45448530efbcc 100644 --- a/src/vs/workbench/browser/parts/views/viewsService.ts +++ b/src/vs/workbench/browser/parts/views/viewsService.ts @@ -484,10 +484,10 @@ export class ViewsService extends Disposable implements IViewsService { private registerFocusViewAction(viewDescriptor: IViewDescriptor, category?: string | ILocalizedString): IDisposable { return registerAction2(class FocusViewAction extends Action2 { constructor() { - const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.original); + const title = localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name.value); super({ id: viewDescriptor.focusCommand ? viewDescriptor.focusCommand.id : `${viewDescriptor.id}.focus`, - title: { original: `Focus on ${viewDescriptor.name} View`, value: title }, + title: { original: `Focus on ${viewDescriptor.name.original} View`, value: title }, category, menu: [{ id: MenuId.CommandPalette, From 3a91bfab92ab92c4b05dd1aca77aaa94affe1987 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Sat, 30 Sep 2023 13:03:43 +0800 Subject: [PATCH 08/11] Fixes #157015 --- .../views/test/browser/viewDescriptorService.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts index 261a7f1adef11..f624c507b799b 100644 --- a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts @@ -131,9 +131,9 @@ suite('ViewDescriptorService', () => { assert.strictEqual(sidebarViews.activeViewDescriptors.length, 1, 'Sidebar should have 2 views'); assert.strictEqual(panelViews.activeViewDescriptors.length, 2, 'Panel should have 1 view'); - assert.notStrictEqual(sidebarViews.activeViewDescriptors.indexOf(viewDescriptors[2]), -1, `Sidebar should have ${viewDescriptors[2].name}`); - assert.notStrictEqual(panelViews.activeViewDescriptors.indexOf(viewDescriptors[0]), -1, `Panel should have ${viewDescriptors[0].name}`); - assert.notStrictEqual(panelViews.activeViewDescriptors.indexOf(viewDescriptors[1]), -1, `Panel should have ${viewDescriptors[1].name}`); + assert.notStrictEqual(sidebarViews.activeViewDescriptors.indexOf(viewDescriptors[2]), -1, `Sidebar should have ${viewDescriptors[2].name.value}`); + assert.notStrictEqual(panelViews.activeViewDescriptors.indexOf(viewDescriptors[0]), -1, `Panel should have ${viewDescriptors[0].name.value}`); + assert.notStrictEqual(panelViews.activeViewDescriptors.indexOf(viewDescriptors[1]), -1, `Panel should have ${viewDescriptors[1].name.value}`); }); test('move views to generated containers', async function () { @@ -180,8 +180,8 @@ suite('ViewDescriptorService', () => { assert.strictEqual(testObject.getViewContainerLocation(generatedPanel), testObject.getViewLocationById(viewDescriptors[0].id), 'Panel view location and container location should match'); assert.strictEqual(testObject.getViewContainerLocation(generatedSidebar), testObject.getViewLocationById(viewDescriptors[2].id), 'Sidebar view location and container location should match'); - assert.strictEqual(testObject.getDefaultContainerById(viewDescriptors[2].id), panelContainer, `${viewDescriptors[2].name} has wrong default container`); - assert.strictEqual(testObject.getDefaultContainerById(viewDescriptors[0].id), sidebarContainer, `${viewDescriptors[0].name} has wrong default container`); + assert.strictEqual(testObject.getDefaultContainerById(viewDescriptors[2].id), panelContainer, `${viewDescriptors[2].name.value} has wrong default container`); + assert.strictEqual(testObject.getDefaultContainerById(viewDescriptors[0].id), sidebarContainer, `${viewDescriptors[0].name.value} has wrong default container`); testObject.moveViewToLocation(viewDescriptors[0], ViewContainerLocation.Sidebar); testObject.moveViewToLocation(viewDescriptors[2], ViewContainerLocation.Panel); From 5fd1e02a2f05ee5a7df8840a6bc8008dbbcb59a5 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Mon, 9 Oct 2023 10:35:39 +0800 Subject: [PATCH 09/11] fix: use nls.localize2 to simplified code --- .../api/browser/mainThreadComments.ts | 7 ++- .../test/browser/mainThreadTreeViews.test.ts | 3 +- .../browser/preview/bulkEdit.contribution.ts | 30 ++++++------ .../browser/chatContributionServiceImpl.ts | 6 +-- .../comments/browser/commentsTreeViewer.ts | 4 +- .../contrib/comments/browser/commentsView.ts | 2 +- .../debug/browser/debug.contribution.ts | 36 +++++++-------- .../debug/browser/debugEditorActions.ts | 13 +++--- .../contrib/debug/browser/welcomeView.ts | 5 +- .../browser/editSessions.contribution.ts | 4 +- .../editSessions/browser/editSessionsViews.ts | 11 ++--- .../editSessions/common/editSessions.ts | 5 +- .../extensions/browser/extensionsViewlet.ts | 46 +++++++++---------- .../contrib/files/browser/explorerViewlet.ts | 12 ++--- .../contrib/files/browser/views/emptyView.ts | 6 +-- .../files/browser/views/openEditorsView.ts | 4 +- .../outline/browser/outline.contribution.ts | 4 +- .../output/browser/output.contribution.ts | 18 ++++---- .../contrib/remote/browser/remote.ts | 5 +- .../contrib/remote/browser/tunnelView.ts | 4 +- .../contrib/scm/browser/scm.contribution.ts | 8 ++-- .../search/browser/search.contribution.ts | 4 +- .../terminal/browser/terminal.contribution.ts | 4 +- .../testing/browser/testing.contribution.ts | 8 ++-- .../timeline/browser/timeline.contribution.ts | 3 +- .../contrib/timeline/browser/timelinePane.ts | 5 +- .../userDataSync/browser/userDataSyncViews.ts | 16 +++---- .../test/browser/viewContainerModel.test.ts | 31 +++++++------ .../browser/viewDescriptorService.test.ts | 27 +++++------ 29 files changed, 167 insertions(+), 164 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadComments.ts b/src/vs/workbench/api/browser/mainThreadComments.ts index 1e3413f1ec96e..3eff84f7fc94b 100644 --- a/src/vs/workbench/api/browser/mainThreadComments.ts +++ b/src/vs/workbench/api/browser/mainThreadComments.ts @@ -15,7 +15,7 @@ import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/ext import { ICommentController, ICommentInfo, ICommentService, INotebookCommentInfo } from 'vs/workbench/contrib/comments/browser/commentService'; import { CommentsPanel } from 'vs/workbench/contrib/comments/browser/commentsView'; import { CommentProviderFeatures, ExtHostCommentsShape, ExtHostContext, MainContext, MainThreadCommentsShape, CommentThreadChanges } from '../common/extHost.protocol'; -import { COMMENTS_VIEW_ID, COMMENTS_VIEW_STORAGE_ID, COMMENTS_VIEW_TITLE, COMMENTS_VIEW_ORIGINAL_TITLE } from 'vs/workbench/contrib/comments/browser/commentsTreeViewer'; +import { COMMENTS_VIEW_ID, COMMENTS_VIEW_STORAGE_ID, COMMENTS_VIEW_TITLE } from 'vs/workbench/contrib/comments/browser/commentsTreeViewer'; import { ViewContainer, IViewContainersRegistry, Extensions as ViewExtensions, ViewContainerLocation, IViewsRegistry, IViewsService, IViewDescriptorService } from 'vs/workbench/common/views'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; @@ -26,7 +26,6 @@ import { MarshalledId } from 'vs/base/common/marshallingIds'; import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange'; import { Schemas } from 'vs/base/common/network'; - export class MainThreadCommentThread implements languages.CommentThread { private _input?: languages.CommentInput; get input(): languages.CommentInput | undefined { @@ -601,7 +600,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments if (!commentsViewAlreadyRegistered) { const VIEW_CONTAINER: ViewContainer = Registry.as(ViewExtensions.ViewContainersRegistry).registerViewContainer({ id: COMMENTS_VIEW_ID, - title: { value: COMMENTS_VIEW_TITLE, original: COMMENTS_VIEW_ORIGINAL_TITLE }, + title: COMMENTS_VIEW_TITLE, ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [COMMENTS_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]), storageId: COMMENTS_VIEW_STORAGE_ID, hideIfEmpty: true, @@ -611,7 +610,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ id: COMMENTS_VIEW_ID, - name: { value: COMMENTS_VIEW_TITLE, original: COMMENTS_VIEW_ORIGINAL_TITLE }, + name: COMMENTS_VIEW_TITLE, canToggleVisibility: false, ctorDescriptor: new SyncDescriptor(CommentsPanel), canMoveView: true, diff --git a/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts b/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts index dcac8d58fd98f..f3b2b94b17019 100644 --- a/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts +++ b/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as nls from 'vs/nls'; import * as assert from 'assert'; import { mock } from 'vs/base/test/common/mock'; import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils'; @@ -60,7 +61,7 @@ suite('MainThreadHostTreeView', function () { const viewDescriptor: ITreeViewDescriptor = { id: testTreeViewId, ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), treeView: disposables.add(instantiationService.createInstance(CustomTreeView, 'testTree', 'Test Title', 'extension.id')), }; ViewsRegistry.registerViews([viewDescriptor], container); diff --git a/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts b/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts index c6ffd890a6b09..a00a3f22ef975 100644 --- a/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts +++ b/src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEdit.contribution.ts @@ -10,7 +10,7 @@ import { IBulkEditService, ResourceEdit } from 'vs/editor/browser/services/bulkE import { BulkEditPane } from 'vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane'; import { IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainerLocation, IViewsRegistry, IViewsService } from 'vs/workbench/common/views'; import { FocusedViewContext } from 'vs/workbench/common/contextkeys'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { RawContextKey, IContextKeyService, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; @@ -166,8 +166,8 @@ registerAction2(class ApplyAction extends Action2 { constructor() { super({ id: 'refactorPreview.apply', - title: { value: localize('apply', "Apply Refactoring"), original: 'Apply Refactoring' }, - category: { value: localize('cat', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('apply', "Apply Refactoring"), + category: localize2('cat', "Refactor Preview"), icon: Codicon.check, precondition: ContextKeyExpr.and(BulkEditPreviewContribution.ctxEnabled, BulkEditPane.ctxHasCheckedChanges), menu: [{ @@ -195,8 +195,8 @@ registerAction2(class DiscardAction extends Action2 { constructor() { super({ id: 'refactorPreview.discard', - title: { value: localize('Discard', "Discard Refactoring"), original: 'Discard Refactoring' }, - category: { value: localize('cat', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('Discard', "Discard Refactoring"), + category: localize2('cat', "Refactor Preview"), icon: Codicon.clearAll, precondition: BulkEditPreviewContribution.ctxEnabled, menu: [{ @@ -220,8 +220,8 @@ registerAction2(class ToggleAction extends Action2 { constructor() { super({ id: 'refactorPreview.toggleCheckedState', - title: { value: localize('toogleSelection', "Toggle Change"), original: 'Toggle Change' }, - category: { value: localize('cat', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('toogleSelection', "Toggle Change"), + category: localize2('cat', "Refactor Preview"), precondition: BulkEditPreviewContribution.ctxEnabled, keybinding: { weight: KeybindingWeight.WorkbenchContrib, @@ -249,8 +249,8 @@ registerAction2(class GroupByFile extends Action2 { constructor() { super({ id: 'refactorPreview.groupByFile', - title: { value: localize('groupByFile', "Group Changes By File"), original: 'Group Changes By File' }, - category: { value: localize('cat', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('groupByFile', "Group Changes By File"), + category: localize2('cat', "Refactor Preview"), icon: Codicon.ungroupByRefType, precondition: ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPane.ctxGroupByFile.negate(), BulkEditPreviewContribution.ctxEnabled), menu: [{ @@ -274,8 +274,8 @@ registerAction2(class GroupByType extends Action2 { constructor() { super({ id: 'refactorPreview.groupByType', - title: { value: localize('groupByType', "Group Changes By Type"), original: 'Group Changes By Type' }, - category: { value: localize('cat', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('groupByType', "Group Changes By Type"), + category: localize2('cat', "Refactor Preview"), icon: Codicon.groupByRefType, precondition: ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPane.ctxGroupByFile, BulkEditPreviewContribution.ctxEnabled), menu: [{ @@ -299,8 +299,8 @@ registerAction2(class ToggleGrouping extends Action2 { constructor() { super({ id: 'refactorPreview.toggleGrouping', - title: { value: localize('groupByType', "Group Changes By Type"), original: 'Group Changes By Type' }, - category: { value: localize('cat', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('groupByType', "Group Changes By Type"), + category: localize2('cat', "Refactor Preview"), icon: Codicon.listTree, toggled: BulkEditPane.ctxGroupByFile.negate(), precondition: ContextKeyExpr.and(BulkEditPane.ctxHasCategories, BulkEditPreviewContribution.ctxEnabled), @@ -326,7 +326,7 @@ const refactorPreviewViewIcon = registerIcon('refactor-preview-view-icon', Codic const container = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({ id: BulkEditPane.ID, - title: { value: localize('panel', "Refactor Preview"), original: 'Refactor Preview' }, + title: localize2('panel', "Refactor Preview"), hideIfEmpty: true, ctorDescriptor: new SyncDescriptor( ViewPaneContainer, @@ -338,7 +338,7 @@ const container = Registry.as(ViewContainerExtensions.V Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: BulkEditPane.ID, - name: { value: localize('panel', "Refactor Preview"), original: 'Refactor Preview' }, + name: localize2('panel', "Refactor Preview"), when: BulkEditPreviewContribution.ctxEnabled, ctorDescriptor: new SyncDescriptor(BulkEditPane), containerIcon: refactorPreviewViewIcon, diff --git a/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts b/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts index 4c02c8882333b..c7e44722c3c1d 100644 --- a/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts +++ b/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts @@ -6,7 +6,7 @@ import { Codicon } from 'vs/base/common/codicons'; import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import * as resources from 'vs/base/common/resources'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { registerAction2 } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; @@ -106,12 +106,12 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution { private registerViewContainer(): ViewContainer { // Register View Container - const title = localize('chat.viewContainer.label', "Chat"); + const title = localize2('chat.viewContainer.label', "Chat"); const icon = Codicon.commentDiscussion; const viewContainerId = CHAT_SIDEBAR_PANEL_ID; const viewContainer: ViewContainer = Registry.as(ViewExtensions.ViewContainersRegistry).registerViewContainer({ id: viewContainerId, - title: { value: title, original: 'Chat' }, + title, icon, ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [viewContainerId, { mergeViewWithContainerWhenSingleView: true }]), storageId: viewContainerId, diff --git a/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts b/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts index 6db24044ed35d..2cf42660bc949 100644 --- a/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts +++ b/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.ts @@ -30,11 +30,11 @@ import { basename } from 'vs/base/common/resources'; import { openLinkFromMarkdown } from 'vs/editor/contrib/markdownRenderer/browser/markdownRenderer'; import { IStyleOverride } from 'vs/platform/theme/browser/defaultStyles'; import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; +import { ILocalizedString } from 'vs/platform/action/common/action'; export const COMMENTS_VIEW_ID = 'workbench.panel.comments'; export const COMMENTS_VIEW_STORAGE_ID = 'Comments'; -export const COMMENTS_VIEW_ORIGINAL_TITLE = 'Comments'; -export const COMMENTS_VIEW_TITLE = nls.localize('comments.view.title', "Comments"); +export const COMMENTS_VIEW_TITLE: ILocalizedString = nls.localize2('comments.view.title', "Comments"); interface IResourceTemplateData { resourceLabel: IResourceLabel; diff --git a/src/vs/workbench/contrib/comments/browser/commentsView.ts b/src/vs/workbench/contrib/comments/browser/commentsView.ts index 582b6877ec508..3ef5c946841e1 100644 --- a/src/vs/workbench/contrib/comments/browser/commentsView.ts +++ b/src/vs/workbench/contrib/comments/browser/commentsView.ts @@ -353,7 +353,7 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView { return ''; }, getWidgetAriaLabel(): string { - return COMMENTS_VIEW_TITLE; + return COMMENTS_VIEW_TITLE.value; } } })); diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts index 4bd4477bffe1c..1e03c9c635526 100644 --- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts @@ -111,7 +111,7 @@ const registerDebugCommandPaletteItem = (id: string, title: ICommandActionTitle, }; registerDebugCommandPaletteItem(RESTART_SESSION_ID, RESTART_LABEL); -registerDebugCommandPaletteItem(TERMINATE_THREAD_ID, { value: nls.localize('terminateThread', "Terminate Thread"), original: 'Terminate Thread' }, CONTEXT_IN_DEBUG_MODE); +registerDebugCommandPaletteItem(TERMINATE_THREAD_ID, nls.localize2('terminateThread', "Terminate Thread"), CONTEXT_IN_DEBUG_MODE); registerDebugCommandPaletteItem(STEP_OVER_ID, STEP_OVER_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped')); registerDebugCommandPaletteItem(STEP_INTO_ID, STEP_INTO_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped')); registerDebugCommandPaletteItem(STEP_INTO_TARGET_ID, STEP_INTO_TARGET_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.and(CONTEXT_STEP_INTO_TARGETS_SUPPORTED, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped'))); @@ -121,13 +121,13 @@ registerDebugCommandPaletteItem(DISCONNECT_ID, DISCONNECT_LABEL, CONTEXT_IN_DEBU registerDebugCommandPaletteItem(DISCONNECT_AND_SUSPEND_ID, DISCONNECT_AND_SUSPEND_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.or(CONTEXT_FOCUSED_SESSION_IS_ATTACH, ContextKeyExpr.and(CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED, CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED))); registerDebugCommandPaletteItem(STOP_ID, STOP_LABEL, CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.or(CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated(), CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED)); registerDebugCommandPaletteItem(CONTINUE_ID, CONTINUE_LABEL, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE.isEqualTo('stopped')); -registerDebugCommandPaletteItem(FOCUS_REPL_ID, { value: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugFocusConsole' }, "Focus on Debug Console View"), original: 'Focus on Debug Console View' }); -registerDebugCommandPaletteItem(JUMP_TO_CURSOR_ID, { value: nls.localize('jumpToCursor', "Jump to Cursor"), original: 'Jump to Cursor' }, CONTEXT_JUMP_TO_CURSOR_SUPPORTED); -registerDebugCommandPaletteItem(JUMP_TO_CURSOR_ID, { value: nls.localize('SetNextStatement', "Set Next Statement"), original: 'Set Next Statement' }, CONTEXT_JUMP_TO_CURSOR_SUPPORTED); -registerDebugCommandPaletteItem(RunToCursorAction.ID, { value: RunToCursorAction.LABEL, original: 'Run to Cursor' }, CONTEXT_DEBUGGERS_AVAILABLE); -registerDebugCommandPaletteItem(SelectionToReplAction.ID, { value: SelectionToReplAction.LABEL, original: 'Evaluate in Debug Console' }, CONTEXT_IN_DEBUG_MODE); -registerDebugCommandPaletteItem(SelectionToWatchExpressionsAction.ID, { value: SelectionToWatchExpressionsAction.LABEL, original: 'Add to Watch' }); -registerDebugCommandPaletteItem(TOGGLE_INLINE_BREAKPOINT_ID, { value: nls.localize('inlineBreakpoint', "Inline Breakpoint"), original: 'Inline Breakpoint' }); +registerDebugCommandPaletteItem(FOCUS_REPL_ID, nls.localize2({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugFocusConsole' }, "Focus on Debug Console View")); +registerDebugCommandPaletteItem(JUMP_TO_CURSOR_ID, nls.localize2('jumpToCursor', "Jump to Cursor"), CONTEXT_JUMP_TO_CURSOR_SUPPORTED); +registerDebugCommandPaletteItem(JUMP_TO_CURSOR_ID, nls.localize2('SetNextStatement', "Set Next Statement"), CONTEXT_JUMP_TO_CURSOR_SUPPORTED); +registerDebugCommandPaletteItem(RunToCursorAction.ID, RunToCursorAction.LABEL, CONTEXT_DEBUGGERS_AVAILABLE); +registerDebugCommandPaletteItem(SelectionToReplAction.ID, SelectionToReplAction.LABEL, CONTEXT_IN_DEBUG_MODE); +registerDebugCommandPaletteItem(SelectionToWatchExpressionsAction.ID, SelectionToWatchExpressionsAction.LABEL); +registerDebugCommandPaletteItem(TOGGLE_INLINE_BREAKPOINT_ID, nls.localize2('inlineBreakpoint', "Inline Breakpoint")); registerDebugCommandPaletteItem(DEBUG_START_COMMAND_ID, DEBUG_START_LABEL, ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(State.Initializing)))); registerDebugCommandPaletteItem(DEBUG_RUN_COMMAND_ID, DEBUG_RUN_LABEL, ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(State.Initializing)))); registerDebugCommandPaletteItem(SELECT_AND_START_ID, SELECT_AND_START_LABEL, ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE.notEqualsTo(getStateLabel(State.Initializing)))); @@ -216,7 +216,7 @@ if (isMacintosh) { // Editor Title Menu's "Run/Debug" dropdown item -MenuRegistry.appendMenuItem(MenuId.EditorTitle, { submenu: MenuId.EditorTitleRun, rememberDefaultAction: true, title: { value: nls.localize('run', "Run or Debug..."), original: 'Run or Debug...', }, icon: icons.debugRun, group: 'navigation', order: -1 }); +MenuRegistry.appendMenuItem(MenuId.EditorTitle, { submenu: MenuId.EditorTitleRun, rememberDefaultAction: true, title: nls.localize2('run', "Run or Debug..."), icon: icons.debugRun, group: 'navigation', order: -1 }); // Debug menu @@ -365,7 +365,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, { const VIEW_CONTAINER: ViewContainer = Registry.as(ViewExtensions.ViewContainersRegistry).registerViewContainer({ id: DEBUG_PANEL_ID, - title: { value: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"), original: 'Debug Console' }, + title: nls.localize2({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"), icon: icons.debugConsoleViewIcon, ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [DEBUG_PANEL_ID, { mergeViewWithContainerWhenSingleView: true }]), storageId: DEBUG_PANEL_ID, @@ -375,7 +375,7 @@ const VIEW_CONTAINER: ViewContainer = Registry.as(ViewE Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ id: REPL_VIEW_ID, - name: { value: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"), original: 'Debug Console' }, + name: nls.localize2({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugPanel' }, "Debug Console"), containerIcon: icons.debugConsoleViewIcon, canToggleVisibility: false, canMoveView: true, @@ -392,7 +392,7 @@ Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ const viewContainer = Registry.as(ViewExtensions.ViewContainersRegistry).registerViewContainer({ id: VIEWLET_ID, - title: { value: nls.localize('run and debug', "Run and Debug"), original: 'Run and Debug' }, + title: nls.localize2('run and debug', "Run and Debug"), openCommandActionDescriptor: { id: VIEWLET_ID, mnemonicTitle: nls.localize({ key: 'miViewRun', comment: ['&& denotes a mnemonic'] }, "&&Run"), @@ -407,12 +407,12 @@ const viewContainer = Registry.as(ViewExtensions.ViewCo // Register default debug views const viewsRegistry = Registry.as(ViewExtensions.ViewsRegistry); -viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: { value: nls.localize('variables', "Variables"), original: 'Variables' }, containerIcon: icons.variablesViewIcon, ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); -viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: { value: nls.localize('watch', "Watch"), original: 'Watch' }, containerIcon: icons.watchViewIcon, ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); -viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: { value: nls.localize('callStack', "Call Stack"), original: 'Call Stack' }, containerIcon: icons.callStackViewIcon, ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); -viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: { value: nls.localize('breakpoints', "Breakpoints"), original: 'Breakpoints' }, containerIcon: icons.breakpointsViewIcon, ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default'), CONTEXT_HAS_DEBUGGED) }], viewContainer); -viewsRegistry.registerViews([{ id: WelcomeView.ID, name: { value: WelcomeView.LABEL, original: 'Run' }, containerIcon: icons.runViewIcon, ctorDescriptor: new SyncDescriptor(WelcomeView), order: 1, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer); -viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: { value: nls.localize('loadedScripts', "Loaded Scripts"), original: 'Loaded Scripts' }, containerIcon: icons.loadedScriptsViewIcon, ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer); +viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: nls.localize2('variables', "Variables"), containerIcon: icons.variablesViewIcon, ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); +viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: nls.localize2('watch', "Watch"), containerIcon: icons.watchViewIcon, ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); +viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: nls.localize2('callStack', "Call Stack"), containerIcon: icons.callStackViewIcon, ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer); +viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: nls.localize2('breakpoints', "Breakpoints"), containerIcon: icons.breakpointsViewIcon, ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default'), CONTEXT_HAS_DEBUGGED) }], viewContainer); +viewsRegistry.registerViews([{ id: WelcomeView.ID, name: WelcomeView.LABEL, containerIcon: icons.runViewIcon, ctorDescriptor: new SyncDescriptor(WelcomeView), order: 1, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer); +viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize2('loadedScripts', "Loaded Scripts"), containerIcon: icons.loadedScriptsViewIcon, ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer); // Register disassembly view diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts index 3abdc920606da..48d3a26ef76ed 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts @@ -29,6 +29,7 @@ import { BREAKPOINT_EDITOR_CONTRIBUTION_ID, BreakpointWidgetContext, CONTEXT_CAL import { getEvaluatableExpressionAtPosition } from 'vs/workbench/contrib/debug/common/debugUtils'; import { DisassemblyViewInput } from 'vs/workbench/contrib/debug/common/disassemblyViewInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { ILocalizedString } from 'vs/platform/action/common/action'; class ToggleBreakpointAction extends Action2 { constructor() { @@ -266,12 +267,12 @@ class ToggleDisassemblyViewSourceCodeAction extends Action2 { export class RunToCursorAction extends EditorAction { public static readonly ID = 'editor.debug.action.runToCursor'; - public static readonly LABEL = nls.localize('runToCursor', "Run to Cursor"); + public static readonly LABEL: ILocalizedString = nls.localize2('runToCursor', "Run to Cursor"); constructor() { super({ id: RunToCursorAction.ID, - label: RunToCursorAction.LABEL, + label: RunToCursorAction.LABEL.value, alias: 'Debug: Run to Cursor', precondition: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, PanelFocusContext.toNegated(), ContextKeyExpr.or(EditorContextKeys.editorTextFocus, CONTEXT_DISASSEMBLY_VIEW_FOCUS)), contextMenuOpts: { @@ -307,12 +308,12 @@ export class RunToCursorAction extends EditorAction { export class SelectionToReplAction extends EditorAction { public static readonly ID = 'editor.debug.action.selectionToRepl'; - public static readonly LABEL = nls.localize('evaluateInDebugConsole', "Evaluate in Debug Console"); + public static readonly LABEL: ILocalizedString = nls.localize2('evaluateInDebugConsole', "Evaluate in Debug Console"); constructor() { super({ id: SelectionToReplAction.ID, - label: SelectionToReplAction.LABEL, + label: SelectionToReplAction.LABEL.value, alias: 'Debug: Evaluate in Console', precondition: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus), contextMenuOpts: { @@ -347,12 +348,12 @@ export class SelectionToReplAction extends EditorAction { export class SelectionToWatchExpressionsAction extends EditorAction { public static readonly ID = 'editor.debug.action.selectionToWatch'; - public static readonly LABEL = nls.localize('addToWatch', "Add to Watch"); + public static readonly LABEL: ILocalizedString = nls.localize2('addToWatch', "Add to Watch"); constructor() { super({ id: SelectionToWatchExpressionsAction.ID, - label: SelectionToWatchExpressionsAction.LABEL, + label: SelectionToWatchExpressionsAction.LABEL.value, alias: 'Debug: Add to Watch', precondition: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus), contextMenuOpts: { diff --git a/src/vs/workbench/contrib/debug/browser/welcomeView.ts b/src/vs/workbench/contrib/debug/browser/welcomeView.ts index 78d741bf5ff58..cdff715b9bff9 100644 --- a/src/vs/workbench/contrib/debug/browser/welcomeView.ts +++ b/src/vs/workbench/contrib/debug/browser/welcomeView.ts @@ -9,7 +9,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IContextKeyService, RawContextKey, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { IDebugService, CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_EXTENSION_AVAILABLE } from 'vs/workbench/contrib/debug/common/debug'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { ViewPane } from 'vs/workbench/browser/parts/views/viewPane'; @@ -25,6 +25,7 @@ import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storag import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { SELECT_AND_START_ID, DEBUG_CONFIGURE_COMMAND_ID, DEBUG_START_COMMAND_ID } from 'vs/workbench/contrib/debug/browser/debugCommands'; +import { ILocalizedString } from 'vs/platform/action/common/action'; const debugStartLanguageKey = 'debugStartLanguage'; const CONTEXT_DEBUG_START_LANGUAGE = new RawContextKey(debugStartLanguageKey, undefined); @@ -33,7 +34,7 @@ const CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR = new RawContextKey( export class WelcomeView extends ViewPane { static readonly ID = 'workbench.debug.welcome'; - static readonly LABEL = localize('run', "Run"); + static readonly LABEL: ILocalizedString = localize2('run', "Run"); private debugStartLanguageContext: IContextKey; private debuggerInterestedContext: IContextKey; diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts index 886278071b041..bac592ba3a62c 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts @@ -10,7 +10,7 @@ import { ILifecycleService, LifecyclePhase, ShutdownReason } from 'vs/workbench/ import { Action2, IAction2Options, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions'; import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { localize } from 'vs/nls'; -import { IEditSessionsStorageService, Change, ChangeType, Folder, EditSession, FileType, EDIT_SESSION_SYNC_CATEGORY, EDIT_SESSIONS_CONTAINER_ID, EditSessionSchemaVersion, IEditSessionsLogService, EDIT_SESSIONS_VIEW_ICON, EDIT_SESSIONS_TITLE, EDIT_SESSIONS_ORIGINAL_TITLE, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_DATA_VIEW_ID, decodeEditSessionFileContent, hashedEditSessionId, editSessionsLogId, EDIT_SESSIONS_PENDING } from 'vs/workbench/contrib/editSessions/common/editSessions'; +import { IEditSessionsStorageService, Change, ChangeType, Folder, EditSession, FileType, EDIT_SESSION_SYNC_CATEGORY, EDIT_SESSIONS_CONTAINER_ID, EditSessionSchemaVersion, IEditSessionsLogService, EDIT_SESSIONS_VIEW_ICON, EDIT_SESSIONS_TITLE, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_DATA_VIEW_ID, decodeEditSessionFileContent, hashedEditSessionId, editSessionsLogId, EDIT_SESSIONS_PENDING } from 'vs/workbench/contrib/editSessions/common/editSessions'; import { ISCMRepository, ISCMService } from 'vs/workbench/contrib/scm/common/scm'; import { IFileService } from 'vs/platform/files/common/files'; import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace'; @@ -274,7 +274,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo const container = Registry.as(ViewExtensions.ViewContainersRegistry).registerViewContainer( { id: EDIT_SESSIONS_CONTAINER_ID, - title: { value: EDIT_SESSIONS_TITLE, original: EDIT_SESSIONS_ORIGINAL_TITLE }, + title: EDIT_SESSIONS_TITLE, ctorDescriptor: new SyncDescriptor( ViewPaneContainer, [EDIT_SESSIONS_CONTAINER_ID, { mergeViewWithContainerWhenSingleView: true }] diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts b/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts index eb1184dccb570..5793dde01574d 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts @@ -10,7 +10,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati import { Registry } from 'vs/platform/registry/common/platform'; import { TreeView, TreeViewPane } from 'vs/workbench/browser/parts/views/treeView'; import { Extensions, ITreeItem, ITreeViewDataProvider, ITreeViewDescriptor, IViewsRegistry, TreeItemCollapsibleState, TreeViewItemHandleArg, ViewContainer } from 'vs/workbench/common/views'; -import { ChangeType, EDIT_SESSIONS_DATA_VIEW_ID, EDIT_SESSIONS_SCHEME, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_TITLE, EDIT_SESSIONS_ORIGINAL_TITLE, EditSession, IEditSessionsStorageService } from 'vs/workbench/contrib/editSessions/common/editSessions'; +import { ChangeType, EDIT_SESSIONS_DATA_VIEW_ID, EDIT_SESSIONS_SCHEME, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_TITLE, EditSession, IEditSessionsStorageService } from 'vs/workbench/contrib/editSessions/common/editSessions'; import { URI } from 'vs/base/common/uri'; import { fromNow } from 'vs/base/common/date'; import { Codicon } from 'vs/base/common/codicons'; @@ -38,8 +38,7 @@ export class EditSessionsDataViews extends Disposable { private registerViews(container: ViewContainer): void { const viewId = EDIT_SESSIONS_DATA_VIEW_ID; - const name = EDIT_SESSIONS_TITLE; - const treeView = this.instantiationService.createInstance(TreeView, viewId, name); + const treeView = this.instantiationService.createInstance(TreeView, viewId, EDIT_SESSIONS_TITLE.value); treeView.showCollapseAllAction = true; treeView.showRefreshAction = true; treeView.dataProvider = this.instantiationService.createInstance(EditSessionDataViewDataProvider); @@ -47,7 +46,7 @@ export class EditSessionsDataViews extends Disposable { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([{ id: viewId, - name: { value: name, original: EDIT_SESSIONS_ORIGINAL_TITLE }, + name: EDIT_SESSIONS_TITLE, ctorDescriptor: new SyncDescriptor(TreeViewPane), canToggleVisibility: true, canMoveView: false, @@ -128,7 +127,7 @@ export class EditSessionsDataViews extends Disposable { message: localize('confirm delete.v2', 'Are you sure you want to permanently delete your working changes with ref {0}?', editSessionId), detail: localize('confirm delete detail.v2', ' You cannot undo this action.'), type: 'warning', - title: EDIT_SESSIONS_TITLE + title: EDIT_SESSIONS_TITLE.value }); if (result.confirmed) { await editSessionStorageService.delete('editSessions', editSessionId); @@ -157,7 +156,7 @@ export class EditSessionsDataViews extends Disposable { message: localize('confirm delete all', 'Are you sure you want to permanently delete all stored changes from the cloud?'), detail: localize('confirm delete all detail', ' You cannot undo this action.'), type: 'warning', - title: EDIT_SESSIONS_TITLE + title: EDIT_SESSIONS_TITLE.value }); if (result.confirmed) { await editSessionStorageService.delete('editSessions', null); diff --git a/src/vs/workbench/contrib/editSessions/common/editSessions.ts b/src/vs/workbench/contrib/editSessions/common/editSessions.ts index 4cb53dc45f791..6484748e05781 100644 --- a/src/vs/workbench/contrib/editSessions/common/editSessions.ts +++ b/src/vs/workbench/contrib/editSessions/common/editSessions.ts @@ -5,7 +5,7 @@ import { decodeBase64, VSBuffer } from 'vs/base/common/buffer'; import { Codicon } from 'vs/base/common/codicons'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { ILocalizedString } from 'vs/platform/action/common/action'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; @@ -98,8 +98,7 @@ export const EDIT_SESSIONS_PENDING = new RawContextKey(EDIT_SESSIONS_PE export const EDIT_SESSIONS_CONTAINER_ID = 'workbench.view.editSessions'; export const EDIT_SESSIONS_DATA_VIEW_ID = 'workbench.views.editSessions.data'; -export const EDIT_SESSIONS_ORIGINAL_TITLE = 'Cloud Changes'; -export const EDIT_SESSIONS_TITLE = localize('cloud changes', 'Cloud Changes'); +export const EDIT_SESSIONS_TITLE: ILocalizedString = localize2('cloud changes', 'Cloud Changes'); export const EDIT_SESSIONS_VIEW_ICON = registerIcon('edit-sessions-view-icon', Codicon.cloudDownload, localize('editSessionViewIcon', 'View icon of the cloud changes view.')); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index 92f8fff073b8e..bb92321d13393 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/css!./media/extensionsViewlet'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { timeout, Delayer, Promises } from 'vs/base/common/async'; import { isCancellationError } from 'vs/base/common/errors'; import { createErrorWithActions } from 'vs/base/common/errorMessage'; @@ -219,7 +219,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.popular', - name: { value: localize('popularExtensions', "Popular"), original: 'Popular' }, + name: localize2('popularExtensions', "Popular"), ctorDescriptor: new SyncDescriptor(DefaultPopularExtensionsView, [{ hideBadge: true }]), when: ContextKeyExpr.and(DefaultViewsContext, ContextKeyExpr.not('hasInstalledExtensions'), CONTEXT_HAS_GALLERY), weight: 60, @@ -234,7 +234,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'extensions.recommendedList', - name: { value: localize('recommendedExtensions', "Recommended"), original: 'Recommended' }, + name: localize2('recommendedExtensions', "Recommended"), ctorDescriptor: new SyncDescriptor(DefaultRecommendedExtensionsView, [{ flexibleHeight: true }]), when: ContextKeyExpr.and(DefaultViewsContext, SortByUpdateDateContext.negate(), ContextKeyExpr.not('config.extensions.showRecommendationsOnlyOnDemand'), CONTEXT_HAS_GALLERY), weight: 40, @@ -250,7 +250,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.enabled', - name: { value: localize('enabledExtensions', "Enabled"), original: 'Enabled' }, + name: localize2('enabledExtensions', "Enabled"), ctorDescriptor: new SyncDescriptor(EnabledExtensionsView, [{}]), when: ContextKeyExpr.and(DefaultViewsContext, ContextKeyExpr.has('hasInstalledExtensions')), hideByDefault: true, @@ -265,7 +265,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.disabled', - name: { value: localize('disabledExtensions', "Disabled"), original: 'Disabled' }, + name: localize2('disabledExtensions', "Disabled"), ctorDescriptor: new SyncDescriptor(DisabledExtensionsView, [{}]), when: ContextKeyExpr.and(DefaultViewsContext, ContextKeyExpr.has('hasInstalledExtensions')), hideByDefault: true, @@ -287,7 +287,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.marketplace', - name: { value: localize('marketPlace', "Marketplace"), original: 'Marketplace' }, + name: localize2('marketPlace', "Marketplace"), ctorDescriptor: new SyncDescriptor(SearchMarketplaceExtensionsView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchMarketplaceExtensions')), }); @@ -297,7 +297,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchInstalled', - name: { value: localize('installed', "Installed"), original: 'Installed' }, + name: localize2('installed', "Installed"), ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchInstalledExtensions')), }); @@ -307,7 +307,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchRecentlyUpdated', - name: { value: localize('recently updated', "Recently Updated"), original: 'Recently Updated' }, + name: localize2('recently updated', "Recently Updated"), ctorDescriptor: new SyncDescriptor(RecentlyUpdatedExtensionsView, [{}]), when: ContextKeyExpr.or(SearchExtensionUpdatesContext, ContextKeyExpr.has('searchRecentlyUpdatedExtensions')), order: 2, @@ -318,7 +318,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchEnabled', - name: { value: localize('enabled', "Enabled"), original: 'Enabled' }, + name: localize2('enabled', "Enabled"), ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchEnabledExtensions')), }); @@ -328,7 +328,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchDisabled', - name: { value: localize('disabled', "Disabled"), original: 'Disabled' }, + name: localize2('disabled', "Disabled"), ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchDisabledExtensions')), }); @@ -338,7 +338,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: OUTDATED_EXTENSIONS_VIEW_ID, - name: { value: localize('availableUpdates', "Available Updates"), original: 'Available Updates' }, + name: localize2('availableUpdates', "Available Updates"), ctorDescriptor: new SyncDescriptor(OutdatedExtensionsView, [{}]), when: ContextKeyExpr.or(SearchExtensionUpdatesContext, ContextKeyExpr.has('searchOutdatedExtensions')), order: 1, @@ -349,7 +349,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchBuiltin', - name: { value: localize('builtin', "Builtin"), original: 'Builtin' }, + name: localize2('builtin', "Builtin"), ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchBuiltInExtensions')), }); @@ -359,7 +359,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio */ viewDescriptors.push({ id: 'workbench.views.extensions.searchWorkspaceUnsupported', - name: { value: localize('workspaceUnsupported', "Workspace Unsupported"), original: 'Workspace Unsupported' }, + name: localize2('workspaceUnsupported', "Workspace Unsupported"), ctorDescriptor: new SyncDescriptor(ExtensionsListView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('searchWorkspaceUnsupportedExtensions')), }); @@ -372,7 +372,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: WORKSPACE_RECOMMENDATIONS_VIEW_ID, - name: { value: localize('workspaceRecommendedExtensions', "Workspace Recommendations"), original: 'Workspace Recommendations' }, + name: localize2('workspaceRecommendedExtensions', "Workspace Recommendations"), ctorDescriptor: new SyncDescriptor(WorkspaceRecommendedExtensionsView, [{}]), when: ContextKeyExpr.and(ContextKeyExpr.has('recommendedExtensions'), WorkbenchStateContext.notEqualsTo('empty')), order: 1 @@ -380,7 +380,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.otherRecommendations', - name: { value: localize('otherRecommendedExtensions', "Other Recommendations"), original: 'Other Recommendations' }, + name: localize2('otherRecommendedExtensions', "Other Recommendations"), ctorDescriptor: new SyncDescriptor(RecommendedExtensionsView, [{}]), when: ContextKeyExpr.has('recommendedExtensions'), order: 2 @@ -394,21 +394,21 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.builtinFeatureExtensions', - name: { value: localize('builtinFeatureExtensions', "Features"), original: 'Features' }, + name: localize2('builtinFeatureExtensions', "Features"), ctorDescriptor: new SyncDescriptor(BuiltInFeatureExtensionsView, [{}]), when: ContextKeyExpr.has('builtInExtensions'), }); viewDescriptors.push({ id: 'workbench.views.extensions.builtinThemeExtensions', - name: { value: localize('builtInThemesExtensions', "Themes"), original: 'Themes' }, + name: localize2('builtInThemesExtensions', "Themes"), ctorDescriptor: new SyncDescriptor(BuiltInThemesExtensionsView, [{}]), when: ContextKeyExpr.has('builtInExtensions'), }); viewDescriptors.push({ id: 'workbench.views.extensions.builtinProgrammingLanguageExtensions', - name: { value: localize('builtinProgrammingLanguageExtensions', "Programming Languages"), original: 'Programming Languages' }, + name: localize2('builtinProgrammingLanguageExtensions', "Programming Languages"), ctorDescriptor: new SyncDescriptor(BuiltInProgrammingLanguageExtensionsView, [{}]), when: ContextKeyExpr.has('builtInExtensions'), }); @@ -421,28 +421,28 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.untrustedUnsupportedExtensions', - name: { value: localize('untrustedUnsupportedExtensions', "Disabled in Restricted Mode"), original: 'Disabled in Restricted Mode' }, + name: localize2('untrustedUnsupportedExtensions', "Disabled in Restricted Mode"), ctorDescriptor: new SyncDescriptor(UntrustedWorkspaceUnsupportedExtensionsView, [{}]), when: ContextKeyExpr.and(SearchUnsupportedWorkspaceExtensionsContext), }); viewDescriptors.push({ id: 'workbench.views.extensions.untrustedPartiallySupportedExtensions', - name: { value: localize('untrustedPartiallySupportedExtensions', "Limited in Restricted Mode"), original: 'Limited in Restricted Mode' }, + name: localize2('untrustedPartiallySupportedExtensions', "Limited in Restricted Mode"), ctorDescriptor: new SyncDescriptor(UntrustedWorkspacePartiallySupportedExtensionsView, [{}]), when: ContextKeyExpr.and(SearchUnsupportedWorkspaceExtensionsContext), }); viewDescriptors.push({ id: 'workbench.views.extensions.virtualUnsupportedExtensions', - name: { value: localize('virtualUnsupportedExtensions', "Disabled in Virtual Workspaces"), original: 'Disabled in Virtual Workspaces' }, + name: localize2('virtualUnsupportedExtensions', "Disabled in Virtual Workspaces"), ctorDescriptor: new SyncDescriptor(VirtualWorkspaceUnsupportedExtensionsView, [{}]), when: ContextKeyExpr.and(VirtualWorkspaceContext, SearchUnsupportedWorkspaceExtensionsContext), }); viewDescriptors.push({ id: 'workbench.views.extensions.virtualPartiallySupportedExtensions', - name: { value: localize('virtualPartiallySupportedExtensions', "Limited in Virtual Workspaces"), original: 'Limited in Virtual Workspaces' }, + name: localize2('virtualPartiallySupportedExtensions', "Limited in Virtual Workspaces"), ctorDescriptor: new SyncDescriptor(VirtualWorkspacePartiallySupportedExtensionsView, [{}]), when: ContextKeyExpr.and(VirtualWorkspaceContext, SearchUnsupportedWorkspaceExtensionsContext), }); @@ -455,7 +455,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio viewDescriptors.push({ id: 'workbench.views.extensions.deprecatedExtensions', - name: { value: localize('deprecated', "Deprecated"), original: 'Deprecated' }, + name: localize2('deprecated', "Deprecated"), ctorDescriptor: new SyncDescriptor(DeprecatedExtensionsView, [{}]), when: ContextKeyExpr.and(SearchDeprecatedExtensionsContext), }); diff --git a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts index 0f9ec63065c22..5b064b6c62071 100644 --- a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/css!./media/explorerviewlet'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { mark } from 'vs/base/common/performance'; import { VIEWLET_ID, VIEW_ID, IFilesConfiguration, ExplorerViewletVisibleContext } from 'vs/workbench/contrib/files/common/files'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; @@ -105,7 +105,7 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor private createOpenEditorsViewDescriptor(): IViewDescriptor { return { id: OpenEditorsView.ID, - name: { value: OpenEditorsView.NAME, original: OpenEditorsView.ORIGINAL_NAME }, + name: OpenEditorsView.NAME, ctorDescriptor: new SyncDescriptor(OpenEditorsView), containerIcon: openEditorsViewIcon, order: 0, @@ -123,7 +123,7 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor private createEmptyViewDescriptor(): IViewDescriptor { return { id: EmptyView.ID, - name: { value: EmptyView.NAME, original: EmptyView.ORIGINAL_NAME }, + name: EmptyView.NAME, containerIcon: explorerViewIcon, ctorDescriptor: new SyncDescriptor(EmptyView), order: 1, @@ -137,7 +137,7 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor private createExplorerViewDescriptor(): IViewDescriptor { return { id: VIEW_ID, - name: { value: localize('folders', "Folders"), original: 'Folders' }, + name: localize2('folders', "Folders"), containerIcon: explorerViewIcon, ctorDescriptor: new SyncDescriptor(ExplorerView), order: 1, @@ -253,7 +253,7 @@ const viewContainerRegistry = Registry.as(Extensions.Vi */ export const VIEW_CONTAINER: ViewContainer = viewContainerRegistry.registerViewContainer({ id: VIEWLET_ID, - title: { value: localize('explore', "Explorer"), original: 'Explorer' }, + title: localize2('explore', "Explorer"), ctorDescriptor: new SyncDescriptor(ExplorerViewPaneContainer), storageId: 'workbench.explorer.views.state', icon: explorerViewIcon, @@ -262,7 +262,7 @@ export const VIEW_CONTAINER: ViewContainer = viewContainerRegistry.registerViewC order: 0, openCommandActionDescriptor: { id: VIEWLET_ID, - title: { value: localize('explore', "Explorer"), original: 'Explorer' }, + title: localize2('explore', "Explorer"), mnemonicTitle: localize({ key: 'miViewExplorer', comment: ['&& denotes a mnemonic'] }, "&&Explorer"), keybindings: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyE }, order: 0 diff --git a/src/vs/workbench/contrib/files/browser/views/emptyView.ts b/src/vs/workbench/contrib/files/browser/views/emptyView.ts index 65f9280da5716..4f450ff50e075 100644 --- a/src/vs/workbench/contrib/files/browser/views/emptyView.ts +++ b/src/vs/workbench/contrib/files/browser/views/emptyView.ts @@ -21,12 +21,12 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { isWeb } from 'vs/base/common/platform'; import { DragAndDropObserver } from 'vs/base/browser/dom'; +import { ILocalizedString } from 'vs/platform/action/common/action'; export class EmptyView extends ViewPane { static readonly ID: string = 'workbench.explorer.emptyView'; - static readonly ORIGINAL_NAME = 'No Folder Opened'; - static readonly NAME = nls.localize('noWorkspace', "No Folder Opened"); + static readonly NAME: ILocalizedString = nls.localize2('noWorkspace', "No Folder Opened"); private _disposed: boolean = false; constructor( @@ -88,7 +88,7 @@ export class EmptyView extends ViewPane { } if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) { - this.updateTitle(EmptyView.NAME); + this.updateTitle(EmptyView.NAME.value); } else { this.updateTitle(this.title); } diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index a91459b484a8d..e2decbe31f499 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -51,6 +51,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis import { ICommandService } from 'vs/platform/commands/common/commands'; import { Schemas } from 'vs/base/common/network'; import { extUriIgnorePathCase } from 'vs/base/common/resources'; +import { ILocalizedString } from 'vs/platform/action/common/action'; const $ = dom.$; @@ -59,8 +60,7 @@ export class OpenEditorsView extends ViewPane { private static readonly DEFAULT_VISIBLE_OPEN_EDITORS = 9; private static readonly DEFAULT_MIN_VISIBLE_OPEN_EDITORS = 0; static readonly ID = 'workbench.explorer.openEditorsView'; - static readonly ORIGINAL_NAME = 'Open Editors'; - static readonly NAME = nls.localize({ key: 'openEditors', comment: ['Open is an adjective'] }, "Open Editors"); + static readonly NAME: ILocalizedString = nls.localize2({ key: 'openEditors', comment: ['Open is an adjective'] }, "Open Editors"); private dirtyCountElement!: HTMLElement; private listRefreshScheduler: RunOnceScheduler | undefined; diff --git a/src/vs/workbench/contrib/outline/browser/outline.contribution.ts b/src/vs/workbench/contrib/outline/browser/outline.contribution.ts index 354c621fc7bb5..1564652e5fa0f 100644 --- a/src/vs/workbench/contrib/outline/browser/outline.contribution.ts +++ b/src/vs/workbench/contrib/outline/browser/outline.contribution.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { IViewsRegistry, Extensions as ViewExtensions } from 'vs/workbench/common/views'; import { OutlinePane } from './outlinePane'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -25,7 +25,7 @@ const outlineViewIcon = registerIcon('outline-view-icon', Codicon.symbolClass, l Registry.as(ViewExtensions.ViewsRegistry).registerViews([{ id: IOutlinePane.Id, - name: { value: localize('name', "Outline"), original: 'Outline' }, + name: localize2('name', "Outline"), containerIcon: outlineViewIcon, ctorDescriptor: new SyncDescriptor(OutlinePane), canToggleVisibility: true, diff --git a/src/vs/workbench/contrib/output/browser/output.contribution.ts b/src/vs/workbench/contrib/output/browser/output.contribution.ts index 9feca76c2145b..d31903060bccd 100644 --- a/src/vs/workbench/contrib/output/browser/output.contribution.ts +++ b/src/vs/workbench/contrib/output/browser/output.contribution.ts @@ -51,7 +51,7 @@ ModesRegistry.registerLanguage({ const outputViewIcon = registerIcon('output-view-icon', Codicon.output, nls.localize('outputViewIcon', 'View icon of the output view.')); const VIEW_CONTAINER: ViewContainer = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({ id: OUTPUT_VIEW_ID, - title: { value: nls.localize('output', "Output"), original: 'Output' }, + title: nls.localize2('output', "Output"), icon: outputViewIcon, order: 1, ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [OUTPUT_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]), @@ -61,7 +61,7 @@ const VIEW_CONTAINER: ViewContainer = Registry.as(ViewC Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: OUTPUT_VIEW_ID, - name: { value: nls.localize('output', "Output"), original: 'Output' }, + name: nls.localize2('output', "Output"), containerIcon: outputViewIcon, canMoveView: true, canToggleVisibility: false, @@ -164,8 +164,8 @@ class OutputContribution extends Disposable implements IWorkbenchContribution { constructor() { super({ id: 'workbench.action.showOutputChannels', - title: { value: nls.localize('showOutputChannels', "Show Output Channels..."), original: 'Show Output Channels...' }, - category: { value: nls.localize('output', "Output"), original: 'Output' }, + title: nls.localize2('showOutputChannels', "Show Output Channels..."), + category: nls.localize2('output', "Output"), f1: true }); } @@ -203,7 +203,7 @@ class OutputContribution extends Disposable implements IWorkbenchContribution { constructor() { super({ id: `workbench.output.action.clearOutput`, - title: { value: nls.localize('clearOutput.label', "Clear Output"), original: 'Clear Output' }, + title: nls.localize2('clearOutput.label', "Clear Output"), category: Categories.View, menu: [{ id: MenuId.ViewTitle, @@ -236,7 +236,7 @@ class OutputContribution extends Disposable implements IWorkbenchContribution { constructor() { super({ id: `workbench.output.action.toggleAutoScroll`, - title: { value: nls.localize('toggleAutoScroll', "Toggle Auto Scrolling"), original: 'Toggle Auto Scrolling' }, + title: nls.localize2('toggleAutoScroll', "Toggle Auto Scrolling"), tooltip: nls.localize('outputScrollOff', "Turn Auto Scrolling Off"), menu: { id: MenuId.ViewTitle, @@ -264,7 +264,7 @@ class OutputContribution extends Disposable implements IWorkbenchContribution { constructor() { super({ id: `workbench.action.openActiveLogOutputFile`, - title: { value: nls.localize('openActiveLogOutputFile', "Open Log Output File"), original: 'Open Log Output File' }, + title: nls.localize2('openActiveLogOutputFile', "Open Log Output File"), menu: [{ id: MenuId.ViewTitle, when: ContextKeyExpr.equals('view', OUTPUT_VIEW_ID), @@ -308,7 +308,7 @@ class OutputContribution extends Disposable implements IWorkbenchContribution { constructor() { super({ id: 'workbench.action.showLogs', - title: { value: nls.localize('showLogs', "Show Logs..."), original: 'Show Logs...' }, + title: nls.localize2('showLogs', "Show Logs..."), category: Categories.Developer, menu: { id: MenuId.CommandPalette, @@ -354,7 +354,7 @@ class OutputContribution extends Disposable implements IWorkbenchContribution { constructor() { super({ id: 'workbench.action.openLogFile', - title: { value: nls.localize('openLogFile', "Open Log File..."), original: 'Open Log File...' }, + title: nls.localize2('openLogFile', "Open Log File..."), category: Categories.Developer, menu: { id: MenuId.CommandPalette, diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index abd02ef04bc9d..f5d29d537e9b3 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -440,8 +440,7 @@ class IssueReporterItem extends HelpItemBase { class HelpPanel extends ViewPane { static readonly ID = '~remote.helpPanel'; - static readonly ORIGINAL_TITLE = 'Help and feedback'; - static readonly TITLE = nls.localize('remote.help', "Help and feedback"); + static readonly TITLE = nls.localize2('remote.help', "Help and feedback"); private tree!: WorkbenchAsyncDataTree; constructor( @@ -507,7 +506,7 @@ class HelpPanel extends ViewPane { class HelpPanelDescriptor implements IViewDescriptor { readonly id = HelpPanel.ID; - readonly name = { value: HelpPanel.TITLE, original: HelpPanel.ORIGINAL_TITLE }; + readonly name = HelpPanel.TITLE; readonly ctorDescriptor: SyncDescriptor; readonly canToggleVisibility = true; readonly hideByDefault = false; diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index d42e20ccfc3a8..a7f32f80b2267 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -742,7 +742,7 @@ const PortChangableContextKey = new RawContextKey('portChangable', fals export class TunnelPanel extends ViewPane { static readonly ID = TUNNEL_VIEW_ID; - static readonly TITLE = nls.localize('remote.tunnel', "Ports"); + static readonly TITLE: ILocalizedString = nls.localize2('remote.tunnel', "Ports"); private panelContainer: HTMLElement | undefined; private table!: WorkbenchTable; @@ -1083,7 +1083,7 @@ export class TunnelPanel extends ViewPane { export class TunnelPanelDescriptor implements IViewDescriptor { readonly id = TunnelPanel.ID; - readonly name = { value: TunnelPanel.TITLE, original: 'Ports' }; + readonly name: ILocalizedString = TunnelPanel.TITLE; readonly ctorDescriptor: SyncDescriptor; readonly canToggleVisibility = true; readonly hideByDefault = false; diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index 2a4c3312c485d..377191ab52584 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { DirtyDiffWorkbenchController } from './dirtydiffDecorator'; @@ -76,7 +76,7 @@ viewsRegistry.registerViewWelcomeContent(VIEW_PANE_ID, { viewsRegistry.registerViews([{ id: VIEW_PANE_ID, - name: { value: localize('source control', "Source Control"), original: 'Source Control' }, + name: localize2('source control', "Source Control"), ctorDescriptor: new SyncDescriptor(SCMViewPane), canToggleVisibility: true, canMoveView: true, @@ -98,7 +98,7 @@ viewsRegistry.registerViews([{ viewsRegistry.registerViews([{ id: REPOSITORIES_VIEW_PANE_ID, - name: { value: localize('source control repositories', "Source Control Repositories"), original: 'Source Control Repositories' }, + name: localize2('source control repositories', "Source Control Repositories"), ctorDescriptor: new SyncDescriptor(SCMRepositoriesViewPane), canToggleVisibility: true, hideByDefault: true, @@ -112,7 +112,7 @@ viewsRegistry.registerViews([{ viewsRegistry.registerViews([{ id: SYNC_VIEW_PANE_ID, - name: { value: localize('source control sync', "Source Control Sync"), original: 'Source Control Sync' }, + name: localize2('source control sync', "Source Control Sync"), ctorDescriptor: new SyncDescriptor(SCMSyncViewPane), canToggleVisibility: true, canMoveView: true, diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index a317df225be59..ab41832cea9cc 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -56,7 +56,7 @@ const SEARCH_MODE_CONFIG = 'search.mode'; const viewContainer = Registry.as(ViewExtensions.ViewContainersRegistry).registerViewContainer({ id: VIEWLET_ID, - title: { value: nls.localize('name', "Search"), original: 'Search' }, + title: nls.localize2('search', "Search"), ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }]), hideIfEmpty: true, icon: searchViewIcon, @@ -66,7 +66,7 @@ const viewContainer = Registry.as(ViewExtensions.ViewCo const viewDescriptor: IViewDescriptor = { id: VIEW_ID, containerIcon: searchViewIcon, - name: { value: nls.localize('search', "Search"), original: 'Search' }, + name: nls.localize2('search', "Search"), ctorDescriptor: new SyncDescriptor(SearchView), canToggleVisibility: false, canMoveView: true, diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index ecfac62949505..76e54cc361342 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -123,7 +123,7 @@ Registry.as(DragAndDropExtensions.DragAndDropC // Register views const VIEW_CONTAINER = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({ id: TERMINAL_VIEW_ID, - title: { value: nls.localize('terminal', "Terminal"), original: 'Terminal' }, + title: nls.localize2('terminal', "Terminal"), icon: terminalViewIcon, ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [TERMINAL_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]), storageId: TERMINAL_VIEW_ID, @@ -132,7 +132,7 @@ const VIEW_CONTAINER = Registry.as(ViewContainerExtensi }, ViewContainerLocation.Panel, { doNotRegisterOpenCommand: true, isDefault: true }); Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: TERMINAL_VIEW_ID, - name: { value: nls.localize('terminal', "Terminal"), original: 'Terminal' }, + name: nls.localize2('terminal', "Terminal"), containerIcon: terminalViewIcon, canToggleVisibility: false, canMoveView: true, diff --git a/src/vs/workbench/contrib/testing/browser/testing.contribution.ts b/src/vs/workbench/contrib/testing/browser/testing.contribution.ts index 1d39abe283d7c..edd2ca435b4e3 100644 --- a/src/vs/workbench/contrib/testing/browser/testing.contribution.ts +++ b/src/vs/workbench/contrib/testing/browser/testing.contribution.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { EditorContributionInstantiation, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { registerAction2 } from 'vs/platform/actions/common/actions'; import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; @@ -74,7 +74,7 @@ const viewContainer = Registry.as(ViewContainerExtensio const testResultsViewContainer = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({ id: Testing.ResultsPanelId, - title: { value: localize('testResultsPanelName', "Test Results"), original: 'Test Results' }, + title: localize2('testResultsPanelName', "Test Results"), icon: testingResultsIcon, ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [Testing.ResultsPanelId, { mergeViewWithContainerWhenSingleView: true }]), hideIfEmpty: true, @@ -86,7 +86,7 @@ const viewsRegistry = Registry.as(ViewContainerExtensions.ViewsR viewsRegistry.registerViews([{ id: Testing.ResultsViewId, - name: { value: localize('testResultsPanelName', "Test Results"), original: 'Test Results' }, + name: localize2('testResultsPanelName', "Test Results"), containerIcon: testingResultsIcon, canToggleVisibility: false, canMoveView: true, @@ -105,7 +105,7 @@ viewsRegistry.registerViewWelcomeContent(Testing.ExplorerViewId, { viewsRegistry.registerViews([{ id: Testing.ExplorerViewId, - name: { value: localize('testExplorer', "Test Explorer"), original: 'Test Explorer' }, + name: localize2('testExplorer', "Test Explorer"), ctorDescriptor: new SyncDescriptor(TestingExplorerView), canToggleVisibility: true, canMoveView: true, diff --git a/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts b/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts index c8d4465793033..abac89c073a00 100644 --- a/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts +++ b/src/vs/workbench/contrib/timeline/browser/timeline.contribution.ts @@ -20,13 +20,14 @@ import { ExplorerFolderContext } from 'vs/workbench/contrib/files/common/files'; import { ResourceContextKey } from 'vs/workbench/common/contextkeys'; import { Codicon } from 'vs/base/common/codicons'; import { registerIcon } from 'vs/platform/theme/common/iconRegistry'; +import { ILocalizedString } from 'vs/platform/action/common/action'; const timelineViewIcon = registerIcon('timeline-view-icon', Codicon.history, localize('timelineViewIcon', 'View icon of the timeline view.')); const timelineOpenIcon = registerIcon('timeline-open', Codicon.history, localize('timelineOpenIcon', 'Icon for the open timeline action.')); export class TimelinePaneDescriptor implements IViewDescriptor { readonly id = TimelinePaneId; - readonly name = { value: TimelinePane.TITLE, original: 'Timeline' }; + readonly name: ILocalizedString = TimelinePane.TITLE; readonly containerIcon = timelineViewIcon; readonly ctorDescriptor = new SyncDescriptor(TimelinePane); readonly order = 2; diff --git a/src/vs/workbench/contrib/timeline/browser/timelinePane.ts b/src/vs/workbench/contrib/timeline/browser/timelinePane.ts index 5b658089901d4..88f98b07a0762 100644 --- a/src/vs/workbench/contrib/timeline/browser/timelinePane.ts +++ b/src/vs/workbench/contrib/timeline/browser/timelinePane.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/css!./media/timelinePane'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import * as DOM from 'vs/base/browser/dom'; import { IAction, ActionRunner } from 'vs/base/common/actions'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; @@ -55,6 +55,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { AriaRole } from 'vs/base/browser/ui/aria/aria'; +import { ILocalizedString } from 'vs/platform/action/common/action'; const ItemHeight = 22; @@ -232,7 +233,7 @@ export const TimelineFollowActiveEditorContext = new RawContextKey('tim export const TimelineExcludeSources = new RawContextKey('timelineExcludeSources', '[]', true); export class TimelinePane extends ViewPane { - static readonly TITLE = localize('timeline', "Timeline"); + static readonly TITLE: ILocalizedString = localize2('timeline', "Timeline"); private $container!: HTMLElement; private $message!: HTMLDivElement; diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts index 0a5d2489f6548..6b8d69bdfdb5a 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts @@ -5,7 +5,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IViewsRegistry, Extensions, ITreeViewDescriptor, ITreeViewDataProvider, ITreeItem, TreeItemCollapsibleState, TreeViewItemHandleArg, ViewContainer } from 'vs/workbench/common/views'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { TreeView, TreeViewPane } from 'vs/workbench/browser/parts/views/treeView'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; @@ -60,7 +60,7 @@ export class UserDataSyncDataViews extends Disposable { private registerConflictsView(container: ViewContainer): void { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); - const viewName = { value: localize('conflicts', "Conflicts"), original: 'Conflicts' }; + const viewName = localize2('conflicts', "Conflicts"); viewsRegistry.registerViews([{ id: SYNC_CONFLICTS_VIEW_ID, name: viewName, @@ -76,7 +76,7 @@ export class UserDataSyncDataViews extends Disposable { private registerMachinesView(container: ViewContainer): void { const id = `workbench.views.sync.machines`; - const name = { value: localize('synced machines', "Synced Machines"), original: 'Synced Machines' }; + const name = localize2('synced machines', "Synced Machines"); const treeView = this.instantiationService.createInstance(TreeView, id, name.value); const dataProvider = this.instantiationService.createInstance(UserDataSyncMachinesViewDataProvider, treeView); treeView.showRefreshAction = true; @@ -140,7 +140,7 @@ export class UserDataSyncDataViews extends Disposable { private registerActivityView(container: ViewContainer, remote: boolean): void { const id = `workbench.views.sync.${remote ? 'remote' : 'local'}Activity`; - const name = remote ? { value: localize('remote sync activity title', "Sync Activity (Remote)"), original: 'Sync Activity (Remote)' } : { value: localize('local sync activity title', "Sync Activity (Local)"), original: 'Sync Activity (Local)' }; + const name = remote ? localize2('remote sync activity title', "Sync Activity (Remote)") : localize2('local sync activity title', "Sync Activity (Local)"); const treeView = this.instantiationService.createInstance(TreeView, id, name.value); treeView.showCollapseAllAction = true; treeView.showRefreshAction = true; @@ -170,9 +170,9 @@ export class UserDataSyncDataViews extends Disposable { private registerExternalActivityView(container: ViewContainer): void { const id = `workbench.views.sync.externalActivity`; - const name = localize('downloaded sync activity title', "Sync Activity (Developer)"); + const name = localize2('downloaded sync activity title', "Sync Activity (Developer)"); const dataProvider = this.instantiationService.createInstance(ExtractedUserDataSyncActivityViewDataProvider, undefined); - const treeView = this.instantiationService.createInstance(TreeView, id, name); + const treeView = this.instantiationService.createInstance(TreeView, id, name.value); treeView.showCollapseAllAction = false; treeView.showRefreshAction = false; treeView.dataProvider = dataProvider; @@ -180,7 +180,7 @@ export class UserDataSyncDataViews extends Disposable { const viewsRegistry = Registry.as(Extensions.ViewsRegistry); viewsRegistry.registerViews([{ id, - name: { value: name, original: 'Sync Activity (Developer)' }, + name, ctorDescriptor: new SyncDescriptor(TreeViewPane), when: CONTEXT_ENABLE_ACTIVITY_VIEWS, canToggleVisibility: true, @@ -296,7 +296,7 @@ export class UserDataSyncDataViews extends Disposable { private registerTroubleShootView(container: ViewContainer): void { const id = `workbench.views.sync.troubleshoot`; - const name = { value: localize('troubleshoot', "Troubleshoot"), original: 'Troubleshoot' }; + const name = localize2('troubleshoot', "Troubleshoot"); const treeView = this.instantiationService.createInstance(TreeView, id, name.value); const dataProvider = this.instantiationService.createInstance(UserDataSyncTroubleshootViewDataProvider); treeView.showRefreshAction = true; diff --git a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts index 5e1db257ee5c0..6b523190e5061 100644 --- a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as nls from 'vs/nls'; import * as assert from 'assert'; import * as sinon from 'sinon'; import { IViewsRegistry, IViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainerLocation, IViewContainerModel, IViewDescriptorService, ViewContainer } from 'vs/workbench/common/views'; @@ -105,7 +106,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true) }; @@ -291,7 +292,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true) }; @@ -321,7 +322,7 @@ suite('ViewContainerModel', () => { const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview', true) }; const view2: IViewDescriptor = { @@ -362,7 +363,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -392,7 +393,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -419,7 +420,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -446,7 +447,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -508,7 +509,7 @@ suite('ViewContainerModel', () => { }, { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true, order: 1 }], container); @@ -528,7 +529,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -559,7 +560,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true), canToggleVisibility: true }; @@ -587,7 +588,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; @@ -611,7 +612,7 @@ suite('ViewContainerModel', () => { const viewDescriptor1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; const viewDescriptor2: IViewDescriptor = { @@ -669,7 +670,7 @@ suite('ViewContainerModel', () => { const viewDescriptor1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; const viewDescriptor2: IViewDescriptor = { @@ -737,7 +738,7 @@ suite('ViewContainerModel', () => { const viewDescriptor1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; const viewDescriptor2: IViewDescriptor = { @@ -812,7 +813,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; storageService.store(getViewsStateStorageId('test.state'), JSON.stringify([{ diff --git a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts index f624c507b799b..dcb45032ac32f 100644 --- a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as nls from 'vs/nls'; import * as assert from 'assert'; import { IViewsRegistry, IViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainerLocation, ViewContainer, ViewContainerLocationToString } from 'vs/workbench/common/views'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -60,7 +61,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -102,7 +103,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -142,7 +143,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -202,7 +203,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -283,7 +284,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true, order: 1 }, @@ -346,7 +347,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -395,7 +396,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -457,7 +458,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true, order: 1 }, @@ -503,7 +504,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true, order: 1 } @@ -540,7 +541,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -602,7 +603,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true } ]; @@ -640,7 +641,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true }, { @@ -672,7 +673,7 @@ suite('ViewDescriptorService', () => { { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' }, + name: nls.localize2('Test View 1', 'Test View 1'), canMoveView: true, canToggleVisibility: true }, From 02d0d7147b835881e1ceba5e488de63e4874dfcf Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Mon, 9 Oct 2023 11:05:18 +0800 Subject: [PATCH 10/11] fix: use nls.localize2 to simplified code --- .../markers/browser/markers.contribution.ts | 4 +- .../contrib/markers/browser/markersView.ts | 2 +- .../contrib/markers/browser/messages.ts | 4 +- .../userDataSync/browser/userDataSync.ts | 30 +++++------ .../userDataSync/browser/userDataSyncViews.ts | 2 +- .../userDataSync.contribution.ts | 6 +-- .../browser/userDataSyncWorkbenchService.ts | 6 +-- .../userDataSync/common/userDataSync.ts | 6 +-- .../test/browser/viewContainerModel.test.ts | 50 +++++++++---------- .../browser/viewDescriptorService.test.ts | 46 ++++++++--------- 10 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts index d66edb87ae6d4..275a84b8c9a02 100644 --- a/src/vs/workbench/contrib/markers/browser/markers.contribution.ts +++ b/src/vs/workbench/contrib/markers/browser/markers.contribution.ts @@ -128,7 +128,7 @@ const markersViewIcon = registerIcon('markers-view-icon', Codicon.warning, local // markers view container const VIEW_CONTAINER: ViewContainer = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({ id: Markers.MARKERS_CONTAINER_ID, - title: { value: Messages.MARKERS_PANEL_TITLE_PROBLEMS, original: Messages.MARKERS_PANEL_ORIGINAL_TITLE_PROBLEMS }, + title: Messages.MARKERS_PANEL_TITLE_PROBLEMS, icon: markersViewIcon, hideIfEmpty: true, order: 0, @@ -139,7 +139,7 @@ const VIEW_CONTAINER: ViewContainer = Registry.as(ViewC Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews([{ id: Markers.MARKERS_VIEW_ID, containerIcon: markersViewIcon, - name: { value: Messages.MARKERS_PANEL_TITLE_PROBLEMS, original: Messages.MARKERS_PANEL_ORIGINAL_TITLE_PROBLEMS }, + name: Messages.MARKERS_PANEL_TITLE_PROBLEMS, canToggleVisibility: false, canMoveView: true, ctorDescriptor: new SyncDescriptor(MarkersView), diff --git a/src/vs/workbench/contrib/markers/browser/markersView.ts b/src/vs/workbench/contrib/markers/browser/markersView.ts index 1e7bf9e70738a..5845464df983f 100644 --- a/src/vs/workbench/contrib/markers/browser/markersView.ts +++ b/src/vs/workbench/contrib/markers/browser/markersView.ts @@ -222,7 +222,7 @@ export class MarkersView extends FilterViewPane implements IMarkersView { } public getTitle(): string { - return Messages.MARKERS_PANEL_TITLE_PROBLEMS; + return Messages.MARKERS_PANEL_TITLE_PROBLEMS.value; } protected layoutBodyContent(height: number = this.currentHeight, width: number = this.currentWidth): void { diff --git a/src/vs/workbench/contrib/markers/browser/messages.ts b/src/vs/workbench/contrib/markers/browser/messages.ts index 767485b369284..e6a387f0ce281 100644 --- a/src/vs/workbench/contrib/markers/browser/messages.ts +++ b/src/vs/workbench/contrib/markers/browser/messages.ts @@ -6,6 +6,7 @@ import * as nls from 'vs/nls'; import { basename } from 'vs/base/common/resources'; import { MarkerSeverity, IRelatedInformation } from 'vs/platform/markers/common/markers'; +import { ILocalizedString } from 'vs/platform/action/common/action'; import { Marker } from './markersModel'; export default class Messages { @@ -21,8 +22,7 @@ export default class Messages { public static PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY: string = nls.localize('problems.panel.configuration.compareOrder.severity', "Navigate problems ordered by severity"); public static PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION: string = nls.localize('problems.panel.configuration.compareOrder.position', "Navigate problems ordered by position"); - public static MARKERS_PANEL_ORIGINAL_TITLE_PROBLEMS: string = 'Problems'; - public static MARKERS_PANEL_TITLE_PROBLEMS: string = nls.localize('markers.panel.title.problems', "Problems"); + public static MARKERS_PANEL_TITLE_PROBLEMS: ILocalizedString = nls.localize2('markers.panel.title.problems', "Problems"); public static MARKERS_PANEL_NO_PROBLEMS_BUILT: string = nls.localize('markers.panel.no.problems.build', "No problems have been detected in the workspace."); public static MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT: string = nls.localize('markers.panel.no.problems.activeFile.build', "No problems have been detected in the current file."); diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 666d26dd16d8b..50d091fbd3dab 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -42,7 +42,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { ViewContainerLocation, IViewContainersRegistry, Extensions, ViewContainer } from 'vs/workbench/common/views'; import { UserDataSyncDataViews } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncViews'; -import { IUserDataSyncWorkbenchService, getSyncAreaLabel, AccountStatus, CONTEXT_SYNC_STATE, CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE, CONFIGURE_SYNC_COMMAND_ID, SHOW_SYNC_LOG_COMMAND_ID, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE, SYNC_ORIGINAL_TITLE, SYNC_VIEW_ICON, CONTEXT_HAS_CONFLICTS, DOWNLOAD_ACTIVITY_ACTION_DESCRIPTOR } from 'vs/workbench/services/userDataSync/common/userDataSync'; +import { IUserDataSyncWorkbenchService, getSyncAreaLabel, AccountStatus, CONTEXT_SYNC_STATE, CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE, CONFIGURE_SYNC_COMMAND_ID, SHOW_SYNC_LOG_COMMAND_ID, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE, SYNC_VIEW_ICON, CONTEXT_HAS_CONFLICTS, DOWNLOAD_ACTIVITY_ACTION_DESCRIPTOR } from 'vs/workbench/services/userDataSync/common/userDataSync'; import { Codicon } from 'vs/base/common/codicons'; import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; @@ -429,7 +429,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo let priority: number | undefined = undefined; if (this.userDataSyncService.conflicts.length && this.userDataSyncEnablementService.isEnabled()) { - badge = new NumberBadge(this.getConflictsCount(), () => localize('has conflicts', "{0}: Conflicts Detected", SYNC_TITLE)); + badge = new NumberBadge(this.getConflictsCount(), () => localize('has conflicts', "{0}: Conflicts Detected", SYNC_TITLE.value)); } else if (this.turningOnSync) { badge = new ProgressBadge(() => localize('turning on syncing', "Turning on Settings Sync...")); clazz = 'progress-badge'; @@ -520,7 +520,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo const disposables: DisposableStore = new DisposableStore(); const quickPick = this.quickInputService.createQuickPick(); disposables.add(quickPick); - quickPick.title = SYNC_TITLE; + quickPick.title = SYNC_TITLE.value; quickPick.ok = false; quickPick.customButton = true; quickPick.customLabel = localize('sign in and turn on', "Sign in"); @@ -598,7 +598,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo const disposables: DisposableStore = new DisposableStore(); const quickPick = this.quickInputService.createQuickPick(); disposables.add(quickPick); - quickPick.title = localize('configure sync title', "{0}: Configure...", SYNC_TITLE); + quickPick.title = localize('configure sync title', "{0}: Configure...", SYNC_TITLE.value); quickPick.placeholder = localize('configure sync placeholder', "Choose what to sync"); quickPick.canSelectMany = true; quickPick.ignoreFocusOut = true; @@ -654,7 +654,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo return new Promise((c, e) => { const disposables: DisposableStore = new DisposableStore(); const quickPick = disposables.add(this.quickInputService.createQuickPick<{ id: UserDataSyncStoreType; label: string; description?: string }>()); - quickPick.title = localize('switchSyncService.title', "{0}: Select Service", SYNC_TITLE); + quickPick.title = localize('switchSyncService.title', "{0}: Select Service", SYNC_TITLE.value); quickPick.description = localize('switchSyncService.description', "Ensure you are using the same settings sync service when syncing with multiple environments"); quickPick.hideInput = true; quickPick.ignoreFocusOut = true; @@ -725,7 +725,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: 'workbench.userDataSync.actions.turnOn', title: { value: localize('global activity turn on sync', "Backup and Sync Settings..."), original: 'Backup and Sync Settings...' }, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, f1: true, precondition: when, menu: [{ @@ -845,7 +845,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: showConflictsCommandId, get title() { return that.getShowConflictsTitle(); }, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, f1: true, precondition: CONTEXT_HAS_CONFLICTS, menu: [{ @@ -943,7 +943,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: showSyncedDataCommand.id, title: showSyncedDataCommand.title, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, precondition: when, menu: { id: MenuId.CommandPalette, @@ -964,7 +964,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: syncNowCommand.id, title: syncNowCommand.title, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, menu: { id: MenuId.CommandPalette, when: ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE.isEqualTo(AccountStatus.Available), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)) @@ -984,7 +984,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: turnOffSyncCommand.id, title: turnOffSyncCommand.title, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, menu: { id: MenuId.CommandPalette, when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT), @@ -1011,7 +1011,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: configureSyncCommand.id, title: configureSyncCommand.title, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, icon: Codicon.settingsGear, tooltip: localize('configure', "Configure..."), menu: [{ @@ -1035,7 +1035,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo constructor() { super({ id: SHOW_SYNC_LOG_COMMAND_ID, - title: localize('show sync log title', "{0}: Show Log", SYNC_TITLE), + title: localize('show sync log title', "{0}: Show Log", SYNC_TITLE.value), tooltip: localize('show sync log toolrip', "Show Log"), icon: Codicon.output, menu: [{ @@ -1059,7 +1059,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo super({ id: showSyncSettingsCommand.id, title: showSyncSettingsCommand.title, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + category: SYNC_TITLE, menu: { id: MenuId.CommandPalette, when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)), @@ -1078,7 +1078,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo constructor() { super({ id: 'workbench.userDataSync.actions.help', - title: { value: SYNC_TITLE, original: 'Settings Sync' }, + title: SYNC_TITLE, category: Categories.Help, menu: [{ id: MenuId.CommandPalette, @@ -1155,7 +1155,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo return Registry.as(Extensions.ViewContainersRegistry).registerViewContainer( { id: SYNC_VIEW_CONTAINER_ID, - title: { value: SYNC_TITLE, original: SYNC_ORIGINAL_TITLE }, + title: SYNC_TITLE, ctorDescriptor: new SyncDescriptor( ViewPaneContainer, [SYNC_VIEW_CONTAINER_ID, { mergeViewWithContainerWhenSingleView: true }] diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts index 6b8d69bdfdb5a..4362953931dea 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts @@ -284,7 +284,7 @@ export class UserDataSyncDataViews extends Disposable { const result = await dialogService.confirm({ message: localize({ key: 'confirm replace', comment: ['A confirmation message to replace current user data (settings, extensions, keybindings, snippets) with selected version'] }, "Would you like to replace your current {0} with selected?", getSyncAreaLabel(syncResource)), type: 'info', - title: SYNC_TITLE + title: SYNC_TITLE.value }); if (result.confirmed) { return userDataSyncService.replace({ created: syncResourceHandle.created, uri: URI.revive(syncResourceHandle.uri) }); diff --git a/src/vs/workbench/contrib/userDataSync/electron-sandbox/userDataSync.contribution.ts b/src/vs/workbench/contrib/userDataSync/electron-sandbox/userDataSync.contribution.ts index 7d757dc69b2fe..4f3ae60674080 100644 --- a/src/vs/workbench/contrib/userDataSync/electron-sandbox/userDataSync.contribution.ts +++ b/src/vs/workbench/contrib/userDataSync/electron-sandbox/userDataSync.contribution.ts @@ -10,7 +10,7 @@ import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle import { ISharedProcessService } from 'vs/platform/ipc/electron-sandbox/services'; import { UserDataSycnUtilServiceChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; import { registerAction2, Action2, MenuId } from 'vs/platform/actions/common/actions'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IFileService } from 'vs/platform/files/common/files'; @@ -36,8 +36,8 @@ registerAction2(class OpenSyncBackupsFolder extends Action2 { constructor() { super({ id: 'workbench.userData.actions.openSyncBackupsFolder', - title: { value: localize('Open Backup folder', "Open Local Backups Folder"), original: 'Open Local Backups Folder' }, - category: { value: SYNC_TITLE, original: `Settings Sync` }, + title: localize2('Open Backup folder', "Open Local Backups Folder"), + category: SYNC_TITLE, menu: { id: MenuId.CommandPalette, when: CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), diff --git a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts index b589c0c52569f..9e10ec35371cf 100644 --- a/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts +++ b/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts @@ -322,7 +322,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat this.environmentService.options.settingsSyncOptions.enablementHandler(true, this.currentAuthenticationProviderId); } - this.notificationService.info(localize('sync turned on', "{0} is turned on", SYNC_TITLE)); + this.notificationService.info(localize('sync turned on', "{0} is turned on", SYNC_TITLE.value)); } async turnoff(everywhere: boolean): Promise { @@ -362,7 +362,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat try { await this.progressService.withProgress({ location: ProgressLocation.Window, - title: SYNC_TITLE, + title: SYNC_TITLE.value, command: SHOW_SYNC_LOG_COMMAND_ID, delay: 500, }, async progress => { @@ -585,7 +585,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat })); }); - quickPick.title = SYNC_TITLE; + quickPick.title = SYNC_TITLE.value; quickPick.ok = false; quickPick.ignoreFocusOut = true; quickPick.placeholder = localize('choose account placeholder', "Select an account to sign in"); diff --git a/src/vs/workbench/services/userDataSync/common/userDataSync.ts b/src/vs/workbench/services/userDataSync/common/userDataSync.ts index 1aeb8181041ea..e5438a63c140a 100644 --- a/src/vs/workbench/services/userDataSync/common/userDataSync.ts +++ b/src/vs/workbench/services/userDataSync/common/userDataSync.ts @@ -7,13 +7,14 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' import { IAuthenticationProvider, SyncStatus, SyncResource, IUserDataSyncResource, IResourcePreview } from 'vs/platform/userDataSync/common/userDataSync'; import { Event } from 'vs/base/common/event'; import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { localize } from 'vs/nls'; +import { localize, localize2 } from 'vs/nls'; import { URI } from 'vs/base/common/uri'; import { Codicon } from 'vs/base/common/codicons'; import { registerIcon } from 'vs/platform/theme/common/iconRegistry'; import { IView } from 'vs/workbench/common/views'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { IAction2Options } from 'vs/platform/actions/common/actions'; +import { ILocalizedString } from 'vs/platform/action/common/action'; export interface IUserDataSyncAccount { readonly authenticationProviderId: string; @@ -72,8 +73,7 @@ export interface IUserDataSyncConflictsView extends IView { open(conflict: IResourcePreview): Promise; } -export const SYNC_ORIGINAL_TITLE = 'Settings Sync'; -export const SYNC_TITLE = localize('sync category', "Settings Sync"); +export const SYNC_TITLE: ILocalizedString = localize2('sync category', "Settings Sync"); export const SYNC_VIEW_ICON = registerIcon('settings-sync-view-icon', Codicon.sync, localize('syncViewIcon', 'View icon of the Settings Sync view.')); diff --git a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts index 6b523190e5061..f0e7842f1d5b3 100644 --- a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts @@ -80,7 +80,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' } + name: nls.localize2('Test View 1', 'Test View 1') }; ViewsRegistry.registerViews([viewDescriptor], container); @@ -144,8 +144,8 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' } }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' }, when: ContextKeyExpr.equals('showview2', true) }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1') }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: nls.localize2('Test View 2', 'Test View 2'), when: ContextKeyExpr.equals('showview2', true) }; ViewsRegistry.registerViews([view1, view2], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view1], 'only view1 should be visible'); @@ -167,8 +167,8 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' }, when: ContextKeyExpr.equals('showview1', true) }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' } }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true) }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: nls.localize2('Test View 2', 'Test View 2') }; ViewsRegistry.registerViews([view1, view2], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view2], 'only view2 should be visible'); @@ -190,9 +190,9 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' }, canToggleVisibility: true }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' }, canToggleVisibility: true }; - const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: { value: 'Test View 3', original: 'Test View 3' }, canToggleVisibility: true }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: nls.localize2('Test View 2', 'Test View 2'), canToggleVisibility: true }; + const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: nls.localize2('Test View 3', 'Test View 3'), canToggleVisibility: true }; ViewsRegistry.registerViews([view1, view2, view3], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view1, view2, view3]); @@ -235,9 +235,9 @@ suite('ViewContainerModel', () => { container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); - const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: { value: 'Test View 1', original: 'Test View 1' } }; - const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: { value: 'Test View 2', original: 'Test View 2' } }; - const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: { value: 'Test View 3', original: 'Test View 3' } }; + const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1') }; + const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, name: nls.localize2('Test View 2', 'Test View 2') }; + const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, name: nls.localize2('Test View 3', 'Test View 3') }; ViewsRegistry.registerViews([view1, view2, view3], container); assert.deepStrictEqual(testObject.visibleViewDescriptors, [view1, view2, view3], 'model views should be OK'); @@ -272,7 +272,7 @@ suite('ViewContainerModel', () => { const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, - name: { value: 'Test View 1', original: 'Test View 1' } + name: nls.localize2('Test View 1', 'Test View 1') }; ViewsRegistry.registerViews([viewDescriptor], container); @@ -328,12 +328,12 @@ suite('ViewContainerModel', () => { const view2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), }; const view3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), when: ContextKeyExpr.equals('showview', true) }; @@ -479,13 +479,13 @@ suite('ViewContainerModel', () => { ViewsRegistry.registerViews([{ id: 'view5', ctorDescriptor: null!, - name: { value: 'Test View 5', original: 'Test View 5' }, + name: nls.localize2('Test View 5', 'Test View 5'), canToggleVisibility: true, order: 5 }, { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canToggleVisibility: true, order: 2 }], container); @@ -497,13 +497,13 @@ suite('ViewContainerModel', () => { ViewsRegistry.registerViews([{ id: 'view4', ctorDescriptor: null!, - name: { value: 'Test View 4', original: 'Test View 4' }, + name: nls.localize2('Test View 4', 'Test View 4'), canToggleVisibility: true, order: 4 }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canToggleVisibility: true, order: 3 }, { @@ -618,13 +618,13 @@ suite('ViewContainerModel', () => { const viewDescriptor2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canToggleVisibility: true }; const viewDescriptor3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canToggleVisibility: true }; @@ -676,13 +676,13 @@ suite('ViewContainerModel', () => { const viewDescriptor2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canToggleVisibility: true }; const viewDescriptor3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canToggleVisibility: true }; @@ -744,19 +744,19 @@ suite('ViewContainerModel', () => { const viewDescriptor2: IViewDescriptor = { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canToggleVisibility: true }; const viewDescriptor3: IViewDescriptor = { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canToggleVisibility: true }; const viewDescriptor4: IViewDescriptor = { id: 'view4', ctorDescriptor: null!, - name: { value: 'Test View 4', original: 'Test View 4' }, + name: nls.localize2('Test View 4', 'Test View 4'), canToggleVisibility: true }; diff --git a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts index dcb45032ac32f..980f1cac78d1d 100644 --- a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts @@ -67,13 +67,13 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true } ]; @@ -109,13 +109,13 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true } ]; @@ -149,13 +149,13 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true } ]; @@ -209,13 +209,13 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true } ]; @@ -291,14 +291,14 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true, order: 2 }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true, order: 3 } @@ -353,19 +353,19 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true }, { id: 'view4', ctorDescriptor: null!, - name: { value: 'Test View 4', original: 'Test View 4' }, + name: nls.localize2('Test View 4', 'Test View 4'), canMoveView: true } ]; @@ -402,19 +402,19 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true }, { id: 'view4', ctorDescriptor: null!, - name: { value: 'Test View 4', original: 'Test View 4' }, + name: nls.localize2('Test View 4', 'Test View 4'), canMoveView: true } ]; @@ -465,14 +465,14 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true, order: 2 }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true, order: 3 } @@ -547,19 +547,19 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true }, { id: 'view3', ctorDescriptor: null!, - name: { value: 'Test View 3', original: 'Test View 3' }, + name: nls.localize2('Test View 3', 'Test View 3'), canMoveView: true }, { id: 'view4', ctorDescriptor: null!, - name: { value: 'Test View 4', original: 'Test View 4' }, + name: nls.localize2('Test View 4', 'Test View 4'), canMoveView: true } ]; @@ -647,7 +647,7 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true } ]; @@ -680,7 +680,7 @@ suite('ViewDescriptorService', () => { { id: 'view2', ctorDescriptor: null!, - name: { value: 'Test View 2', original: 'Test View 2' }, + name: nls.localize2('Test View 2', 'Test View 2'), canMoveView: true } ]; From 06f26485ae7efc7031bd938702c0717a3529fe67 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Mon, 9 Oct 2023 11:10:57 +0800 Subject: [PATCH 11/11] fix: use nls.localize2 to simplified code --- .../test/browser/mainThreadTreeViews.test.ts | 2 +- .../test/browser/viewContainerModel.test.ts | 44 +++++++++---------- .../browser/viewDescriptorService.test.ts | 16 +++---- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts b/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts index f3b2b94b17019..ada06633cf8d2 100644 --- a/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts +++ b/src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts @@ -57,7 +57,7 @@ suite('MainThreadHostTreeView', function () { const instantiationService: TestInstantiationService = workbenchInstantiationService(undefined, disposables); const viewDescriptorService = disposables.add(instantiationService.createInstance(ViewDescriptorService)); instantiationService.stub(IViewDescriptorService, viewDescriptorService); - container = Registry.as(Extensions.ViewContainersRegistry).registerViewContainer({ id: 'testContainer', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = Registry.as(Extensions.ViewContainersRegistry).registerViewContainer({ id: 'testContainer', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const viewDescriptor: ITreeViewDescriptor = { id: testTreeViewId, ctorDescriptor: null!, diff --git a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts index f0e7842f1d5b3..3384bb67aa31b 100644 --- a/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewContainerModel.test.ts @@ -64,13 +64,13 @@ suite('ViewContainerModel', () => { }); test('empty model', function () { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); assert.strictEqual(testObject.visibleViewDescriptors.length, 0); }); test('register/unregister', () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); @@ -97,7 +97,7 @@ suite('ViewContainerModel', () => { }); test('when contexts', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); assert.strictEqual(testObject.visibleViewDescriptors.length, 0); @@ -141,7 +141,7 @@ suite('ViewContainerModel', () => { })); test('when contexts - multiple', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1') }; @@ -164,7 +164,7 @@ suite('ViewContainerModel', () => { })); test('when contexts - multiple 2', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1'), when: ContextKeyExpr.equals('showview1', true) }; @@ -187,7 +187,7 @@ suite('ViewContainerModel', () => { })); test('setVisible', () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1'), canToggleVisibility: true }; @@ -232,7 +232,7 @@ suite('ViewContainerModel', () => { }); test('move', () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const view1: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, name: nls.localize2('Test View 1', 'Test View 1') }; @@ -262,7 +262,7 @@ suite('ViewContainerModel', () => { test('view states', () => runWithFakedTimers({ useFakeTimers: true }, async () => { storageService.store(`${container.id}.state.hidden`, JSON.stringify([{ id: 'view1', isHidden: true }]), StorageScope.PROFILE, StorageTarget.MACHINE); - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); @@ -282,7 +282,7 @@ suite('ViewContainerModel', () => { test('view states and when contexts', () => runWithFakedTimers({ useFakeTimers: true }, async () => { storageService.store(`${container.id}.state.hidden`, JSON.stringify([{ id: 'view1', isHidden: true }]), StorageScope.PROFILE, StorageTarget.MACHINE); - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); @@ -312,7 +312,7 @@ suite('ViewContainerModel', () => { test('view states and when contexts multiple views', () => runWithFakedTimers({ useFakeTimers: true }, async () => { storageService.store(`${container.id}.state.hidden`, JSON.stringify([{ id: 'view1', isHidden: true }]), StorageScope.PROFILE, StorageTarget.MACHINE); - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); @@ -357,7 +357,7 @@ suite('ViewContainerModel', () => { })); test('remove event is not triggered if view was hidden and removed', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor: IViewDescriptor = { @@ -387,7 +387,7 @@ suite('ViewContainerModel', () => { })); test('add event is not triggered if view was set visible (when visible) and not active', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor: IViewDescriptor = { @@ -414,7 +414,7 @@ suite('ViewContainerModel', () => { })); test('remove event is not triggered if view was hidden and not active', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor: IViewDescriptor = { @@ -441,7 +441,7 @@ suite('ViewContainerModel', () => { })); test('add event is not triggered if view was set visible (when not visible) and not active', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor: IViewDescriptor = { @@ -472,7 +472,7 @@ suite('ViewContainerModel', () => { })); test('added view descriptors are in ascending order in the event', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); @@ -523,7 +523,7 @@ suite('ViewContainerModel', () => { })); test('add event is triggered only once when view is set visible while it is set active', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor: IViewDescriptor = { @@ -554,7 +554,7 @@ suite('ViewContainerModel', () => { })); test('add event is not triggered only when view is set hidden while it is set active', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor: IViewDescriptor = { @@ -583,7 +583,7 @@ suite('ViewContainerModel', () => { })); test('#142087: view descriptor visibility is not reset', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const viewDescriptor: IViewDescriptor = { id: 'view1', @@ -606,7 +606,7 @@ suite('ViewContainerModel', () => { })); test('remove event is triggered properly if mutliple views are hidden at the same time', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor1: IViewDescriptor = { @@ -664,7 +664,7 @@ suite('ViewContainerModel', () => { })); test('add event is triggered properly if mutliple views are hidden at the same time', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor1: IViewDescriptor = { @@ -732,7 +732,7 @@ suite('ViewContainerModel', () => { })); test('add and remove events are triggered properly if mutliple views are hidden and added at the same time', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const testObject = viewDescriptorService.getViewContainerModel(container); const target = disposableStore.add(new ViewDescriptorSequence(testObject)); const viewDescriptor1: IViewDescriptor = { @@ -809,7 +809,7 @@ suite('ViewContainerModel', () => { })); test('newly added view descriptor is hidden if it was toggled hidden in storage before adding', () => runWithFakedTimers({ useFakeTimers: true }, async () => { - container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + container = ViewContainerRegistry.registerViewContainer({ id: 'test', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const viewDescriptor: IViewDescriptor = { id: 'view1', ctorDescriptor: null!, diff --git a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts index 980f1cac78d1d..58103b06c38cb 100644 --- a/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts +++ b/src/vs/workbench/services/views/test/browser/viewDescriptorService.test.ts @@ -22,8 +22,8 @@ import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/uti const ViewsRegistry = Registry.as(ViewContainerExtensions.ViewsRegistry); const ViewContainersRegistry = Registry.as(ViewContainerExtensions.ViewContainersRegistry); const viewContainerIdPrefix = 'testViewContainer'; -const sidebarContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); -const panelContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Panel); +const sidebarContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); +const panelContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Panel); suite('ViewDescriptorService', () => { @@ -330,7 +330,7 @@ suite('ViewDescriptorService', () => { test('initialize with custom locations', async function () { const storageService = instantiationService.get(IStorageService); - const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const generateViewContainer1 = `workbench.views.service.${ViewContainerLocationToString(ViewContainerLocation.Sidebar)}.${generateUuid()}`; const viewsCustomizations = { viewContainerLocations: { @@ -389,7 +389,7 @@ suite('ViewDescriptorService', () => { test('storage change', async function () { const testObject = aViewDescriptorService(); - const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const generateViewContainer1 = `workbench.views.service.${ViewContainerLocationToString(ViewContainerLocation.Sidebar)}.${generateUuid()}`; const viewDescriptors: IViewDescriptor[] = [ @@ -524,7 +524,7 @@ suite('ViewDescriptorService', () => { test('custom locations take precedence when default view container of views change', async function () { const storageService = instantiationService.get(IStorageService); - const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const generateViewContainer1 = `workbench.views.service.${ViewContainerLocationToString(ViewContainerLocation.Sidebar)}.${generateUuid()}`; const viewsCustomizations = { viewContainerLocations: { @@ -586,7 +586,7 @@ suite('ViewDescriptorService', () => { test('view containers with not existing views are not removed from customizations', async function () { const storageService = instantiationService.get(IStorageService); - const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + const viewContainer1 = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const generateViewContainer1 = `workbench.views.service.${ViewContainerLocationToString(ViewContainerLocation.Sidebar)}.${generateUuid()}`; const viewsCustomizations = { viewContainerLocations: { @@ -636,7 +636,7 @@ suite('ViewDescriptorService', () => { }; storageService.store('views.customizations', JSON.stringify(viewsCustomizations), StorageScope.PROFILE, StorageTarget.USER); - const viewContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + const viewContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const viewDescriptors: IViewDescriptor[] = [ { id: 'view1', @@ -668,7 +668,7 @@ suite('ViewDescriptorService', () => { const storageService = instantiationService.get(IStorageService); const testObject = aViewDescriptorService(); - const viewContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); + const viewContainer = ViewContainersRegistry.registerViewContainer({ id: `${viewContainerIdPrefix}-${generateUuid()}`, title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor({}) }, ViewContainerLocation.Sidebar); const viewDescriptors: IViewDescriptor[] = [ { id: 'view1',