From 17de5fb347cd4274a71ac7709336bc14aabdefea Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:38:17 +0000 Subject: [PATCH 1/3] Fix --- .../multiDiffEditor/browser/multiDiffEditorInput.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts b/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts index 35847cd444a2e..489cf0a7c60d5 100644 --- a/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts +++ b/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts @@ -98,10 +98,10 @@ export class MultiDiffEditorInput extends EditorInput implements ILanguageSuppor const resources = this.resources.read(reader); const label = this.label ?? localize('name', "Multi Diff Editor"); if (resources) { - this._name = label + localize({ - key: 'files', - comment: ['the number of files being shown'] - }, " ({0} files)", resources.length); + const fileLabel = resources.length === 1 ? + localize({ key: 'file', comment: ['the number of files being shown'] }, " ({0} file)", resources.length) : + localize({ key: 'files', comment: ['the number of files being shown'] }, " ({0} files)", resources.length); + this._name = label + fileLabel; } else { this._name = label; } From efdda171fc3ee664f5eb6acf9793492d72888c8c Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:11:53 +0000 Subject: [PATCH 2/3] Apply code review --- .../multiDiffEditor/browser/multiDiffEditorInput.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts b/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts index 489cf0a7c60d5..6d3564c762b51 100644 --- a/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts +++ b/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts @@ -97,11 +97,10 @@ export class MultiDiffEditorInput extends EditorInput implements ILanguageSuppor /** @description Updates name */ const resources = this.resources.read(reader); const label = this.label ?? localize('name', "Multi Diff Editor"); - if (resources) { - const fileLabel = resources.length === 1 ? - localize({ key: 'file', comment: ['the number of files being shown'] }, " ({0} file)", resources.length) : - localize({ key: 'files', comment: ['the number of files being shown'] }, " ({0} files)", resources.length); - this._name = label + fileLabel; + if (resources && resources.length === 1) { + this._name = localize('nameWithOneFile', "{0} (1 file)", label); + } else if (resources) { + this._name = localize({ key: 'nameWithFiles', comment: ['the name of the editor', 'the number of files being shown'] }, "{0} ({1} files)", label, resources.length); } else { this._name = label; } From 82bd4e6c20d6f83a716f201064ec9f52108c11c7 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:18:14 +0000 Subject: [PATCH 3/3] Clarify comments --- .../contrib/multiDiffEditor/browser/multiDiffEditorInput.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts b/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts index 6d3564c762b51..aa09311d40184 100644 --- a/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts +++ b/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts @@ -98,9 +98,9 @@ export class MultiDiffEditorInput extends EditorInput implements ILanguageSuppor const resources = this.resources.read(reader); const label = this.label ?? localize('name', "Multi Diff Editor"); if (resources && resources.length === 1) { - this._name = localize('nameWithOneFile', "{0} (1 file)", label); + this._name = localize({ key: 'nameWithOneFile', comment: ['{0} is the name of the editor'] }, "{0} (1 file)", label); } else if (resources) { - this._name = localize({ key: 'nameWithFiles', comment: ['the name of the editor', 'the number of files being shown'] }, "{0} ({1} files)", label, resources.length); + this._name = localize({ key: 'nameWithFiles', comment: ['{0} is the name of the editor', '{1} is the number of files being shown'] }, "{0} ({1} files)", label, resources.length); } else { this._name = label; }