提交 95ce364a 编写于 作者: B Benjamin Pasero

Open editors: briefly shows "1 unsaved" even though auto save is on (fixes #86553)

上级 a162ad20
......@@ -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');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册