Skip to content

Commit b385fa7

Browse files
author
Benjamin Pasero
committed
editors - improve language
1 parent 6de6876 commit b385fa7

36 files changed

Lines changed: 250 additions & 251 deletions

src/vs/workbench/api/browser/mainThreadWebview.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
141141

142142
this._register(_editorService.onDidActiveEditorChange(() => {
143143
const activeInput = this._editorService.activeEditor;
144-
if (activeInput instanceof DiffEditorInput && activeInput.master instanceof WebviewInput && activeInput.details instanceof WebviewInput) {
144+
if (activeInput instanceof DiffEditorInput && activeInput.primary instanceof WebviewInput && activeInput.secondary instanceof WebviewInput) {
145145
this.registerWebviewFromDiffEditorListeners(activeInput);
146146
}
147147

@@ -468,22 +468,22 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
468468
}
469469

470470
private registerWebviewFromDiffEditorListeners(diffEditorInput: DiffEditorInput): void {
471-
const master = diffEditorInput.master as WebviewInput;
472-
const details = diffEditorInput.details as WebviewInput;
471+
const primary = diffEditorInput.primary as WebviewInput;
472+
const secondary = diffEditorInput.secondary as WebviewInput;
473473

474-
if (this._webviewFromDiffEditorHandles.has(master.id) || this._webviewFromDiffEditorHandles.has(details.id)) {
474+
if (this._webviewFromDiffEditorHandles.has(primary.id) || this._webviewFromDiffEditorHandles.has(secondary.id)) {
475475
return;
476476
}
477477

478-
this._webviewFromDiffEditorHandles.add(master.id);
479-
this._webviewFromDiffEditorHandles.add(details.id);
478+
this._webviewFromDiffEditorHandles.add(primary.id);
479+
this._webviewFromDiffEditorHandles.add(secondary.id);
480480

481481
const disposables = new DisposableStore();
482-
disposables.add(master.webview.onDidFocus(() => this.updateWebviewViewStates(master)));
483-
disposables.add(details.webview.onDidFocus(() => this.updateWebviewViewStates(details)));
482+
disposables.add(primary.webview.onDidFocus(() => this.updateWebviewViewStates(primary)));
483+
disposables.add(secondary.webview.onDidFocus(() => this.updateWebviewViewStates(secondary)));
484484
disposables.add(diffEditorInput.onDispose(() => {
485-
this._webviewFromDiffEditorHandles.delete(master.id);
486-
this._webviewFromDiffEditorHandles.delete(details.id);
485+
this._webviewFromDiffEditorHandles.delete(primary.id);
486+
this._webviewFromDiffEditorHandles.delete(secondary.id);
487487
dispose(disposables);
488488
}));
489489
}
@@ -515,8 +515,8 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
515515
for (const group of this._editorGroupService.groups) {
516516
for (const input of group.editors) {
517517
if (input instanceof DiffEditorInput) {
518-
updateViewStatesForInput(group, input, input.master);
519-
updateViewStatesForInput(group, input, input.details);
518+
updateViewStatesForInput(group, input, input.primary);
519+
updateViewStatesForInput(group, input, input.secondary);
520520
} else {
521521
updateViewStatesForInput(group, input, input);
522522
}

src/vs/workbench/browser/labels.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
2424
import { withNullAsUndefined } from 'vs/base/common/types';
2525

2626
export interface IResourceLabelProps {
27-
resource?: URI | { master?: URI, detail?: URI };
27+
resource?: URI | { primary?: URI, secondary?: URI };
2828
name?: string | string[];
2929
description?: string;
3030
}
@@ -38,7 +38,7 @@ function toResource(props: IResourceLabelProps | undefined): URI | undefined {
3838
return props.resource;
3939
}
4040

41-
return props.resource.master;
41+
return props.resource.primary;
4242
}
4343

4444
export interface IResourceLabelOptions extends IIconLabelValueOptions {
@@ -379,9 +379,9 @@ class ResourceLabelWidget extends IconLabel {
379379

380380
setResource(label: IResourceLabelProps, options: IResourceLabelOptions = Object.create(null)): void {
381381
const resource = toResource(label);
382-
const isMasterDetail = label?.resource && !URI.isUri(label.resource);
382+
const isSideBySideEditor = label?.resource && !URI.isUri(label.resource);
383383

384-
if (!options.forceLabel && !isMasterDetail && resource?.scheme === Schemas.untitled) {
384+
if (!options.forceLabel && !isSideBySideEditor && resource?.scheme === Schemas.untitled) {
385385
// Untitled labels are very dynamic because they may change
386386
// whenever the content changes (unless a path is associated).
387387
// As such we always ask the actual editor for it's name and
@@ -390,7 +390,7 @@ class ResourceLabelWidget extends IconLabel {
390390
// we assume that the client does not want to display them
391391
// and as such do not override.
392392
//
393-
// We do not touch the label if it represents a master-detail
393+
// We do not touch the label if it represents a primary-secondary
394394
// because in that case we expect it to carry a proper label
395395
// and description.
396396
const untitledModel = this.textFileService.untitled.get(resource);

src/vs/workbench/browser/parts/editor/binaryDiffEditor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export class BinaryResourceDiffEditor extends SideBySideEditor {
2929
}
3030

3131
getMetadata(): string | undefined {
32-
const master = this.masterEditorPane;
33-
const details = this.detailsEditorPane;
32+
const primary = this.primaryEditorPane;
33+
const secondary = this.secondaryEditorPane;
3434

35-
if (master instanceof BaseBinaryResourceEditor && details instanceof BaseBinaryResourceEditor) {
36-
return nls.localize('metadataDiff', "{0} ↔ {1}", details.getMetadata(), master.getMetadata());
35+
if (primary instanceof BaseBinaryResourceEditor && secondary instanceof BaseBinaryResourceEditor) {
36+
return nls.localize('metadataDiff', "{0} ↔ {1}", secondary.getMetadata(), primary.getMetadata());
3737
}
3838

3939
return undefined;

src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export class BreadcrumbsControl {
234234
this._breadcrumbsDisposables.clear();
235235

236236
// honor diff editors and such
237-
const uri = toResource(this._editorGroup.activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
237+
const uri = toResource(this._editorGroup.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
238238

239239
if (!uri || !this._fileService.canHandleResource(uri)) {
240240
// cleanup and return when there is no input or when

src/vs/workbench/browser/parts/editor/editor.contribution.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,28 @@ interface ISerializedSideBySideEditorInput {
173173
name: string;
174174
description: string | undefined;
175175

176-
detailsSerialized: string;
177-
masterSerialized: string;
176+
primarySerialized: string;
177+
secondarySerialized: string;
178178

179-
detailsTypeId: string;
180-
masterTypeId: string;
179+
primaryTypeId: string;
180+
secondaryTypeId: string;
181181
}
182182

183183
export abstract class AbstractSideBySideEditorInputFactory implements IEditorInputFactory {
184184

185-
private getInputFactories(detailsId: string, masterId: string): [IEditorInputFactory | undefined, IEditorInputFactory | undefined] {
185+
private getInputFactories(secondaryId: string, primaryId: string): [IEditorInputFactory | undefined, IEditorInputFactory | undefined] {
186186
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
187187

188-
return [registry.getEditorInputFactory(detailsId), registry.getEditorInputFactory(masterId)];
188+
return [registry.getEditorInputFactory(secondaryId), registry.getEditorInputFactory(primaryId)];
189189
}
190190

191191
canSerialize(editorInput: EditorInput): boolean {
192192
const input = editorInput as SideBySideEditorInput | DiffEditorInput;
193193

194-
if (input.details && input.master) {
195-
const [detailsInputFactory, masterInputFactory] = this.getInputFactories(input.details.getTypeId(), input.master.getTypeId());
194+
if (input.primary && input.secondary) {
195+
const [secondaryInputFactory, primaryInputFactory] = this.getInputFactories(input.secondary.getTypeId(), input.primary.getTypeId());
196196

197-
return !!(detailsInputFactory?.canSerialize(input.details) && masterInputFactory?.canSerialize(input.master));
197+
return !!(secondaryInputFactory?.canSerialize(input.secondary) && primaryInputFactory?.canSerialize(input.primary));
198198
}
199199

200200
return false;
@@ -203,20 +203,20 @@ export abstract class AbstractSideBySideEditorInputFactory implements IEditorInp
203203
serialize(editorInput: EditorInput): string | undefined {
204204
const input = editorInput as SideBySideEditorInput | DiffEditorInput;
205205

206-
if (input.details && input.master) {
207-
const [detailsInputFactory, masterInputFactory] = this.getInputFactories(input.details.getTypeId(), input.master.getTypeId());
208-
if (detailsInputFactory && masterInputFactory) {
209-
const detailsSerialized = detailsInputFactory.serialize(input.details);
210-
const masterSerialized = masterInputFactory.serialize(input.master);
206+
if (input.primary && input.secondary) {
207+
const [secondaryInputFactory, primaryInputFactory] = this.getInputFactories(input.secondary.getTypeId(), input.primary.getTypeId());
208+
if (primaryInputFactory && secondaryInputFactory) {
209+
const primarySerialized = primaryInputFactory.serialize(input.primary);
210+
const secondarySerialized = secondaryInputFactory.serialize(input.secondary);
211211

212-
if (detailsSerialized && masterSerialized) {
212+
if (primarySerialized && secondarySerialized) {
213213
const serializedEditorInput: ISerializedSideBySideEditorInput = {
214214
name: input.getName(),
215215
description: input.getDescription(),
216-
detailsSerialized,
217-
masterSerialized,
218-
detailsTypeId: input.details.getTypeId(),
219-
masterTypeId: input.master.getTypeId()
216+
primarySerialized: primarySerialized,
217+
secondarySerialized: secondarySerialized,
218+
primaryTypeId: input.primary.getTypeId(),
219+
secondaryTypeId: input.secondary.getTypeId()
220220
};
221221

222222
return JSON.stringify(serializedEditorInput);
@@ -230,33 +230,33 @@ export abstract class AbstractSideBySideEditorInputFactory implements IEditorInp
230230
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | undefined {
231231
const deserialized: ISerializedSideBySideEditorInput = JSON.parse(serializedEditorInput);
232232

233-
const [detailsInputFactory, masterInputFactory] = this.getInputFactories(deserialized.detailsTypeId, deserialized.masterTypeId);
234-
if (detailsInputFactory && masterInputFactory) {
235-
const detailsInput = detailsInputFactory.deserialize(instantiationService, deserialized.detailsSerialized);
236-
const masterInput = masterInputFactory.deserialize(instantiationService, deserialized.masterSerialized);
233+
const [secondaryInputFactory, primaryInputFactory] = this.getInputFactories(deserialized.secondaryTypeId, deserialized.primaryTypeId);
234+
if (primaryInputFactory && secondaryInputFactory) {
235+
const primaryInput = primaryInputFactory.deserialize(instantiationService, deserialized.primarySerialized);
236+
const secondaryInput = secondaryInputFactory.deserialize(instantiationService, deserialized.secondarySerialized);
237237

238-
if (detailsInput && masterInput) {
239-
return this.createEditorInput(deserialized.name, deserialized.description, detailsInput, masterInput);
238+
if (primaryInput && secondaryInput) {
239+
return this.createEditorInput(deserialized.name, deserialized.description, secondaryInput, primaryInput);
240240
}
241241
}
242242

243243
return undefined;
244244
}
245245

246-
protected abstract createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput;
246+
protected abstract createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput;
247247
}
248248

249249
class SideBySideEditorInputFactory extends AbstractSideBySideEditorInputFactory {
250250

251-
protected createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput {
252-
return new SideBySideEditorInput(name, description, detailsInput, masterInput);
251+
protected createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput {
252+
return new SideBySideEditorInput(name, description, secondaryInput, primaryInput);
253253
}
254254
}
255255

256256
class DiffEditorInputFactory extends AbstractSideBySideEditorInputFactory {
257257

258-
protected createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput {
259-
return new DiffEditorInput(name, description, detailsInput, masterInput);
258+
protected createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput {
259+
return new DiffEditorInput(name, description, secondaryInput, primaryInput);
260260
}
261261
}
262262

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ abstract class BaseCloseAllAction extends Action {
581581
else {
582582
let name: string;
583583
if (editor instanceof SideBySideEditorInput) {
584-
name = editor.master.getName(); // prefer shorter names by using master's name in this case
584+
name = editor.primary.getName(); // prefer shorter names by using primary's name in this case
585585
} else {
586586
name = editor.getName();
587587
}

src/vs/workbench/browser/parts/editor/editorGroupView.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
527527

528528
// Include both sides of side by side editors when being closed
529529
if (editor instanceof SideBySideEditorInput) {
530-
editorsToClose.push(editor.master, editor.details);
530+
editorsToClose.push(editor.primary, editor.secondary);
531531
}
532532

533533
// For each editor to close, we call dispose() to free up any resources.
@@ -537,7 +537,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
537537
for (const editor of editorsToClose) {
538538
if (!this.accessor.groups.some(groupView => groupView.group.contains(editor, {
539539
strictEquals: true, // only if this input is not shared across editor groups
540-
supportSideBySide: true // include side by side editor master & details
540+
supportSideBySide: true // include side by side editor primary & secondary
541541
}))) {
542542
editor.dispose();
543543
}
@@ -1359,8 +1359,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
13591359
return false; // editor must be dirty and not saving
13601360
}
13611361

1362-
if (editor instanceof SideBySideEditorInput && this._group.contains(editor.master)) {
1363-
return false; // master-side of editor is still opened somewhere else
1362+
if (editor instanceof SideBySideEditorInput && this._group.contains(editor.primary)) {
1363+
return false; // primary-side of editor is still opened somewhere else
13641364
}
13651365

13661366
// Note: we explicitly decide to ask for confirm if closing a normal editor even
@@ -1378,8 +1378,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
13781378
return true; // exact editor still opened
13791379
}
13801380

1381-
if (editor instanceof SideBySideEditorInput && otherGroup.contains(editor.master)) {
1382-
return true; // master side of side by side editor still opened
1381+
if (editor instanceof SideBySideEditorInput && otherGroup.contains(editor.primary)) {
1382+
return true; // primary side of side by side editor still opened
13831383
}
13841384

13851385
return false;
@@ -1404,7 +1404,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
14041404

14051405
let name: string;
14061406
if (editor instanceof SideBySideEditorInput) {
1407-
name = editor.master.getName(); // prefer shorter names by using master's name in this case
1407+
name = editor.primary.getName(); // prefer shorter names by using primary's name in this case
14081408
} else {
14091409
name = editor.getName();
14101410
}

src/vs/workbench/browser/parts/editor/editorQuickAccess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
137137
}
138138

139139
return this.doGetEditors().map(({ editor, groupId }): IEditorQuickPickItem => {
140-
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
140+
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
141141
const isDirty = editor.isDirty() && !editor.isSaving();
142142
const description = editor.getDescription();
143143
const nameAndDescription = description ? `${editor.getName()} ${description}` : editor.getName();

0 commit comments

Comments
 (0)