提交 93c2f694 编写于 作者: B Benjamin Pasero

fix: quick open should not report dirty if auto save is on

上级 5b20fcb6
...@@ -24,7 +24,7 @@ import { QuickOpenWidget, HideReason } from 'vs/base/parts/quickopen/browser/qui ...@@ -24,7 +24,7 @@ import { QuickOpenWidget, HideReason } from 'vs/base/parts/quickopen/browser/qui
import { ContributableActionProvider } from 'vs/workbench/browser/actionBarRegistry'; import { ContributableActionProvider } from 'vs/workbench/browser/actionBarRegistry';
import labels = require('vs/base/common/labels'); import labels = require('vs/base/common/labels');
import paths = require('vs/base/common/paths'); import paths = require('vs/base/common/paths');
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { ITextFileService, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
import { Registry } from 'vs/platform/platform'; import { Registry } from 'vs/platform/platform';
import { IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor'; import { IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
import { IModeService } from 'vs/editor/common/services/modeService'; import { IModeService } from 'vs/editor/common/services/modeService';
...@@ -1038,6 +1038,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry { ...@@ -1038,6 +1038,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
private resource: URI; private resource: URI;
private label: string; private label: string;
private description: string; private description: string;
private dirty: boolean;
constructor( constructor(
input: IEditorInput | IResourceInput, input: IEditorInput | IResourceInput,
...@@ -1056,16 +1057,22 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry { ...@@ -1056,16 +1057,22 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
this.resource = getUntitledOrFileResource(input); this.resource = getUntitledOrFileResource(input);
this.label = input.getName(); this.label = input.getName();
this.description = input.getDescription(); this.description = input.getDescription();
this.dirty = input.isDirty();
} else { } else {
const resourceInput = input as IResourceInput; const resourceInput = input as IResourceInput;
this.resource = resourceInput.resource; this.resource = resourceInput.resource;
this.label = paths.basename(resourceInput.resource.fsPath); this.label = paths.basename(resourceInput.resource.fsPath);
this.description = labels.getPathLabel(paths.dirname(this.resource.fsPath), contextService); this.description = labels.getPathLabel(paths.dirname(this.resource.fsPath), contextService);
this.dirty = this.resource && this.textFileService.isDirty(this.resource);
if (this.dirty && this.textFileService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
this.dirty = false; // no dirty decoration if auto save is on with a short timeout
}
} }
} }
public getIcon(): string { public getIcon(): string {
return this.resource && this.textFileService.isDirty(this.resource) ? 'dirty' : ''; return this.dirty ? 'dirty' : '';
} }
public getLabel(): string { public getLabel(): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册