Skip to content

Commit 6d4d5a5

Browse files
committed
cleanup
1 parent 2aa63c8 commit 6d4d5a5

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/vs/workbench/services/workingCopy/common/workingCopyService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ export interface IWorkingCopyService {
6969
readonly dirtyWorkingCopies: readonly IWorkingCopy[];
7070

7171
/**
72-
* The number of dirty working copies that are registered.
72+
* The number of modified working copies that are registered,
73+
* including scratchpads, which are never dirty.
7374
*/
7475
readonly modifiedCount: number;
7576

7677
/**
7778
* All working copies with unsaved changes,
78-
* including scratchpads, which are never dirty
79+
* including scratchpads, which are never dirty.
7980
*/
8081
readonly modifiedWorkingCopies: readonly IWorkingCopy[];
8182

src/vs/workbench/services/workingCopy/electron-sandbox/workingCopyBackupTracker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,11 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
208208
}
209209

210210
private showErrorDialog(msg: string, workingCopies: readonly IWorkingCopy[], error?: Error): void {
211+
const modifiedWorkingCopies = workingCopies.filter(workingCopy => workingCopy.isModified());
212+
211213
const advice = localize('backupErrorDetails', "Try saving or reverting the editors with unsaved changes first and then try again.");
212-
const detail = workingCopies.length
213-
? getFileNamesMessage(workingCopies.map(x => x.name)) + '\n' + advice
214+
const detail = modifiedWorkingCopies.length
215+
? getFileNamesMessage(modifiedWorkingCopies.map(x => x.name)) + '\n' + advice
214216
: advice;
215217

216218
this.dialogService.error(msg, detail);

src/vs/workbench/services/workingCopy/test/common/workingCopyService.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ suite('WorkingCopyService', () => {
4848
assert.strictEqual(onDidRegister.length, 1);
4949
assert.strictEqual(onDidRegister[0], copy1);
5050
assert.strictEqual(service.dirtyCount, 0);
51+
assert.strictEqual(service.modifiedCount, 0);
5152
assert.strictEqual(service.isDirty(resource1), false);
5253
assert.strictEqual(service.has(resource1), true);
5354
assert.strictEqual(service.has(copy1), true);
@@ -64,8 +65,9 @@ suite('WorkingCopyService', () => {
6465
assert.strictEqual(copy1.isDirty(), true);
6566
assert.strictEqual(service.dirtyCount, 1);
6667
assert.strictEqual(service.dirtyWorkingCopies.length, 1);
67-
assert.strictEqual(service.modifiedWorkingCopies.length, 1);
6868
assert.strictEqual(service.dirtyWorkingCopies[0], copy1);
69+
assert.strictEqual(service.modifiedCount, 1);
70+
assert.strictEqual(service.modifiedWorkingCopies.length, 1);
6971
assert.strictEqual(service.modifiedWorkingCopies[0], copy1);
7072
assert.strictEqual(service.workingCopies.length, 1);
7173
assert.strictEqual(service.workingCopies[0], copy1);

0 commit comments

Comments
 (0)