Skip to content

Commit e71b337

Browse files
committed
file input - lift some code up that is only specific to files
1 parent b023cac commit e71b337

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/vs/workbench/common/editor/textResourceEditorInput.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
1010
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
1111
import { IFileService, FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
1212
import { ILabelService } from 'vs/platform/label/common/label';
13-
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
13+
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
1414
import { Schemas } from 'vs/base/common/network';
1515
import { dirname, isEqual } from 'vs/base/common/resources';
1616

@@ -178,18 +178,6 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput implem
178178
return this.fileService.hasCapability(this.resource, FileSystemProviderCapabilities.Readonly);
179179
}
180180

181-
override isSaving(): boolean {
182-
if (this.isUntitled()) {
183-
return false; // untitled is never saving automatically
184-
}
185-
186-
if (this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
187-
return true; // a short auto save is configured, treat this as being saved
188-
}
189-
190-
return false;
191-
}
192-
193181
override save(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
194182

195183
// If this is neither an `untitled` resource, nor a resource

src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { IReference, dispose, DisposableStore } from 'vs/base/common/lifecycle';
1515
import { ITextModelService } from 'vs/editor/common/services/resolverService';
1616
import { FILE_EDITOR_INPUT_ID, TEXT_FILE_EDITOR_ID, BINARY_FILE_EDITOR_ID } from 'vs/workbench/contrib/files/common/files';
1717
import { ILabelService } from 'vs/platform/label/common/label';
18-
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
18+
import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
1919
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
2020
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
2121
import { isEqual } from 'vs/base/common/resources';
@@ -263,6 +263,10 @@ export class FileEditorInput extends AbstractTextResourceEditorInput implements
263263
// and it could result in bad UX where an editor can be closed even though
264264
// it shows up as dirty and has not finished saving yet.
265265

266+
if (this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
267+
return true; // a short auto save is configured, treat this as being saved
268+
}
269+
266270
return super.isSaving();
267271
}
268272

0 commit comments

Comments
 (0)