diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index de1f8bf059b31..246ab00ec3902 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -41,8 +41,9 @@ import { ElementsDragAndDropData, DesktopDragAndDropData } from 'vs/base/browser import { URI } from 'vs/base/common/uri'; import { withUndefinedAsNull } from 'vs/base/common/types'; import { isWeb } from 'vs/base/common/platform'; -import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; +import { IWorkingCopyService, IWorkingCopy, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; const $ = dom.$; @@ -76,7 +77,8 @@ export class OpenEditorsView extends ViewletPane { @IThemeService private readonly themeService: IThemeService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IMenuService private readonly menuService: IMenuService, - @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService + @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, + @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService ) { super({ ...(options as IViewletPaneOptions), @@ -100,7 +102,7 @@ export class OpenEditorsView extends ViewletPane { this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(e))); // Handle dirty counter - this._register(this.workingCopyService.onDidChangeDirty(() => this.updateDirtyIndicator())); + this._register(this.workingCopyService.onDidChangeDirty(c => this.updateDirtyIndicator(c))); } private registerUpdateEvents(): void { @@ -414,7 +416,14 @@ export class OpenEditorsView extends ViewletPane { this.maximumBodySize = this.getMaxExpandedBodySize(); } - private updateDirtyIndicator(): void { + private updateDirtyIndicator(workingCopy?: IWorkingCopy): void { + if (workingCopy) { + const gotDirty = workingCopy.isDirty(); + if (gotDirty && !!(workingCopy.capabilities & WorkingCopyCapabilities.AutoSave) && this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) { + return; // do not indicate dirty of working copies that are auto saved after short delay + } + } + let dirty = this.workingCopyService.dirtyCount; if (dirty === 0) { dom.addClass(this.dirtyCountElement, 'hidden');