editors - improve language

This commit is contained in:
Benjamin Pasero 2020-06-19 14:53:47 +02:00
parent 6de6876177
commit b385fa7ceb
36 changed files with 250 additions and 251 deletions

View file

@ -141,7 +141,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
this._register(_editorService.onDidActiveEditorChange(() => {
const activeInput = this._editorService.activeEditor;
if (activeInput instanceof DiffEditorInput && activeInput.master instanceof WebviewInput && activeInput.details instanceof WebviewInput) {
if (activeInput instanceof DiffEditorInput && activeInput.primary instanceof WebviewInput && activeInput.secondary instanceof WebviewInput) {
this.registerWebviewFromDiffEditorListeners(activeInput);
}
@ -468,22 +468,22 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
}
private registerWebviewFromDiffEditorListeners(diffEditorInput: DiffEditorInput): void {
const master = diffEditorInput.master as WebviewInput;
const details = diffEditorInput.details as WebviewInput;
const primary = diffEditorInput.primary as WebviewInput;
const secondary = diffEditorInput.secondary as WebviewInput;
if (this._webviewFromDiffEditorHandles.has(master.id) || this._webviewFromDiffEditorHandles.has(details.id)) {
if (this._webviewFromDiffEditorHandles.has(primary.id) || this._webviewFromDiffEditorHandles.has(secondary.id)) {
return;
}
this._webviewFromDiffEditorHandles.add(master.id);
this._webviewFromDiffEditorHandles.add(details.id);
this._webviewFromDiffEditorHandles.add(primary.id);
this._webviewFromDiffEditorHandles.add(secondary.id);
const disposables = new DisposableStore();
disposables.add(master.webview.onDidFocus(() => this.updateWebviewViewStates(master)));
disposables.add(details.webview.onDidFocus(() => this.updateWebviewViewStates(details)));
disposables.add(primary.webview.onDidFocus(() => this.updateWebviewViewStates(primary)));
disposables.add(secondary.webview.onDidFocus(() => this.updateWebviewViewStates(secondary)));
disposables.add(diffEditorInput.onDispose(() => {
this._webviewFromDiffEditorHandles.delete(master.id);
this._webviewFromDiffEditorHandles.delete(details.id);
this._webviewFromDiffEditorHandles.delete(primary.id);
this._webviewFromDiffEditorHandles.delete(secondary.id);
dispose(disposables);
}));
}
@ -515,8 +515,8 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
for (const group of this._editorGroupService.groups) {
for (const input of group.editors) {
if (input instanceof DiffEditorInput) {
updateViewStatesForInput(group, input, input.master);
updateViewStatesForInput(group, input, input.details);
updateViewStatesForInput(group, input, input.primary);
updateViewStatesForInput(group, input, input.secondary);
} else {
updateViewStatesForInput(group, input, input);
}

View file

@ -24,7 +24,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IResourceLabelProps {
resource?: URI | { master?: URI, detail?: URI };
resource?: URI | { primary?: URI, secondary?: URI };
name?: string | string[];
description?: string;
}
@ -38,7 +38,7 @@ function toResource(props: IResourceLabelProps | undefined): URI | undefined {
return props.resource;
}
return props.resource.master;
return props.resource.primary;
}
export interface IResourceLabelOptions extends IIconLabelValueOptions {
@ -379,9 +379,9 @@ class ResourceLabelWidget extends IconLabel {
setResource(label: IResourceLabelProps, options: IResourceLabelOptions = Object.create(null)): void {
const resource = toResource(label);
const isMasterDetail = label?.resource && !URI.isUri(label.resource);
const isSideBySideEditor = label?.resource && !URI.isUri(label.resource);
if (!options.forceLabel && !isMasterDetail && resource?.scheme === Schemas.untitled) {
if (!options.forceLabel && !isSideBySideEditor && resource?.scheme === Schemas.untitled) {
// Untitled labels are very dynamic because they may change
// whenever the content changes (unless a path is associated).
// As such we always ask the actual editor for it's name and
@ -390,7 +390,7 @@ class ResourceLabelWidget extends IconLabel {
// we assume that the client does not want to display them
// and as such do not override.
//
// We do not touch the label if it represents a master-detail
// We do not touch the label if it represents a primary-secondary
// because in that case we expect it to carry a proper label
// and description.
const untitledModel = this.textFileService.untitled.get(resource);

View file

@ -29,11 +29,11 @@ export class BinaryResourceDiffEditor extends SideBySideEditor {
}
getMetadata(): string | undefined {
const master = this.masterEditorPane;
const details = this.detailsEditorPane;
const primary = this.primaryEditorPane;
const secondary = this.secondaryEditorPane;
if (master instanceof BaseBinaryResourceEditor && details instanceof BaseBinaryResourceEditor) {
return nls.localize('metadataDiff', "{0} ↔ {1}", details.getMetadata(), master.getMetadata());
if (primary instanceof BaseBinaryResourceEditor && secondary instanceof BaseBinaryResourceEditor) {
return nls.localize('metadataDiff', "{0} ↔ {1}", secondary.getMetadata(), primary.getMetadata());
}
return undefined;

View file

@ -234,7 +234,7 @@ export class BreadcrumbsControl {
this._breadcrumbsDisposables.clear();
// honor diff editors and such
const uri = toResource(this._editorGroup.activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
const uri = toResource(this._editorGroup.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (!uri || !this._fileService.canHandleResource(uri)) {
// cleanup and return when there is no input or when

View file

@ -173,28 +173,28 @@ interface ISerializedSideBySideEditorInput {
name: string;
description: string | undefined;
detailsSerialized: string;
masterSerialized: string;
primarySerialized: string;
secondarySerialized: string;
detailsTypeId: string;
masterTypeId: string;
primaryTypeId: string;
secondaryTypeId: string;
}
export abstract class AbstractSideBySideEditorInputFactory implements IEditorInputFactory {
private getInputFactories(detailsId: string, masterId: string): [IEditorInputFactory | undefined, IEditorInputFactory | undefined] {
private getInputFactories(secondaryId: string, primaryId: string): [IEditorInputFactory | undefined, IEditorInputFactory | undefined] {
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
return [registry.getEditorInputFactory(detailsId), registry.getEditorInputFactory(masterId)];
return [registry.getEditorInputFactory(secondaryId), registry.getEditorInputFactory(primaryId)];
}
canSerialize(editorInput: EditorInput): boolean {
const input = editorInput as SideBySideEditorInput | DiffEditorInput;
if (input.details && input.master) {
const [detailsInputFactory, masterInputFactory] = this.getInputFactories(input.details.getTypeId(), input.master.getTypeId());
if (input.primary && input.secondary) {
const [secondaryInputFactory, primaryInputFactory] = this.getInputFactories(input.secondary.getTypeId(), input.primary.getTypeId());
return !!(detailsInputFactory?.canSerialize(input.details) && masterInputFactory?.canSerialize(input.master));
return !!(secondaryInputFactory?.canSerialize(input.secondary) && primaryInputFactory?.canSerialize(input.primary));
}
return false;
@ -203,20 +203,20 @@ export abstract class AbstractSideBySideEditorInputFactory implements IEditorInp
serialize(editorInput: EditorInput): string | undefined {
const input = editorInput as SideBySideEditorInput | DiffEditorInput;
if (input.details && input.master) {
const [detailsInputFactory, masterInputFactory] = this.getInputFactories(input.details.getTypeId(), input.master.getTypeId());
if (detailsInputFactory && masterInputFactory) {
const detailsSerialized = detailsInputFactory.serialize(input.details);
const masterSerialized = masterInputFactory.serialize(input.master);
if (input.primary && input.secondary) {
const [secondaryInputFactory, primaryInputFactory] = this.getInputFactories(input.secondary.getTypeId(), input.primary.getTypeId());
if (primaryInputFactory && secondaryInputFactory) {
const primarySerialized = primaryInputFactory.serialize(input.primary);
const secondarySerialized = secondaryInputFactory.serialize(input.secondary);
if (detailsSerialized && masterSerialized) {
if (primarySerialized && secondarySerialized) {
const serializedEditorInput: ISerializedSideBySideEditorInput = {
name: input.getName(),
description: input.getDescription(),
detailsSerialized,
masterSerialized,
detailsTypeId: input.details.getTypeId(),
masterTypeId: input.master.getTypeId()
primarySerialized: primarySerialized,
secondarySerialized: secondarySerialized,
primaryTypeId: input.primary.getTypeId(),
secondaryTypeId: input.secondary.getTypeId()
};
return JSON.stringify(serializedEditorInput);
@ -230,33 +230,33 @@ export abstract class AbstractSideBySideEditorInputFactory implements IEditorInp
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | undefined {
const deserialized: ISerializedSideBySideEditorInput = JSON.parse(serializedEditorInput);
const [detailsInputFactory, masterInputFactory] = this.getInputFactories(deserialized.detailsTypeId, deserialized.masterTypeId);
if (detailsInputFactory && masterInputFactory) {
const detailsInput = detailsInputFactory.deserialize(instantiationService, deserialized.detailsSerialized);
const masterInput = masterInputFactory.deserialize(instantiationService, deserialized.masterSerialized);
const [secondaryInputFactory, primaryInputFactory] = this.getInputFactories(deserialized.secondaryTypeId, deserialized.primaryTypeId);
if (primaryInputFactory && secondaryInputFactory) {
const primaryInput = primaryInputFactory.deserialize(instantiationService, deserialized.primarySerialized);
const secondaryInput = secondaryInputFactory.deserialize(instantiationService, deserialized.secondarySerialized);
if (detailsInput && masterInput) {
return this.createEditorInput(deserialized.name, deserialized.description, detailsInput, masterInput);
if (primaryInput && secondaryInput) {
return this.createEditorInput(deserialized.name, deserialized.description, secondaryInput, primaryInput);
}
}
return undefined;
}
protected abstract createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput;
protected abstract createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput;
}
class SideBySideEditorInputFactory extends AbstractSideBySideEditorInputFactory {
protected createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput {
return new SideBySideEditorInput(name, description, detailsInput, masterInput);
protected createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput {
return new SideBySideEditorInput(name, description, secondaryInput, primaryInput);
}
}
class DiffEditorInputFactory extends AbstractSideBySideEditorInputFactory {
protected createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput {
return new DiffEditorInput(name, description, detailsInput, masterInput);
protected createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput {
return new DiffEditorInput(name, description, secondaryInput, primaryInput);
}
}

View file

@ -581,7 +581,7 @@ abstract class BaseCloseAllAction extends Action {
else {
let name: string;
if (editor instanceof SideBySideEditorInput) {
name = editor.master.getName(); // prefer shorter names by using master's name in this case
name = editor.primary.getName(); // prefer shorter names by using primary's name in this case
} else {
name = editor.getName();
}

View file

@ -527,7 +527,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Include both sides of side by side editors when being closed
if (editor instanceof SideBySideEditorInput) {
editorsToClose.push(editor.master, editor.details);
editorsToClose.push(editor.primary, editor.secondary);
}
// For each editor to close, we call dispose() to free up any resources.
@ -537,7 +537,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
for (const editor of editorsToClose) {
if (!this.accessor.groups.some(groupView => groupView.group.contains(editor, {
strictEquals: true, // only if this input is not shared across editor groups
supportSideBySide: true // include side by side editor master & details
supportSideBySide: true // include side by side editor primary & secondary
}))) {
editor.dispose();
}
@ -1359,8 +1359,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return false; // editor must be dirty and not saving
}
if (editor instanceof SideBySideEditorInput && this._group.contains(editor.master)) {
return false; // master-side of editor is still opened somewhere else
if (editor instanceof SideBySideEditorInput && this._group.contains(editor.primary)) {
return false; // primary-side of editor is still opened somewhere else
}
// 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 {
return true; // exact editor still opened
}
if (editor instanceof SideBySideEditorInput && otherGroup.contains(editor.master)) {
return true; // master side of side by side editor still opened
if (editor instanceof SideBySideEditorInput && otherGroup.contains(editor.primary)) {
return true; // primary side of side by side editor still opened
}
return false;
@ -1404,7 +1404,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
let name: string;
if (editor instanceof SideBySideEditorInput) {
name = editor.master.getName(); // prefer shorter names by using master's name in this case
name = editor.primary.getName(); // prefer shorter names by using primary's name in this case
} else {
name = editor.getName();
}

View file

@ -137,7 +137,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
}
return this.doGetEditors().map(({ editor, groupId }): IEditorQuickPickItem => {
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
const isDirty = editor.isDirty() && !editor.isSaving();
const description = editor.getDescription();
const nameAndDescription = description ? `${editor.getName()} ${description}` : editor.getName();

View file

@ -54,22 +54,22 @@ import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGRO
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
class SideBySideEditorEncodingSupport implements IEncodingSupport {
constructor(private master: IEncodingSupport, private details: IEncodingSupport) { }
constructor(private primary: IEncodingSupport, private secondary: IEncodingSupport) { }
getEncoding(): string | undefined {
return this.master.getEncoding(); // always report from modified (right hand) side
return this.primary.getEncoding(); // always report from modified (right hand) side
}
setEncoding(encoding: string, mode: EncodingMode): void {
[this.master, this.details].forEach(editor => editor.setEncoding(encoding, mode));
[this.primary, this.secondary].forEach(editor => editor.setEncoding(encoding, mode));
}
}
class SideBySideEditorModeSupport implements IModeSupport {
constructor(private master: IModeSupport, private details: IModeSupport) { }
constructor(private primary: IModeSupport, private secondary: IModeSupport) { }
setMode(mode: string): void {
[this.master, this.details].forEach(editor => editor.setMode(mode));
[this.primary, this.secondary].forEach(editor => editor.setMode(mode));
}
}
@ -82,14 +82,14 @@ function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport | nu
// Side by Side (diff) Editor
if (input instanceof SideBySideEditorInput) {
const masterEncodingSupport = toEditorWithEncodingSupport(input.master);
const detailsEncodingSupport = toEditorWithEncodingSupport(input.details);
const primaryEncodingSupport = toEditorWithEncodingSupport(input.primary);
const secondaryEncodingSupport = toEditorWithEncodingSupport(input.secondary);
if (masterEncodingSupport && detailsEncodingSupport) {
return new SideBySideEditorEncodingSupport(masterEncodingSupport, detailsEncodingSupport);
if (primaryEncodingSupport && secondaryEncodingSupport) {
return new SideBySideEditorEncodingSupport(primaryEncodingSupport, secondaryEncodingSupport);
}
return masterEncodingSupport;
return primaryEncodingSupport;
}
// File or Resource Editor
@ -111,14 +111,14 @@ function toEditorWithModeSupport(input: IEditorInput): IModeSupport | null {
// Side by Side (diff) Editor
if (input instanceof SideBySideEditorInput) {
const masterModeSupport = toEditorWithModeSupport(input.master);
const detailsModeSupport = toEditorWithModeSupport(input.details);
const primaryModeSupport = toEditorWithModeSupport(input.primary);
const secondaryModeSupport = toEditorWithModeSupport(input.secondary);
if (masterModeSupport && detailsModeSupport) {
return new SideBySideEditorModeSupport(masterModeSupport, detailsModeSupport);
if (primaryModeSupport && secondaryModeSupport) {
return new SideBySideEditorModeSupport(primaryModeSupport, secondaryModeSupport);
}
return masterModeSupport;
return primaryModeSupport;
}
// File or Resource Editor
@ -685,14 +685,14 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
else if (activeEditorPane instanceof BaseBinaryResourceEditor || activeEditorPane instanceof BinaryResourceDiffEditor) {
const binaryEditors: BaseBinaryResourceEditor[] = [];
if (activeEditorPane instanceof BinaryResourceDiffEditor) {
const details = activeEditorPane.getDetailsEditorPane();
if (details instanceof BaseBinaryResourceEditor) {
binaryEditors.push(details);
const primary = activeEditorPane.getPrimaryEditorPane();
if (primary instanceof BaseBinaryResourceEditor) {
binaryEditors.push(primary);
}
const master = activeEditorPane.getMasterEditorPane();
if (master instanceof BaseBinaryResourceEditor) {
binaryEditors.push(master);
const secondary = activeEditorPane.getSecondaryEditorPane();
if (secondary instanceof BaseBinaryResourceEditor) {
binaryEditors.push(secondary);
}
} else {
binaryEditors.push(activeEditorPane);
@ -871,7 +871,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
private onResourceEncodingChange(resource: URI): void {
const activeEditorPane = this.editorService.activeEditorPane;
if (activeEditorPane) {
const activeResource = toResource(activeEditorPane.input, { supportSideBySide: SideBySideEditor.MASTER });
const activeResource = toResource(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
if (activeResource && isEqual(activeResource, resource)) {
const activeCodeEditor = withNullAsUndefined(getCodeEditor(activeEditorPane.getControl()));
@ -1064,7 +1064,7 @@ export class ChangeModeAction extends Action {
}
const textModel = activeTextEditorControl.getModel();
const resource = this.editorService.activeEditor ? toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }) : null;
const resource = this.editorService.activeEditor ? toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY }) : null;
let hasLanguageSupport = !!resource;
if (resource?.scheme === Schemas.untitled && !this.textFileService.untitled.get(resource)?.hasAssociatedFilePath) {
@ -1161,7 +1161,7 @@ export class ChangeModeAction extends Action {
let languageSelection: ILanguageSelection | undefined;
if (pick === autoDetectMode) {
if (textModel) {
const resource = toResource(activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource) {
languageSelection = this.modeService.createByFilepathOrFirstLine(resource, textModel.getLineContent(1));
}
@ -1356,7 +1356,7 @@ export class ChangeEncodingAction extends Action {
await timeout(50); // quick input is sensitive to being opened so soon after another
const resource = toResource(activeEditorPane.input, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
if (!resource || (!this.fileService.canHandleResource(resource) && resource.scheme !== Schemas.untitled)) {
return; // encoding detection only possible for resources the file service can handle or that are untitled
}

View file

@ -185,7 +185,7 @@ export class EditorsObserver extends Disposable {
}
private updateEditorResourcesMap(editor: IEditorInput, add: boolean): void {
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (!resource) {
return; // require a resource
}

View file

@ -22,17 +22,16 @@ import { assertIsDefined } from 'vs/base/common/types';
export class SideBySideEditor extends BaseEditor {
static readonly ID: string = 'workbench.editor.sidebysideEditor';
static MASTER: SideBySideEditor | undefined;
get minimumMasterWidth() { return this.masterEditorPane ? this.masterEditorPane.minimumWidth : 0; }
get maximumMasterWidth() { return this.masterEditorPane ? this.masterEditorPane.maximumWidth : Number.POSITIVE_INFINITY; }
get minimumMasterHeight() { return this.masterEditorPane ? this.masterEditorPane.minimumHeight : 0; }
get maximumMasterHeight() { return this.masterEditorPane ? this.masterEditorPane.maximumHeight : Number.POSITIVE_INFINITY; }
private get minimumPrimaryWidth() { return this.primaryEditorPane ? this.primaryEditorPane.minimumWidth : 0; }
private get maximumPrimaryWidth() { return this.primaryEditorPane ? this.primaryEditorPane.maximumWidth : Number.POSITIVE_INFINITY; }
private get minimumPrimaryHeight() { return this.primaryEditorPane ? this.primaryEditorPane.minimumHeight : 0; }
private get maximumPrimaryHeight() { return this.primaryEditorPane ? this.primaryEditorPane.maximumHeight : Number.POSITIVE_INFINITY; }
get minimumDetailsWidth() { return this.detailsEditorPane ? this.detailsEditorPane.minimumWidth : 0; }
get maximumDetailsWidth() { return this.detailsEditorPane ? this.detailsEditorPane.maximumWidth : Number.POSITIVE_INFINITY; }
get minimumDetailsHeight() { return this.detailsEditorPane ? this.detailsEditorPane.minimumHeight : 0; }
get maximumDetailsHeight() { return this.detailsEditorPane ? this.detailsEditorPane.maximumHeight : Number.POSITIVE_INFINITY; }
private get minimumSecondaryWidth() { return this.secondaryEditorPane ? this.secondaryEditorPane.minimumWidth : 0; }
private get maximumSecondaryWidth() { return this.secondaryEditorPane ? this.secondaryEditorPane.maximumWidth : Number.POSITIVE_INFINITY; }
private get minimumSecondaryHeight() { return this.secondaryEditorPane ? this.secondaryEditorPane.minimumHeight : 0; }
private get maximumSecondaryHeight() { return this.secondaryEditorPane ? this.secondaryEditorPane.maximumHeight : Number.POSITIVE_INFINITY; }
// these setters need to exist because this extends from BaseEditor
set minimumWidth(value: number) { /* noop */ }
@ -40,16 +39,16 @@ export class SideBySideEditor extends BaseEditor {
set minimumHeight(value: number) { /* noop */ }
set maximumHeight(value: number) { /* noop */ }
get minimumWidth() { return this.minimumMasterWidth + this.minimumDetailsWidth; }
get maximumWidth() { return this.maximumMasterWidth + this.maximumDetailsWidth; }
get minimumHeight() { return this.minimumMasterHeight + this.minimumDetailsHeight; }
get maximumHeight() { return this.maximumMasterHeight + this.maximumDetailsHeight; }
get minimumWidth() { return this.minimumPrimaryWidth + this.minimumSecondaryWidth; }
get maximumWidth() { return this.maximumPrimaryWidth + this.maximumSecondaryWidth; }
get minimumHeight() { return this.minimumPrimaryHeight + this.minimumSecondaryHeight; }
get maximumHeight() { return this.maximumPrimaryHeight + this.maximumSecondaryHeight; }
protected masterEditorPane?: BaseEditor;
protected detailsEditorPane?: BaseEditor;
protected primaryEditorPane?: BaseEditor;
protected secondaryEditorPane?: BaseEditor;
private masterEditorContainer: HTMLElement | undefined;
private detailsEditorContainer: HTMLElement | undefined;
private primaryEditorContainer: HTMLElement | undefined;
private secondaryEditorContainer: HTMLElement | undefined;
private splitview: SplitView | undefined;
private dimension: DOM.Dimension = new DOM.Dimension(0, 0);
@ -74,19 +73,19 @@ export class SideBySideEditor extends BaseEditor {
const splitview = this.splitview = this._register(new SplitView(parent, { orientation: Orientation.HORIZONTAL }));
this._register(this.splitview.onDidSashReset(() => splitview.distributeViewSizes()));
this.detailsEditorContainer = DOM.$('.details-editor-container');
this.secondaryEditorContainer = DOM.$('.secondary-editor-container');
this.splitview.addView({
element: this.detailsEditorContainer,
layout: size => this.detailsEditorPane && this.detailsEditorPane.layout(new DOM.Dimension(size, this.dimension.height)),
element: this.secondaryEditorContainer,
layout: size => this.secondaryEditorPane && this.secondaryEditorPane.layout(new DOM.Dimension(size, this.dimension.height)),
minimumSize: 220,
maximumSize: Number.POSITIVE_INFINITY,
onDidChange: Event.None
}, Sizing.Distribute);
this.masterEditorContainer = DOM.$('.master-editor-container');
this.primaryEditorContainer = DOM.$('.primary-editor-container');
this.splitview.addView({
element: this.masterEditorContainer,
layout: size => this.masterEditorPane && this.masterEditorPane.layout(new DOM.Dimension(size, this.dimension.height)),
element: this.primaryEditorContainer,
layout: size => this.primaryEditorPane && this.primaryEditorPane.layout(new DOM.Dimension(size, this.dimension.height)),
minimumSize: 220,
maximumSize: Number.POSITIVE_INFINITY,
onDidChange: Event.None
@ -103,30 +102,30 @@ export class SideBySideEditor extends BaseEditor {
}
setOptions(options: EditorOptions | undefined): void {
if (this.masterEditorPane) {
this.masterEditorPane.setOptions(options);
if (this.primaryEditorPane) {
this.primaryEditorPane.setOptions(options);
}
}
protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void {
if (this.masterEditorPane) {
this.masterEditorPane.setVisible(visible, group);
if (this.primaryEditorPane) {
this.primaryEditorPane.setVisible(visible, group);
}
if (this.detailsEditorPane) {
this.detailsEditorPane.setVisible(visible, group);
if (this.secondaryEditorPane) {
this.secondaryEditorPane.setVisible(visible, group);
}
super.setEditorVisible(visible, group);
}
clearInput(): void {
if (this.masterEditorPane) {
this.masterEditorPane.clearInput();
if (this.primaryEditorPane) {
this.primaryEditorPane.clearInput();
}
if (this.detailsEditorPane) {
this.detailsEditorPane.clearInput();
if (this.secondaryEditorPane) {
this.secondaryEditorPane.clearInput();
}
this.disposeEditors();
@ -135,8 +134,8 @@ export class SideBySideEditor extends BaseEditor {
}
focus(): void {
if (this.masterEditorPane) {
this.masterEditorPane.focus();
if (this.primaryEditorPane) {
this.primaryEditorPane.focus();
}
}
@ -148,19 +147,19 @@ export class SideBySideEditor extends BaseEditor {
}
getControl(): IEditorControl | undefined {
if (this.masterEditorPane) {
return this.masterEditorPane.getControl();
if (this.primaryEditorPane) {
return this.primaryEditorPane.getControl();
}
return undefined;
}
getMasterEditorPane(): IEditorPane | undefined {
return this.masterEditorPane;
getPrimaryEditorPane(): IEditorPane | undefined {
return this.primaryEditorPane;
}
getDetailsEditorPane(): IEditorPane | undefined {
return this.detailsEditorPane;
getSecondaryEditorPane(): IEditorPane | undefined {
return this.secondaryEditorPane;
}
private async updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise<void> {
@ -172,21 +171,21 @@ export class SideBySideEditor extends BaseEditor {
return this.setNewInput(newInput, options, token);
}
if (!this.detailsEditorPane || !this.masterEditorPane) {
if (!this.secondaryEditorPane || !this.primaryEditorPane) {
return;
}
await Promise.all([
this.detailsEditorPane.setInput(newInput.details, undefined, token),
this.masterEditorPane.setInput(newInput.master, options, token)
this.secondaryEditorPane.setInput(newInput.secondary, undefined, token),
this.primaryEditorPane.setInput(newInput.primary, options, token)
]);
}
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise<void> {
const detailsEditor = this.doCreateEditor(newInput.details, assertIsDefined(this.detailsEditorContainer));
const masterEditor = this.doCreateEditor(newInput.master, assertIsDefined(this.masterEditorContainer));
const secondaryEditor = this.doCreateEditor(newInput.secondary, assertIsDefined(this.secondaryEditorContainer));
const primaryEditor = this.doCreateEditor(newInput.primary, assertIsDefined(this.primaryEditorContainer));
return this.onEditorsCreated(detailsEditor, masterEditor, newInput.details, newInput.master, options, token);
return this.onEditorsCreated(secondaryEditor, primaryEditor, newInput.secondary, newInput.primary, options, token);
}
private doCreateEditor(editorInput: EditorInput, container: HTMLElement): BaseEditor {
@ -202,48 +201,48 @@ export class SideBySideEditor extends BaseEditor {
return editor;
}
private async onEditorsCreated(details: BaseEditor, master: BaseEditor, detailsInput: EditorInput, masterInput: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise<void> {
this.detailsEditorPane = details;
this.masterEditorPane = master;
private async onEditorsCreated(secondary: BaseEditor, primary: BaseEditor, secondaryInput: EditorInput, primaryInput: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise<void> {
this.secondaryEditorPane = secondary;
this.primaryEditorPane = primary;
this._onDidSizeConstraintsChange.input = Event.any(
Event.map(details.onDidSizeConstraintsChange, () => undefined),
Event.map(master.onDidSizeConstraintsChange, () => undefined)
Event.map(secondary.onDidSizeConstraintsChange, () => undefined),
Event.map(primary.onDidSizeConstraintsChange, () => undefined)
);
this.onDidCreateEditors.fire(undefined);
await Promise.all([
this.detailsEditorPane.setInput(detailsInput, undefined, token),
this.masterEditorPane.setInput(masterInput, options, token)]
this.secondaryEditorPane.setInput(secondaryInput, undefined, token),
this.primaryEditorPane.setInput(primaryInput, options, token)]
);
}
updateStyles(): void {
super.updateStyles();
if (this.masterEditorContainer) {
this.masterEditorContainer.style.boxShadow = `-6px 0 5px -5px ${this.getColor(scrollbarShadow)}`;
if (this.primaryEditorContainer) {
this.primaryEditorContainer.style.boxShadow = `-6px 0 5px -5px ${this.getColor(scrollbarShadow)}`;
}
}
private disposeEditors(): void {
if (this.detailsEditorPane) {
this.detailsEditorPane.dispose();
this.detailsEditorPane = undefined;
if (this.secondaryEditorPane) {
this.secondaryEditorPane.dispose();
this.secondaryEditorPane = undefined;
}
if (this.masterEditorPane) {
this.masterEditorPane.dispose();
this.masterEditorPane = undefined;
if (this.primaryEditorPane) {
this.primaryEditorPane.dispose();
this.primaryEditorPane = undefined;
}
if (this.detailsEditorContainer) {
DOM.clearNode(this.detailsEditorContainer);
if (this.secondaryEditorContainer) {
DOM.clearNode(this.secondaryEditorContainer);
}
if (this.masterEditorContainer) {
DOM.clearNode(this.masterEditorContainer);
if (this.primaryEditorContainer) {
DOM.clearNode(this.primaryEditorContainer);
}
}

View file

@ -1087,7 +1087,7 @@ export class TabsTitleControl extends TitleControl {
);
// Tests helper
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource) {
tabContainer.setAttribute('data-resource-name', basenameOrAuthority(resource));
} else {

View file

@ -223,7 +223,7 @@ export abstract class TitleControl extends Themable {
this.editorToolBarMenuDisposables.clear();
// Update contexts
this.resourceContext.set(this.group.activeEditor ? withUndefinedAsNull(toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.MASTER })) : null);
this.resourceContext.set(this.group.activeEditor ? withUndefinedAsNull(toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY })) : null);
this.editorPinnedContext.set(this.group.activeEditor ? this.group.isPinned(this.group.activeEditor) : false);
this.editorStickyContext.set(this.group.activeEditor ? this.group.isSticky(this.group.activeEditor) : false);
@ -298,7 +298,7 @@ export abstract class TitleControl extends Themable {
}
protected doFillResourceDataTransfers(editor: IEditorInput, e: DragEvent): boolean {
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (!resource) {
return false;
}
@ -326,7 +326,7 @@ export abstract class TitleControl extends Themable {
// Update contexts based on editor picked and remember previous to restore
const currentResourceContext = this.resourceContext.get();
this.resourceContext.set(withUndefinedAsNull(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER })));
this.resourceContext.set(withUndefinedAsNull(toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY })));
const currentPinnedContext = !!this.editorPinnedContext.get();
this.editorPinnedContext.set(this.group.isPinned(editor));
const currentStickyContext = !!this.editorStickyContext.get();

View file

@ -271,7 +271,7 @@ export class TitlebarPart extends Part implements ITitleService {
if (this.contextService.getWorkbenchState() === WorkbenchState.FOLDER) {
folder = workspace.folders[0];
} else {
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource) {
folder = this.contextService.getWorkspaceFolder(resource);
}

View file

@ -680,7 +680,7 @@ export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeS
}
/**
* Side by side editor inputs that have a master and details side.
* Side by side editor inputs that have a primary and secondary side.
*/
export class SideBySideEditorInput extends EditorInput {
@ -689,8 +689,8 @@ export class SideBySideEditorInput extends EditorInput {
constructor(
protected readonly name: string | undefined,
private readonly description: string | undefined,
private readonly _details: EditorInput,
private readonly _master: EditorInput
private readonly _secondary: EditorInput,
private readonly _primary: EditorInput
) {
super();
@ -699,36 +699,36 @@ export class SideBySideEditorInput extends EditorInput {
private registerListeners(): void {
// When the details or master input gets disposed, dispose this diff editor input
const onceDetailsDisposed = Event.once(this.details.onDispose);
this._register(onceDetailsDisposed(() => {
// When the primary or secondary input gets disposed, dispose this diff editor input
const onceSecondaryDisposed = Event.once(this.secondary.onDispose);
this._register(onceSecondaryDisposed(() => {
if (!this.isDisposed()) {
this.dispose();
}
}));
const onceMasterDisposed = Event.once(this.master.onDispose);
this._register(onceMasterDisposed(() => {
const oncePrimaryDisposed = Event.once(this.primary.onDispose);
this._register(oncePrimaryDisposed(() => {
if (!this.isDisposed()) {
this.dispose();
}
}));
// Reemit some events from the master side to the outside
this._register(this.master.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this._register(this.master.onDidChangeLabel(() => this._onDidChangeLabel.fire()));
// Reemit some events from the primary side to the outside
this._register(this.primary.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this._register(this.primary.onDidChangeLabel(() => this._onDidChangeLabel.fire()));
}
get resource(): URI | undefined {
return undefined;
}
get master(): EditorInput {
return this._master;
get primary(): EditorInput {
return this._primary;
}
get details(): EditorInput {
return this._details;
get secondary(): EditorInput {
return this._secondary;
}
getTypeId(): string {
@ -737,7 +737,7 @@ export class SideBySideEditorInput extends EditorInput {
getName(): string {
if (!this.name) {
return localize('sideBySideLabels', "{0} - {1}", this._details.getName(), this._master.getName());
return localize('sideBySideLabels', "{0} - {1}", this._secondary.getName(), this._primary.getName());
}
return this.name;
@ -748,35 +748,35 @@ export class SideBySideEditorInput extends EditorInput {
}
isReadonly(): boolean {
return this.master.isReadonly();
return this.primary.isReadonly();
}
isUntitled(): boolean {
return this.master.isUntitled();
return this.primary.isUntitled();
}
isDirty(): boolean {
return this.master.isDirty();
return this.primary.isDirty();
}
isSaving(): boolean {
return this.master.isSaving();
return this.primary.isSaving();
}
save(group: GroupIdentifier, options?: ISaveOptions): Promise<IEditorInput | undefined> {
return this.master.save(group, options);
return this.primary.save(group, options);
}
saveAs(group: GroupIdentifier, options?: ISaveOptions): Promise<IEditorInput | undefined> {
return this.master.saveAs(group, options);
return this.primary.saveAs(group, options);
}
revert(group: GroupIdentifier, options?: IRevertOptions): Promise<void> {
return this.master.revert(group, options);
return this.primary.revert(group, options);
}
getTelemetryDescriptor(): { [key: string]: unknown } {
const descriptor = this.master.getTelemetryDescriptor();
const descriptor = this.primary.getTelemetryDescriptor();
return Object.assign(descriptor, super.getTelemetryDescriptor());
}
@ -791,7 +791,7 @@ export class SideBySideEditorInput extends EditorInput {
return false;
}
return this.details.matches(otherInput.details) && this.master.matches(otherInput.master);
return this.secondary.matches(otherInput.secondary) && this.primary.matches(otherInput.primary);
}
return false;
@ -1210,8 +1210,8 @@ export interface IEditorPartOptionsChangeEvent {
}
export enum SideBySideEditor {
MASTER = 1,
DETAILS = 2,
PRIMARY = 1,
SECONDARY = 2,
BOTH = 3
}
@ -1221,9 +1221,9 @@ export interface IResourceOptions {
}
export function toResource(editor: IEditorInput | undefined | null): URI | undefined;
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide?: SideBySideEditor.MASTER | SideBySideEditor.DETAILS }): URI | undefined;
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { master?: URI, detail?: URI } | undefined;
export function toResource(editor: IEditorInput | undefined | null, options?: IResourceOptions): URI | { master?: URI, detail?: URI } | undefined {
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide?: SideBySideEditor.PRIMARY | SideBySideEditor.SECONDARY }): URI | undefined;
export function toResource(editor: IEditorInput | undefined | null, options: IResourceOptions & { supportSideBySide: SideBySideEditor.BOTH }): URI | { primary?: URI, secondary?: URI } | undefined;
export function toResource(editor: IEditorInput | undefined | null, options?: IResourceOptions): URI | { primary?: URI, secondary?: URI } | undefined {
if (!editor) {
return undefined;
}
@ -1231,12 +1231,12 @@ export function toResource(editor: IEditorInput | undefined | null, options?: IR
if (options?.supportSideBySide && editor instanceof SideBySideEditorInput) {
if (options?.supportSideBySide === SideBySideEditor.BOTH) {
return {
master: toResource(editor.master, { filterByScheme: options.filterByScheme }),
detail: toResource(editor.details, { filterByScheme: options.filterByScheme })
primary: toResource(editor.primary, { filterByScheme: options.filterByScheme }),
secondary: toResource(editor.secondary, { filterByScheme: options.filterByScheme })
};
}
editor = options.supportSideBySide === SideBySideEditor.MASTER ? editor.master : editor.details;
editor = options.supportSideBySide === SideBySideEditor.PRIMARY ? editor.primary : editor.secondary;
}
const resource = editor.resource;

View file

@ -696,7 +696,7 @@ export class EditorGroup extends Disposable {
}
if (options?.supportSideBySide && editor instanceof SideBySideEditorInput) {
if (this.matches(editor.master, candidate, options?.strictEquals) || this.matches(editor.details, candidate, options?.strictEquals)) {
if (this.matches(editor.primary, candidate, options?.strictEquals) || this.matches(editor.secondary, candidate, options?.strictEquals)) {
return true;
}
}

View file

@ -633,7 +633,7 @@ export class ShowActiveFileInExplorer extends Action {
}
async run(): Promise<void> {
const resource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource) {
this.commandService.executeCommand(REVEAL_IN_EXPLORER_COMMAND_ID, resource);
} else {
@ -701,7 +701,7 @@ export class ShowOpenedFileInNewWindow extends Action {
}
async run(): Promise<void> {
const fileResource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
const fileResource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (fileResource) {
if (this.fileService.canHandleResource(fileResource)) {
this.hostService.openWindow([{ fileUri: fileResource }], { forceNewWindow: true });
@ -813,7 +813,7 @@ export class CompareWithClipboardAction extends Action {
}
async run(): Promise<void> {
const resource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
const scheme = `clipboardCompare${CompareWithClipboardAction.SCHEME_COUNTER++}`;
if (resource && (this.fileService.canHandleResource(resource) || resource.scheme === Schemas.untitled)) {
if (!this.registrationDisposal) {

View file

@ -178,7 +178,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
// Dispose once no more diff editor is opened with the scheme
if (registerEditorListener) {
providerDisposables.push(editorService.onDidVisibleEditorsChange(() => {
if (!editorService.editors.some(editor => !!toResource(editor, { supportSideBySide: SideBySideEditor.DETAILS, filterByScheme: COMPARE_WITH_SAVED_SCHEMA }))) {
if (!editorService.editors.some(editor => !!toResource(editor, { supportSideBySide: SideBySideEditor.SECONDARY, filterByScheme: COMPARE_WITH_SAVED_SCHEMA }))) {
providerDisposables = dispose(providerDisposables);
}
}));
@ -356,8 +356,8 @@ async function saveSelectedEditors(accessor: ServicesAccessor, options?: ISaveEd
// We only allow this when saving, not for "Save As".
// See also https://github.com/microsoft/vscode/issues/4180
if (activeGroup.activeEditor instanceof SideBySideEditorInput && !options?.saveAs) {
editors.push({ groupId: activeGroup.id, editor: activeGroup.activeEditor.master });
editors.push({ groupId: activeGroup.id, editor: activeGroup.activeEditor.details });
editors.push({ groupId: activeGroup.id, editor: activeGroup.activeEditor.primary });
editors.push({ groupId: activeGroup.id, editor: activeGroup.activeEditor.secondary });
} else {
editors.push({ groupId: activeGroup.id, editor: activeGroup.activeEditor });
}
@ -380,7 +380,7 @@ async function saveSelectedEditors(accessor: ServicesAccessor, options?: ISaveEd
const resource = focusedCodeEditor.getModel()?.uri;
// Check that the resource of the model was not saved already
if (resource && !editors.some(({ editor }) => isEqual(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }), resource))) {
if (resource && !editors.some(({ editor }) => isEqual(toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY }), resource))) {
const model = textFileService.files.get(resource);
if (!model?.isReadonly()) {
await textFileService.save(resource, options);

View file

@ -50,7 +50,7 @@ export function getResourceForCommand(resource: URI | object | undefined, listSe
return focus.getResource();
}
return editorService.activeEditor ? toResource(editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }) : undefined;
return editorService.activeEditor ? toResource(editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY }) : undefined;
}
export function getMultiSelectedResources(resource: URI | object | undefined, listService: IListService, editorService: IEditorService, explorerService: IExplorerService): Array<URI> {

View file

@ -668,7 +668,7 @@ export class ExplorerView extends ViewPane {
}
// check for files
return withNullAsUndefined(toResource(input, { supportSideBySide: SideBySideEditor.MASTER }));
return withNullAsUndefined(toResource(input, { supportSideBySide: SideBySideEditor.PRIMARY }));
}
public async selectResource(resource: URI | undefined, reveal = this.autoReveal, retry = 0): Promise<void> {

View file

@ -251,6 +251,6 @@ export class OpenEditor implements IEditorIdentifier {
}
getResource(): URI | undefined {
return toResource(this.editor, { supportSideBySide: SideBySideEditor.MASTER });
return toResource(this.editor, { supportSideBySide: SideBySideEditor.PRIMARY });
}
}

View file

@ -93,8 +93,8 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
// Register Preferences Editor Input Factory
class PreferencesEditorInputFactory extends AbstractSideBySideEditorInputFactory {
protected createEditorInput(name: string, description: string | undefined, detailsInput: EditorInput, masterInput: EditorInput): EditorInput {
return new PreferencesEditorInput(name, description, detailsInput, masterInput);
protected createEditorInput(name: string, description: string | undefined, secondaryInput: EditorInput, primaryInput: EditorInput): EditorInput {
return new PreferencesEditorInput(name, description, secondaryInput, primaryInput);
}
}

View file

@ -206,7 +206,7 @@ export class PreferencesEditor extends BaseEditor {
}
private updateInput(newInput: PreferencesEditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise<void> {
return this.sideBySidePreferencesWidget.setInput(<DefaultPreferencesEditorInput>newInput.details, <EditorInput>newInput.master, options, token).then(({ defaultPreferencesRenderer, editablePreferencesRenderer }) => {
return this.sideBySidePreferencesWidget.setInput(<DefaultPreferencesEditorInput>newInput.secondary, <EditorInput>newInput.primary, options, token).then(({ defaultPreferencesRenderer, editablePreferencesRenderer }) => {
if (token.isCancellationRequested) {
return;
}

View file

@ -651,7 +651,7 @@ class EditSettingRenderer extends Disposable {
private readonly _onUpdateSetting: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
readonly onUpdateSetting: Event<{ key: string, value: any, source: IIndexedSetting }> = this._onUpdateSetting.event;
constructor(private editor: ICodeEditor, private masterSettingsModel: ISettingsEditorModel,
constructor(private editor: ICodeEditor, private primarySettingsModel: ISettingsEditorModel,
private settingHighlighter: SettingHighlighter,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IContextMenuService private readonly contextMenuService: IContextMenuService
@ -683,7 +683,7 @@ class EditSettingRenderer extends Disposable {
}
private isDefaultSettings(): boolean {
return this.masterSettingsModel instanceof DefaultSettingsEditorModel;
return this.primarySettingsModel instanceof DefaultSettingsEditorModel;
}
private onConfigurationChanged(): void {
@ -769,7 +769,7 @@ class EditSettingRenderer extends Disposable {
return true;
}
if (configurationNode.type === 'boolean' || configurationNode.enum) {
if ((<SettingsEditorModel>this.masterSettingsModel).configurationTarget !== ConfigurationTarget.WORKSPACE_FOLDER) {
if ((<SettingsEditorModel>this.primarySettingsModel).configurationTarget !== ConfigurationTarget.WORKSPACE_FOLDER) {
return true;
}
if (configurationNode.scope === ConfigurationScope.RESOURCE || configurationNode.scope === ConfigurationScope.LANGUAGE_OVERRIDABLE) {

View file

@ -667,7 +667,7 @@ class ViewModel {
return;
}
const uri = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const uri = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (!uri) {
return;

View file

@ -96,7 +96,7 @@ export function getOutOfWorkspaceEditorResources(accessor: ServicesAccessor): UR
const fileService = accessor.get(IFileService);
const resources = editorService.editors
.map(editor => toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }))
.map(editor => toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY }))
.filter(resource => !!resource && !contextService.isInsideWorkspace(resource) && fileService.canHandleResource(resource));
return resources as URI[];

View file

@ -347,7 +347,7 @@ export class TimelinePane extends ViewPane {
const editor = this.editorService.activeEditor;
if (editor) {
uri = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
uri = toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
}
if ((uri?.toString(true) === this.uri?.toString(true) && uri !== undefined) ||

View file

@ -176,7 +176,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
// close stale conflicts editor previews
if (conflictsEditorInputs.length) {
conflictsEditorInputs.forEach(input => {
if (!conflicts.some(({ local }) => isEqual(local, input.master.resource))) {
if (!conflicts.some(({ local }) => isEqual(local, input.primary.resource))) {
input.dispose();
}
});
@ -338,7 +338,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
return;
}
const resource = source === SyncResource.Settings ? this.workbenchEnvironmentService.settingsResource : this.workbenchEnvironmentService.keybindingsResource;
if (isEqual(resource, toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }))) {
if (isEqual(resource, toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY }))) {
// Do not show notification if the file in error is active
return;
}
@ -591,14 +591,14 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private getConflictsEditorInputs(syncResource: SyncResource): DiffEditorInput[] {
return this.editorService.editors.filter(input => {
const resource = input instanceof DiffEditorInput ? input.master.resource : input.resource;
const resource = input instanceof DiffEditorInput ? input.primary.resource : input.resource;
return resource && getSyncResourceFromLocalPreview(resource!, this.workbenchEnvironmentService) === syncResource;
}) as DiffEditorInput[];
}
private getAllConflictsEditorInputs(): IEditorInput[] {
return this.editorService.editors.filter(input => {
const resource = input instanceof DiffEditorInput ? input.master.resource : input.resource;
const resource = input instanceof DiffEditorInput ? input.primary.resource : input.resource;
return resource && getSyncResourceFromLocalPreview(resource!, this.workbenchEnvironmentService) !== undefined;
});
}

View file

@ -138,7 +138,7 @@ export class NativeWindow extends Disposable {
if (request.from === 'touchbar') {
const activeEditor = this.editorService.activeEditor;
if (activeEditor) {
const resource = toResource(activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
const resource = toResource(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource) {
args.push(resource);
}
@ -250,7 +250,7 @@ export class NativeWindow extends Disposable {
// macOS OS integration
if (isMacintosh) {
this._register(this.editorService.onDidActiveEditorChange(() => {
const file = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER, filterByScheme: Schemas.file });
const file = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY, filterByScheme: Schemas.file });
// Represented Filename
this.updateRepresentedFilename(file?.fsPath);

View file

@ -185,8 +185,8 @@ export class EditorService extends Disposable implements EditorServiceImpl {
for (const editor of this.visibleEditors) {
const resources = distinct(coalesce([
toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }),
toResource(editor, { supportSideBySide: SideBySideEditor.DETAILS })
toResource(editor, { supportSideBySide: SideBySideEditor.PRIMARY }),
toResource(editor, { supportSideBySide: SideBySideEditor.SECONDARY })
]), resource => resource.toString());
for (const resource of resources) {
@ -380,8 +380,8 @@ export class EditorService extends Disposable implements EditorServiceImpl {
for (const editor of this.editors) {
if (options.supportSideBySide && editor instanceof SideBySideEditorInput) {
conditionallyAddEditor(editor.master);
conditionallyAddEditor(editor.details);
conditionallyAddEditor(editor.primary);
conditionallyAddEditor(editor.secondary);
} else {
conditionallyAddEditor(editor);
}
@ -1193,13 +1193,13 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return new Promise(resolve => {
const listener = this.onDidCloseEditor(async event => {
const detailsResource = toResource(event.editor, { supportSideBySide: SideBySideEditor.DETAILS });
const masterResource = toResource(event.editor, { supportSideBySide: SideBySideEditor.MASTER });
const primaryResource = toResource(event.editor, { supportSideBySide: SideBySideEditor.PRIMARY });
const secondaryResource = toResource(event.editor, { supportSideBySide: SideBySideEditor.SECONDARY });
// Remove from resources to wait for being closed based on the
// resources from editors that got closed
remainingEditors = remainingEditors.filter(({ resource }) => {
if (this.uriIdentityService.extUri.isEqual(resource, masterResource) || this.uriIdentityService.extUri.isEqual(resource, detailsResource)) {
if (this.uriIdentityService.extUri.isEqual(resource, primaryResource) || this.uriIdentityService.extUri.isEqual(resource, secondaryResource)) {
return false; // remove - the closing editor matches this resource
}

View file

@ -62,12 +62,12 @@ export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguratio
@memoize
get filesToDiff(): IPath[] | undefined {
if (this.payload) {
const fileToDiffDetail = this.payload.get('diffFileDetail');
const fileToDiffMaster = this.payload.get('diffFileMaster');
if (fileToDiffDetail && fileToDiffMaster) {
const fileToDiffPrimary = this.payload.get('diffFilePrimary');
const fileToDiffSecondary = this.payload.get('diffFileSecondary');
if (fileToDiffPrimary && fileToDiffSecondary) {
return [
{ fileUri: URI.parse(fileToDiffDetail) },
{ fileUri: URI.parse(fileToDiffMaster) }
{ fileUri: URI.parse(fileToDiffSecondary) },
{ fileUri: URI.parse(fileToDiffPrimary) }
];
}
}

View file

@ -632,7 +632,7 @@ export class HistoryService extends Disposable implements IHistoryService {
if (URI.isUri(editorResource)) {
associatedResources.push(editorResource);
} else if (editorResource) {
associatedResources.push(...coalesce([editorResource.master, editorResource.detail]));
associatedResources.push(...coalesce([editorResource.primary, editorResource.secondary]));
}
// Remove from list of recently closed before...

View file

@ -174,8 +174,8 @@ export class BrowserHostService extends Disposable implements IHostService {
// New Window: open into empty window
else {
const environment = new Map<string, string>();
environment.set('diffFileDetail', editors[0].resource.toString());
environment.set('diffFileMaster', editors[1].resource.toString());
environment.set('diffFileSecondary', editors[0].resource.toString());
environment.set('diffFilePrimary', editors[1].resource.toString());
this.workspaceProvider.open(undefined, { payload: Array.from(environment.entries()) });
}

View file

@ -210,7 +210,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
}
const editorInput = this.getActiveSettingsEditorInput() || this.lastOpenedSettingsInput;
const resource = editorInput ? editorInput.master.resource! : this.userSettingsResource;
const resource = editorInput ? editorInput.primary.resource! : this.userSettingsResource;
const target = this.getConfigurationTargetFromSettingsResource(resource);
return this.openOrSwitchSettings(target, resource, { query: query });
}
@ -317,7 +317,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
private async openOrSwitchSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: ISettingsEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): Promise<IEditorPane | undefined> {
const editorInput = this.getActiveSettingsEditorInput(group);
if (editorInput) {
const editorInputResource = editorInput.master.resource;
const editorInputResource = editorInput.primary.resource;
if (editorInputResource && editorInputResource.fsPath !== resource.fsPath) {
return this.doSwitchSettings(configurationTarget, resource, editorInput, group, options);
}

View file

@ -29,7 +29,7 @@ export class PreferencesEditorInput extends SideBySideEditorInput {
}
getTitle(verbosity: Verbosity): string {
return this.master.getTitle(verbosity);
return this.primary.getTitle(verbosity);
}
}

View file

@ -34,8 +34,8 @@ suite('Workbench editor', () => {
const untitled = instantiationService.createInstance(UntitledTextEditorInput, service.create());
assert.equal(toResource(untitled)!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { supportSideBySide: SideBySideEditor.MASTER })!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { supportSideBySide: SideBySideEditor.DETAILS })!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { supportSideBySide: SideBySideEditor.PRIMARY })!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { supportSideBySide: SideBySideEditor.SECONDARY })!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { supportSideBySide: SideBySideEditor.BOTH })!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { filterByScheme: Schemas.untitled })!.toString(), untitled.resource.toString());
assert.equal(toResource(untitled, { filterByScheme: [Schemas.file, Schemas.untitled] })!.toString(), untitled.resource.toString());
@ -44,8 +44,8 @@ suite('Workbench editor', () => {
const file = new TestEditorInput(URI.file('/some/path.txt'), 'editorResourceFileTest');
assert.equal(toResource(file)!.toString(), file.resource.toString());
assert.equal(toResource(file, { supportSideBySide: SideBySideEditor.MASTER })!.toString(), file.resource.toString());
assert.equal(toResource(file, { supportSideBySide: SideBySideEditor.DETAILS })!.toString(), file.resource.toString());
assert.equal(toResource(file, { supportSideBySide: SideBySideEditor.PRIMARY })!.toString(), file.resource.toString());
assert.equal(toResource(file, { supportSideBySide: SideBySideEditor.SECONDARY })!.toString(), file.resource.toString());
assert.equal(toResource(file, { supportSideBySide: SideBySideEditor.BOTH })!.toString(), file.resource.toString());
assert.equal(toResource(file, { filterByScheme: Schemas.file })!.toString(), file.resource.toString());
assert.equal(toResource(file, { filterByScheme: [Schemas.file, Schemas.untitled] })!.toString(), file.resource.toString());
@ -56,20 +56,20 @@ suite('Workbench editor', () => {
assert.ok(!toResource(diffEditorInput));
assert.ok(!toResource(diffEditorInput, { filterByScheme: Schemas.file }));
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.MASTER })!.toString(), file.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.MASTER, filterByScheme: Schemas.file })!.toString(), file.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.MASTER, filterByScheme: [Schemas.file, Schemas.untitled] })!.toString(), file.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.PRIMARY })!.toString(), file.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.PRIMARY, filterByScheme: Schemas.file })!.toString(), file.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.PRIMARY, filterByScheme: [Schemas.file, Schemas.untitled] })!.toString(), file.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.DETAILS })!.toString(), untitled.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.DETAILS, filterByScheme: Schemas.untitled })!.toString(), untitled.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.DETAILS, filterByScheme: [Schemas.file, Schemas.untitled] })!.toString(), untitled.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.SECONDARY })!.toString(), untitled.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.SECONDARY, filterByScheme: Schemas.untitled })!.toString(), untitled.resource.toString());
assert.equal(toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.SECONDARY, filterByScheme: [Schemas.file, Schemas.untitled] })!.toString(), untitled.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH }) as { master: URI, detail: URI }).master.toString(), file.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: Schemas.file }) as { master: URI, detail: URI }).master.toString(), file.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: [Schemas.file, Schemas.untitled] }) as { master: URI, detail: URI }).master.toString(), file.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH }) as { primary: URI, secondary: URI }).primary.toString(), file.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: Schemas.file }) as { primary: URI, secondary: URI }).primary.toString(), file.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: [Schemas.file, Schemas.untitled] }) as { primary: URI, secondary: URI }).primary.toString(), file.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH }) as { master: URI, detail: URI }).detail.toString(), untitled.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: Schemas.untitled }) as { master: URI, detail: URI }).detail.toString(), untitled.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: [Schemas.file, Schemas.untitled] }) as { master: URI, detail: URI }).detail.toString(), untitled.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH }) as { primary: URI, secondary: URI }).secondary.toString(), untitled.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: Schemas.untitled }) as { primary: URI, secondary: URI }).secondary.toString(), untitled.resource.toString());
assert.equal((toResource(diffEditorInput, { supportSideBySide: SideBySideEditor.BOTH, filterByScheme: [Schemas.file, Schemas.untitled] }) as { primary: URI, secondary: URI }).secondary.toString(), untitled.resource.toString());
});
});