Skip to content

Commit 09324ff

Browse files
author
Benjamin Pasero
committed
files - do not indicate document edited when auto save is on
1 parent 7225d02 commit 09324ff

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/vs/workbench/contrib/files/common/dirtyFilesIndicator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ export class DirtyFilesIndicator extends Disposable implements IWorkbenchContrib
4141
this.lifecycleService.onShutdown(this.dispose, this);
4242
}
4343

44-
private onWorkingCopyDidChangeDirty(copy: IWorkingCopy): void {
45-
const gotDirty = copy.isDirty();
46-
if (gotDirty && !!(copy.capabilities & WorkingCopyCapabilities.AutoSave) && this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
44+
private onWorkingCopyDidChangeDirty(workingCopy: IWorkingCopy): void {
45+
const gotDirty = workingCopy.isDirty();
46+
if (gotDirty && !!(workingCopy.capabilities & WorkingCopyCapabilities.AutoSave) && this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
4747
return; // do not indicate dirty of working copies that are auto saved after short delay
4848
}
4949

src/vs/workbench/electron-browser/window.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ import { ITunnelService, extractLocalHostUriMetaDataForPortMapping } from 'vs/pl
6060
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
6161
import { IHostService } from 'vs/workbench/services/host/browser/host';
6262
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
63-
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
63+
import { IWorkingCopyService, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService';
64+
import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
6465

6566
export class ElectronWindow extends Disposable {
6667

@@ -103,7 +104,8 @@ export class ElectronWindow extends Disposable {
103104
@ITunnelService private readonly tunnelService: ITunnelService,
104105
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
105106
@IElectronEnvironmentService private readonly electronEnvironmentService: IElectronEnvironmentService,
106-
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService
107+
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService,
108+
@IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService
107109
) {
108110
super();
109111

@@ -267,6 +269,10 @@ export class ElectronWindow extends Disposable {
267269
if (isMacintosh) {
268270
this._register(this.workingCopyService.onDidChangeDirty(workingCopy => {
269271
const gotDirty = workingCopy.isDirty();
272+
if (gotDirty && !!(workingCopy.capabilities & WorkingCopyCapabilities.AutoSave) && this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
273+
return; // do not indicate dirty of working copies that are auto saved after short delay
274+
}
275+
270276
if ((!this.isDocumentedEdited && gotDirty) || (this.isDocumentedEdited && !gotDirty)) {
271277
const hasDirtyFiles = this.workingCopyService.hasDirty;
272278
this.isDocumentedEdited = hasDirtyFiles;

0 commit comments

Comments
 (0)