Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: to #157015 fix view label command localized #193544

Merged
merged 22 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9e101ca
fix: to #157015 fix view label command localized
yiliang114 Sep 20, 2023
2b9fb45
Merge branch 'main' into zonal-antlion
yiliang114 Sep 22, 2023
52148ae
chore: save
yiliang114 Sep 20, 2023
c7515e2
Fixes #157015
yiliang114 Sep 22, 2023
98b88b3
Merge pull request #192602 from sandersn/ai-codefixes
jrieken Sep 22, 2023
f98ef49
Merge pull request #191116 from microsoft/isidorn/thick-reindeer
isidorn Sep 22, 2023
19e2249
Merge pull request #193720 from microsoft/merogge/diff
meganrogge Sep 22, 2023
348b842
Merge branch 'main' into ulugbekna/implement-code-mappers-context
ulugbekna Sep 22, 2023
4718459
Merge pull request #193656 from microsoft/ulugbekna/implement-code-ma…
ulugbekna Sep 23, 2023
1c2b2a3
Merge branch 'main' into zonal-antlion
yiliang114 Sep 22, 2023
f1b0fbf
Fixes #157015
yiliang114 Sep 25, 2023
896e2ea
Fixes #157015
yiliang114 Sep 25, 2023
74bf93d
Merge branch 'main' into ulugbekna/implement-code-mappers-context
ulugbekna Sep 22, 2023
4a92285
Merge pull request #193656 from microsoft/ulugbekna/implement-code-ma…
ulugbekna Sep 23, 2023
1c8e12a
Merge branch 'main' into zonal-antlion
yiliang114 Sep 22, 2023
5bd253e
Fixes #157015
yiliang114 Sep 26, 2023
c89cb5a
Fixes #157015
yiliang114 Sep 26, 2023
3a91bfa
Fixes #157015
yiliang114 Sep 30, 2023
5fd1e02
fix: use nls.localize2 to simplified code
yiliang114 Oct 9, 2023
02d0d71
fix: use nls.localize2 to simplified code
yiliang114 Oct 9, 2023
06f2648
fix: use nls.localize2 to simplified code
yiliang114 Oct 9, 2023
9bcc960
Merge branch 'main' into zonal-antlion
yiliang114 Oct 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/vs/workbench/api/browser/mainThreadComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<T> implements languages.CommentThread<T> {
private _input?: languages.CommentInput;
get input(): languages.CommentInput | undefined {
Expand Down Expand Up @@ -601,7 +600,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments
if (!commentsViewAlreadyRegistered) {
const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(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,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/browser/viewsExtensionPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
5 changes: 3 additions & 2 deletions src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -56,11 +57,11 @@ suite('MainThreadHostTreeView', function () {
const instantiationService: TestInstantiationService = <TestInstantiationService>workbenchInstantiationService(undefined, disposables);
const viewDescriptorService = disposables.add(instantiationService.createInstance(ViewDescriptorService));
instantiationService.stub(IViewDescriptorService, viewDescriptorService);
container = Registry.as<IViewContainersRegistry>(Extensions.ViewContainersRegistry).registerViewContainer({ id: 'testContainer', title: { value: 'test', original: 'test' }, ctorDescriptor: new SyncDescriptor(<any>{}) }, ViewContainerLocation.Sidebar);
container = Registry.as<IViewContainersRegistry>(Extensions.ViewContainersRegistry).registerViewContainer({ id: 'testContainer', title: nls.localize2('test', 'test'), ctorDescriptor: new SyncDescriptor(<any>{}) }, ViewContainerLocation.Sidebar);
const viewDescriptor: ITreeViewDescriptor = {
id: testTreeViewId,
ctorDescriptor: null!,
name: '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);
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/browser/actions/layoutActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ registerAction2(class extends Action2 {

results.push({
id: viewDescriptor.id,
label: viewDescriptor.name
label: viewDescriptor.name.value
});
}
});
Expand All @@ -728,7 +728,7 @@ registerAction2(class extends Action2 {

results.push({
id: viewDescriptor.id,
label: viewDescriptor.name
label: viewDescriptor.name.value
});
}
});
Expand All @@ -753,7 +753,7 @@ registerAction2(class extends Action2 {

results.push({
id: viewDescriptor.id,
label: viewDescriptor.name
label: viewDescriptor.name.value
});
}
});
Expand Down Expand Up @@ -827,7 +827,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<IQuickPickItem | IQuickPickSeparator> = [];
const currentContainer = viewDescriptorService.getViewContainerByViewId(focusedViewId)!;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/views/viewPaneContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ICustomViewDescriptor>).extensionId,
expanded: !collapsed
});
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/parts/views/viewsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,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<T extends IView>(id: string, focus?: boolean): Promise<T | null> {
Expand Down Expand Up @@ -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);
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,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/common/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export interface IViewDescriptor {

readonly id: string;

readonly name: string;
readonly name: ILocalizedString;

readonly ctorDescriptor: SyncDescriptor<IView>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: [{
Expand Down Expand Up @@ -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: [{
Expand All @@ -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,
Expand Down Expand Up @@ -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: [{
Expand All @@ -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: [{
Expand All @@ -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),
Expand All @@ -326,7 +326,7 @@ const refactorPreviewViewIcon = registerIcon('refactor-preview-view-icon', Codic

const container = Registry.as<IViewContainersRegistry>(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,
Expand All @@ -338,7 +338,7 @@ const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.V

Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews([{
id: BulkEditPane.ID,
name: localize('panel', "Refactor Preview"),
name: localize2('panel', "Refactor Preview"),
when: BulkEditPreviewContribution.ctxEnabled,
ctorDescriptor: new SyncDescriptor(BulkEditPane),
containerIcon: refactorPreviewViewIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<IViewContainersRegistry>(ViewExtensions.ViewContainersRegistry).registerViewContainer({
id: viewContainerId,
title: { value: title, original: 'Chat' },
title,
icon,
ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [viewContainerId, { mergeViewWithContainerWhenSingleView: true }]),
storageId: viewContainerId,
Expand All @@ -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, [<IChatViewOptions>{ providerId: providerDescriptor.id }]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/comments/browser/commentsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
return '';
},
getWidgetAriaLabel(): string {
return COMMENTS_VIEW_TITLE;
return COMMENTS_VIEW_TITLE.value;
}
}
}));
Expand Down
Loading
Loading