Skip to content

Commit

Permalink
fix #86553 (#86578)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Dec 9, 2019
1 parent 2722018 commit 5442190
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/vs/workbench/contrib/files/browser/views/openEditorsView.ts
Expand Up @@ -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.$;

Expand Down Expand Up @@ -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),
Expand All @@ -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 {
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 5442190

Please sign in to comment.