diff options
Diffstat (limited to 'src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.ts')
-rw-r--r-- | src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.ts | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.ts b/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.ts index 2ada834a567..5b620f0b1e8 100644 --- a/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.ts +++ b/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.ts @@ -3,54 +3,23 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { URI } from 'vs/base/common/uri'; -import { SaveSource } from 'vs/workbench/common/editor'; -import { CancellationToken } from 'vs/base/common/cancellation'; import { IFileService } from 'vs/platform/files/common/files'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; import { ILabelService } from 'vs/platform/label/common/label'; import { ILogService } from 'vs/platform/log/common/log'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { WorkingCopyHistoryModel, WorkingCopyHistoryService } from 'vs/workbench/services/workingCopy/common/workingCopyHistoryService'; +import { IWorkingCopyHistoryModelOptions, WorkingCopyHistoryService } from 'vs/workbench/services/workingCopy/common/workingCopyHistoryService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { IWorkingCopyHistoryEntry, IWorkingCopyHistoryService } from 'vs/workbench/services/workingCopy/common/workingCopyHistory'; - -class BrowserWorkingCopyHistoryModel extends WorkingCopyHistoryModel { - - override async addEntry(source: SaveSource, timestamp: number, token: CancellationToken): Promise<IWorkingCopyHistoryEntry> { - const entry = await super.addEntry(source, timestamp, token); - if (!token.isCancellationRequested) { - await this.store(token); // need to store on each add because we do not have long running shutdown support in web - } - - return entry; - } - - override async updateEntry(entry: IWorkingCopyHistoryEntry, properties: { source: SaveSource }, token: CancellationToken): Promise<void> { - await super.updateEntry(entry, properties, token); - if (!token.isCancellationRequested) { - await this.store(token); // need to store on each remove because we do not have long running shutdown support in web - } - } - - override async removeEntry(entry: IWorkingCopyHistoryEntry, token: CancellationToken): Promise<boolean> { - const removed = await super.removeEntry(entry, token); - if (removed && !token.isCancellationRequested) { - await this.store(token); // need to store on each remove because we do not have long running shutdown support in web - } - - return removed; - } -} +import { IWorkingCopyHistoryService } from 'vs/workbench/services/workingCopy/common/workingCopyHistory'; export class BrowserWorkingCopyHistoryService extends WorkingCopyHistoryService { constructor( @IFileService fileService: IFileService, @IRemoteAgentService remoteAgentService: IRemoteAgentService, - @IEnvironmentService environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @IUriIdentityService uriIdentityService: IUriIdentityService, @ILabelService labelService: ILabelService, @ILogService logService: ILogService, @@ -59,8 +28,8 @@ export class BrowserWorkingCopyHistoryService extends WorkingCopyHistoryService super(fileService, remoteAgentService, environmentService, uriIdentityService, labelService, logService, configurationService); } - protected override createModel(resource: URI, historyHome: URI): WorkingCopyHistoryModel { - return new BrowserWorkingCopyHistoryModel(resource, historyHome, this._onDidAddEntry, this._onDidChangeEntry, this._onDidReplaceEntry, this._onDidRemoveEntry, this.fileService, this.labelService, this.logService, this.configurationService); + protected getModelOptions(): IWorkingCopyHistoryModelOptions { + return { flushOnChange: true /* because browsers support no long running shutdown */ }; } } |