Skip to content

Commit 4f77d34

Browse files
committed
editors - let the diff editor compute a good name
1 parent f29f23f commit 4f77d34

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { localize } from 'vs/nls';
76
import { disposed } from 'vs/base/common/errors';
87
import { IDisposable, dispose, DisposableStore } from 'vs/base/common/lifecycle';
98
import { equals as objectEquals } from 'vs/base/common/objects';
@@ -348,10 +347,6 @@ CommandsRegistry.registerCommand('_workbench.diff', async function (accessor: Se
348347
};
349348
}
350349

351-
if (!label) {
352-
label = localize('diffLeftRightLabel', "{0} ⟷ {1}", leftResource.toString(true), rightResource.toString(true));
353-
}
354-
355350
await editorService.openEditor({ leftResource, rightResource, label, description, options }, viewColumnToEditorGroup(editorGroupService, position));
356351
});
357352

src/vs/workbench/services/editor/browser/editorService.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
818818
const rightInput = this.createEditorInput({ resource: resourceDiffInput.rightResource, forceFile: resourceDiffInput.forceFile });
819819

820820
return new DiffEditorInput(
821-
resourceDiffInput.label || this.toSideBySideLabel(leftInput, rightInput, '↔'),
821+
resourceDiffInput.label || this.toSideBySideLabel(leftInput, rightInput),
822822
resourceDiffInput.description,
823823
leftInput,
824824
rightInput
@@ -968,18 +968,13 @@ export class EditorService extends Disposable implements EditorServiceImpl {
968968
return input;
969969
}
970970

971-
private toSideBySideLabel(leftInput: EditorInput, rightInput: EditorInput, divider: string): string | undefined {
972-
973-
// Without any resource, do not try to compute a label
974-
if (!leftInput.resource || !rightInput.resource) {
975-
return undefined;
976-
}
971+
private toSideBySideLabel(leftInput: EditorInput, rightInput: EditorInput): string | undefined {
977972

978973
// If both editors are file inputs, we produce an optimized label
979974
// by adding the relative path of both inputs to the label. This
980975
// makes it easier to understand a file-based comparison.
981976
if (this.fileEditorInputFactory.isFileEditorInput(leftInput) && this.fileEditorInputFactory.isFileEditorInput(rightInput)) {
982-
return `${this.labelService.getUriLabel(leftInput.preferredResource, { relative: true })} ${divider} ${this.labelService.getUriLabel(rightInput.preferredResource, { relative: true })}`;
977+
return `${this.labelService.getUriLabel(leftInput.preferredResource, { relative: true })} ${this.labelService.getUriLabel(rightInput.preferredResource, { relative: true })}`;
983978
}
984979

985980
// Signal back that the label should be computed from within the editor

0 commit comments

Comments
 (0)