@codingame/monaco-vscode-working-copy-service-override 11.1.1 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1 +1,6 @@
1
- export { default } from 'vscode/service-override/workingCopy';
1
+ import type { IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
2
+ interface WorkingCopyServiceOptions {
3
+ storage?: "memory" | "userData" | null;
4
+ }
5
+ export default function getServiceOverride({ storage }?: WorkingCopyServiceOptions): IEditorOverrideServices;
6
+ export {};
package/index.js CHANGED
@@ -1 +1,46 @@
1
- export { default } from './workingCopy.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
3
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
4
+ import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup.service';
5
+ import { WorkingCopyService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyService.js';
6
+ import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
7
+ import { WorkingCopyEditorService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyEditorService.js';
8
+ import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service';
9
+ import { IWorkingCopyHistoryService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service';
10
+ import { BrowserWorkingCopyHistoryService } from './vscode/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.js';
11
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
12
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
13
+ import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
14
+ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
15
+ import { joinPath } from 'vscode/vscode/vs/base/common/resources';
16
+ import { WorkingCopyBackupService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyBackupService.js';
17
+ import getServiceOverride$1 from '@codingame/monaco-vscode-files-service-override';
18
+
19
+ let BrowserWorkingCopyBackupService = class BrowserWorkingCopyBackupService extends WorkingCopyBackupService {
20
+ constructor(memory, contextService, environmentService, fileService, logService) {
21
+ super(memory
22
+ ? undefined
23
+ : joinPath(environmentService.userRoamingDataHome, 'Backups', contextService.getWorkspace().id), fileService, logService);
24
+ }
25
+ };
26
+ BrowserWorkingCopyBackupService = __decorate([
27
+ __param(1, IWorkspaceContextService),
28
+ __param(2, IWorkbenchEnvironmentService),
29
+ __param(3, IFileService),
30
+ __param(4, ILogService)
31
+ ], BrowserWorkingCopyBackupService);
32
+ function getServiceOverride({ storage = 'userData' } = {}) {
33
+ return {
34
+ ...getServiceOverride$1(),
35
+ ...(storage != null
36
+ ? {
37
+ [IWorkingCopyBackupService.toString()]: new SyncDescriptor(BrowserWorkingCopyBackupService, [storage === 'memory'], false)
38
+ }
39
+ : {}),
40
+ [IWorkingCopyService.toString()]: new SyncDescriptor(WorkingCopyService, [], false),
41
+ [IWorkingCopyEditorService.toString()]: new SyncDescriptor(WorkingCopyEditorService, [], false),
42
+ [IWorkingCopyHistoryService.toString()]: new SyncDescriptor(BrowserWorkingCopyHistoryService, [], false)
43
+ };
44
+ }
45
+
46
+ export { getServiceOverride as default };
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-working-copy-service-override",
3
- "version": "11.1.1",
3
+ "version": "12.0.0",
4
+ "private": false,
5
+ "description": "VSCode public API plugged on the monaco editor - working-copy service-override",
4
6
  "keywords": [],
5
7
  "author": {
6
8
  "name": "CodinGame",
@@ -12,8 +14,14 @@
12
14
  "url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
13
15
  },
14
16
  "type": "module",
15
- "private": false,
16
- "description": "VSCode public API plugged on the monaco editor - working-copy service-override",
17
+ "dependencies": {
18
+ "@codingame/monaco-vscode-99f24462-c56d-5407-83fb-2ea9dd33cc8c-common": "12.0.0",
19
+ "@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common": "12.0.0",
20
+ "@codingame/monaco-vscode-files-service-override": "12.0.0",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
22
+ },
23
+ "peerDependencies": {},
24
+ "peerDependenciesMeta": {},
17
25
  "main": "index.js",
18
26
  "module": "index.js",
19
27
  "types": "index.d.ts",
@@ -22,11 +30,12 @@
22
30
  "default": "./index.js"
23
31
  },
24
32
  "./vscode/*": {
25
- "default": "./vscode/src/*.js"
33
+ "default": "./vscode/src/*.js",
34
+ "types": "./vscode/src/*.d.ts"
35
+ },
36
+ "./*": {
37
+ "default": "./*.js",
38
+ "types": "./*.d.ts"
26
39
  }
27
- },
28
- "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@11.1.1",
30
- "@codingame/monaco-vscode-files-service-override": "11.1.1"
31
40
  }
32
41
  }
@@ -0,0 +1,12 @@
1
+ import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
2
+ import { IRemoteAgentService } from "vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
3
+ import { IWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/common/environmentService.service";
4
+ import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
5
+ import { ILabelService } from "vscode/vscode/vs/platform/label/common/label.service";
6
+ import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
7
+ import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
8
+ import { IWorkingCopyHistoryModelOptions, WorkingCopyHistoryService } from "../common/workingCopyHistoryService.js";
9
+ export declare class BrowserWorkingCopyHistoryService extends WorkingCopyHistoryService {
10
+ constructor(fileService: IFileService, remoteAgentService: IRemoteAgentService, environmentService: IWorkbenchEnvironmentService, uriIdentityService: IUriIdentityService, labelService: ILabelService, logService: ILogService, configurationService: IConfigurationService);
11
+ protected getModelOptions(): IWorkingCopyHistoryModelOptions;
12
+ }
@@ -1,4 +1,5 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
3
4
  import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
4
5
  import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
@@ -7,6 +8,7 @@ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.serv
7
8
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
8
9
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
9
10
  import { WorkingCopyHistoryService } from '../common/workingCopyHistoryService.js';
11
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
10
12
  import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
11
13
 
12
14
  let BrowserWorkingCopyHistoryService = class BrowserWorkingCopyHistoryService extends WorkingCopyHistoryService {
@@ -0,0 +1,61 @@
1
+ import { URI } from "vscode/vscode/vs/base/common/uri";
2
+ import { IResolvedWorkingCopyBackup } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup";
3
+ import { IWorkingCopyBackupService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup.service";
4
+ import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
5
+ import { VSBufferReadable, VSBufferReadableStream } from "vscode/vscode/vs/base/common/buffer";
6
+ import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
7
+ import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
8
+ import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
9
+ import { IWorkingCopyBackupMeta, IWorkingCopyIdentifier } from "@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/services/workingCopy/common/workingCopy";
10
+ export declare class WorkingCopyBackupsModel {
11
+ private backupRoot;
12
+ private fileService;
13
+ private readonly cache;
14
+ static create(backupRoot: URI, fileService: IFileService): Promise<WorkingCopyBackupsModel>;
15
+ private constructor();
16
+ private resolve;
17
+ add(resource: URI, versionId?: number, meta?: IWorkingCopyBackupMeta): void;
18
+ update(resource: URI, meta?: IWorkingCopyBackupMeta): void;
19
+ count(): number;
20
+ has(resource: URI, versionId?: number, meta?: IWorkingCopyBackupMeta): boolean;
21
+ get(): URI[];
22
+ remove(resource: URI): void;
23
+ clear(): void;
24
+ }
25
+ export declare abstract class WorkingCopyBackupService extends Disposable implements IWorkingCopyBackupService {
26
+ protected fileService: IFileService;
27
+ private readonly logService;
28
+ readonly _serviceBrand: undefined;
29
+ private impl;
30
+ constructor(backupWorkspaceHome: URI | undefined, fileService: IFileService, logService: ILogService);
31
+ private initialize;
32
+ reinitialize(backupWorkspaceHome: URI | undefined): void;
33
+ hasBackups(): Promise<boolean>;
34
+ hasBackupSync(identifier: IWorkingCopyIdentifier, versionId?: number, meta?: IWorkingCopyBackupMeta): boolean;
35
+ backup(identifier: IWorkingCopyIdentifier, content?: VSBufferReadableStream | VSBufferReadable, versionId?: number, meta?: IWorkingCopyBackupMeta, token?: CancellationToken): Promise<void>;
36
+ discardBackup(identifier: IWorkingCopyIdentifier, token?: CancellationToken): Promise<void>;
37
+ discardBackups(filter?: {
38
+ except: IWorkingCopyIdentifier[];
39
+ }): Promise<void>;
40
+ getBackups(): Promise<IWorkingCopyIdentifier[]>;
41
+ resolve<T extends IWorkingCopyBackupMeta>(identifier: IWorkingCopyIdentifier): Promise<IResolvedWorkingCopyBackup<T> | undefined>;
42
+ toBackupResource(identifier: IWorkingCopyIdentifier): URI;
43
+ joinBackups(): Promise<void>;
44
+ }
45
+ export declare class InMemoryWorkingCopyBackupService extends Disposable implements IWorkingCopyBackupService {
46
+ readonly _serviceBrand: undefined;
47
+ private backups;
48
+ constructor();
49
+ hasBackups(): Promise<boolean>;
50
+ hasBackupSync(identifier: IWorkingCopyIdentifier, versionId?: number): boolean;
51
+ backup(identifier: IWorkingCopyIdentifier, content?: VSBufferReadable | VSBufferReadableStream, versionId?: number, meta?: IWorkingCopyBackupMeta, token?: CancellationToken): Promise<void>;
52
+ resolve<T extends IWorkingCopyBackupMeta>(identifier: IWorkingCopyIdentifier): Promise<IResolvedWorkingCopyBackup<T> | undefined>;
53
+ getBackups(): Promise<IWorkingCopyIdentifier[]>;
54
+ discardBackup(identifier: IWorkingCopyIdentifier): Promise<void>;
55
+ discardBackups(filter?: {
56
+ except: IWorkingCopyIdentifier[];
57
+ }): Promise<void>;
58
+ toBackupResource(identifier: IWorkingCopyIdentifier): URI;
59
+ joinBackups(): Promise<void>;
60
+ }
61
+ export declare function hashIdentifier(identifier: IWorkingCopyIdentifier): string;
@@ -1,9 +1,11 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { joinPath } from 'vscode/vscode/vs/base/common/resources';
3
4
  import { URI } from 'vscode/vscode/vs/base/common/uri';
4
5
  import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
5
6
  import { deepClone, equals } from 'vscode/vscode/vs/base/common/objects';
6
7
  import { Promises, ResourceQueue } from 'vscode/vscode/vs/base/common/async';
8
+ import { FileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
7
9
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
8
10
  import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
9
11
  import { isReadableStream, peekStream } from 'vscode/vscode/vs/base/common/stream';
@@ -13,7 +15,7 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
13
15
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
14
16
  import { hash } from 'vscode/vscode/vs/base/common/hash';
15
17
  import { isEmptyObject } from 'vscode/vscode/vs/base/common/types';
16
- import { NO_TYPE_ID } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopy';
18
+ import { NO_TYPE_ID } from '@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/services/workingCopy/common/workingCopy';
17
19
 
18
20
  var WorkingCopyBackupServiceImpl_1;
19
21
  class WorkingCopyBackupsModel {
@@ -255,7 +257,7 @@ let WorkingCopyBackupServiceImpl = class WorkingCopyBackupServiceImpl extends Di
255
257
  await this.fileService.del(backupResource, { recursive: true });
256
258
  }
257
259
  catch (error) {
258
- if (error.fileOperationResult !== 1 ) {
260
+ if (error.fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) {
259
261
  throw error;
260
262
  }
261
263
  }
@@ -0,0 +1,22 @@
1
+ import { IEditorIdentifier } from "vscode/vscode/vs/workbench/common/editor";
2
+ import { EditorInput } from "vscode/vscode/vs/workbench/common/editor/editorInput";
3
+ import { IWorkingCopy, IWorkingCopyIdentifier } from "@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/services/workingCopy/common/workingCopy";
4
+ import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
5
+ import { IEditorService } from "vscode/vscode/vs/workbench/services/editor/common/editorService.service";
6
+ import { IWorkingCopyEditorService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service";
7
+ export interface IWorkingCopyEditorHandler {
8
+ handles(workingCopy: IWorkingCopyIdentifier): boolean | Promise<boolean>;
9
+ isOpen(workingCopy: IWorkingCopyIdentifier, editor: EditorInput): boolean;
10
+ createEditor(workingCopy: IWorkingCopyIdentifier): EditorInput | Promise<EditorInput>;
11
+ }
12
+ export declare class WorkingCopyEditorService extends Disposable implements IWorkingCopyEditorService {
13
+ private readonly editorService;
14
+ readonly _serviceBrand: undefined;
15
+ private readonly _onDidRegisterHandler;
16
+ readonly onDidRegisterHandler: import("vscode/vscode/vs/base/common/event").Event<IWorkingCopyEditorHandler>;
17
+ private readonly handlers;
18
+ constructor(editorService: IEditorService);
19
+ registerHandler(handler: IWorkingCopyEditorHandler): IDisposable;
20
+ findEditor(workingCopy: IWorkingCopy): IEditorIdentifier | undefined;
21
+ private isOpen;
22
+ }
@@ -1,5 +1,8 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
4
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
5
+ import { EditorsOrder } from 'vscode/vscode/vs/workbench/common/editor';
3
6
  import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
7
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
5
8
  import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
@@ -18,7 +21,7 @@ let WorkingCopyEditorService = class WorkingCopyEditorService extends Disposable
18
21
  return toDisposable(() => this.handlers.delete(handler));
19
22
  }
20
23
  findEditor(workingCopy) {
21
- for (const editorIdentifier of this.editorService.getEditors(0 )) {
24
+ for (const editorIdentifier of this.editorService.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE)) {
22
25
  if (this.isOpen(workingCopy, editorIdentifier.editor)) {
23
26
  return editorIdentifier;
24
27
  }
@@ -0,0 +1,22 @@
1
+ import { URI } from "vscode/vscode/vs/base/common/uri";
2
+ import { SaveSource } from "vscode/vscode/vs/workbench/common/editor";
3
+ export interface IWorkingCopyHistoryEvent {
4
+ readonly entry: IWorkingCopyHistoryEntry;
5
+ }
6
+ export interface IWorkingCopyHistoryEntry {
7
+ readonly id: string;
8
+ readonly workingCopy: {
9
+ readonly resource: URI;
10
+ readonly name: string;
11
+ };
12
+ readonly location: URI;
13
+ timestamp: number;
14
+ source: SaveSource;
15
+ sourceDescription: string | undefined;
16
+ }
17
+ export interface IWorkingCopyHistoryEntryDescriptor {
18
+ readonly resource: URI;
19
+ readonly timestamp?: number;
20
+ readonly source?: SaveSource;
21
+ }
22
+ export declare const MAX_PARALLEL_HISTORY_IO_OPS = 20;
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  const MAX_PARALLEL_HISTORY_IO_OPS = 20;
2
4
 
3
5
  export { MAX_PARALLEL_HISTORY_IO_OPS };
@@ -0,0 +1,123 @@
1
+ import { Event, Emitter } from "vscode/vscode/vs/base/common/event";
2
+ import { ILifecycleService } from "vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
3
+ import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
4
+ import { IWorkingCopyHistoryEntry, IWorkingCopyHistoryEntryDescriptor, IWorkingCopyHistoryEvent } from "./workingCopyHistory.js";
5
+ import { IWorkingCopyHistoryService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service";
6
+ import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
7
+ import { IRemoteAgentService } from "vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
8
+ import { URI } from "vscode/vscode/vs/base/common/uri";
9
+ import { IWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/common/environmentService.service";
10
+ import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
11
+ import { ResourceMap } from "vscode/vscode/vs/base/common/map";
12
+ import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
13
+ import { ILabelService } from "vscode/vscode/vs/platform/label/common/label.service";
14
+ import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
15
+ import { SaveSource } from "vscode/vscode/vs/workbench/common/editor";
16
+ import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
17
+ export interface IWorkingCopyHistoryModelOptions {
18
+ flushOnChange: boolean;
19
+ }
20
+ export declare class WorkingCopyHistoryModel {
21
+ private readonly historyHome;
22
+ private readonly entryAddedEmitter;
23
+ private readonly entryChangedEmitter;
24
+ private readonly entryReplacedEmitter;
25
+ private readonly entryRemovedEmitter;
26
+ private readonly options;
27
+ private readonly fileService;
28
+ private readonly labelService;
29
+ private readonly logService;
30
+ private readonly configurationService;
31
+ static readonly ENTRIES_FILE = "entries.json";
32
+ private static readonly FILE_SAVED_SOURCE;
33
+ private static readonly SETTINGS;
34
+ private entries;
35
+ private whenResolved;
36
+ private workingCopyResource;
37
+ private workingCopyName;
38
+ private historyEntriesFolder;
39
+ private historyEntriesListingFile;
40
+ private historyEntriesNameMatcher;
41
+ private versionId;
42
+ private storedVersionId;
43
+ private readonly storeLimiter;
44
+ constructor(workingCopyResource: URI, historyHome: URI, entryAddedEmitter: Emitter<IWorkingCopyHistoryEvent>, entryChangedEmitter: Emitter<IWorkingCopyHistoryEvent>, entryReplacedEmitter: Emitter<IWorkingCopyHistoryEvent>, entryRemovedEmitter: Emitter<IWorkingCopyHistoryEvent>, options: IWorkingCopyHistoryModelOptions, fileService: IFileService, labelService: ILabelService, logService: ILogService, configurationService: IConfigurationService);
45
+ private setWorkingCopy;
46
+ private toHistoryEntriesFolder;
47
+ addEntry(source: string | undefined, sourceDescription: string | undefined, timestamp: number | undefined, token: CancellationToken): Promise<IWorkingCopyHistoryEntry>;
48
+ private doAddEntry;
49
+ private doReplaceEntry;
50
+ removeEntry(entry: IWorkingCopyHistoryEntry, token: CancellationToken): Promise<boolean>;
51
+ updateEntry(entry: IWorkingCopyHistoryEntry, properties: {
52
+ source: SaveSource;
53
+ }, token: CancellationToken): Promise<void>;
54
+ getEntries(): Promise<readonly IWorkingCopyHistoryEntry[]>;
55
+ hasEntries(skipResolve: boolean): Promise<boolean>;
56
+ private resolveEntriesOnce;
57
+ private doResolveEntries;
58
+ private resolveEntriesFromDisk;
59
+ moveEntries(target: WorkingCopyHistoryModel, source: SaveSource, token: CancellationToken): Promise<void>;
60
+ store(token: CancellationToken): Promise<void>;
61
+ private shouldStore;
62
+ private doStore;
63
+ private cleanUpEntries;
64
+ private deleteEntry;
65
+ private writeEntriesFile;
66
+ private readEntriesFile;
67
+ private readEntriesFolder;
68
+ private isFileNotFound;
69
+ private traceError;
70
+ }
71
+ export declare abstract class WorkingCopyHistoryService extends Disposable implements IWorkingCopyHistoryService {
72
+ protected readonly fileService: IFileService;
73
+ protected readonly remoteAgentService: IRemoteAgentService;
74
+ protected readonly environmentService: IWorkbenchEnvironmentService;
75
+ protected readonly uriIdentityService: IUriIdentityService;
76
+ protected readonly labelService: ILabelService;
77
+ protected readonly logService: ILogService;
78
+ protected readonly configurationService: IConfigurationService;
79
+ private static readonly FILE_MOVED_SOURCE;
80
+ private static readonly FILE_RENAMED_SOURCE;
81
+ readonly _serviceBrand: undefined;
82
+ protected readonly _onDidAddEntry: Emitter<IWorkingCopyHistoryEvent>;
83
+ readonly onDidAddEntry: Event<IWorkingCopyHistoryEvent>;
84
+ protected readonly _onDidChangeEntry: Emitter<IWorkingCopyHistoryEvent>;
85
+ readonly onDidChangeEntry: Event<IWorkingCopyHistoryEvent>;
86
+ protected readonly _onDidReplaceEntry: Emitter<IWorkingCopyHistoryEvent>;
87
+ readonly onDidReplaceEntry: Event<IWorkingCopyHistoryEvent>;
88
+ private readonly _onDidMoveEntries;
89
+ readonly onDidMoveEntries: Event<void>;
90
+ protected readonly _onDidRemoveEntry: Emitter<IWorkingCopyHistoryEvent>;
91
+ readonly onDidRemoveEntry: Event<IWorkingCopyHistoryEvent>;
92
+ private readonly _onDidRemoveEntries;
93
+ readonly onDidRemoveEntries: Event<void>;
94
+ private readonly localHistoryHome;
95
+ protected readonly models: ResourceMap<WorkingCopyHistoryModel>;
96
+ constructor(fileService: IFileService, remoteAgentService: IRemoteAgentService, environmentService: IWorkbenchEnvironmentService, uriIdentityService: IUriIdentityService, labelService: ILabelService, logService: ILogService, configurationService: IConfigurationService);
97
+ private resolveLocalHistoryHome;
98
+ moveEntries(source: URI, target: URI): Promise<URI[]>;
99
+ private doMoveEntries;
100
+ addEntry({ resource, source, timestamp }: IWorkingCopyHistoryEntryDescriptor, token: CancellationToken): Promise<IWorkingCopyHistoryEntry | undefined>;
101
+ updateEntry(entry: IWorkingCopyHistoryEntry, properties: {
102
+ source: SaveSource;
103
+ }, token: CancellationToken): Promise<void>;
104
+ removeEntry(entry: IWorkingCopyHistoryEntry, token: CancellationToken): Promise<boolean>;
105
+ removeAll(token: CancellationToken): Promise<void>;
106
+ getEntries(resource: URI, token: CancellationToken): Promise<readonly IWorkingCopyHistoryEntry[]>;
107
+ getAll(token: CancellationToken): Promise<readonly URI[]>;
108
+ private getModel;
109
+ protected abstract getModelOptions(): IWorkingCopyHistoryModelOptions;
110
+ }
111
+ export declare class NativeWorkingCopyHistoryService extends WorkingCopyHistoryService {
112
+ private readonly lifecycleService;
113
+ private static readonly STORE_ALL_INTERVAL;
114
+ private readonly isRemotelyStored;
115
+ private readonly storeAllCts;
116
+ private readonly storeAllScheduler;
117
+ constructor(fileService: IFileService, remoteAgentService: IRemoteAgentService, environmentService: IWorkbenchEnvironmentService, uriIdentityService: IUriIdentityService, labelService: ILabelService, lifecycleService: ILifecycleService, logService: ILogService, configurationService: IConfigurationService);
118
+ private registerListeners;
119
+ protected getModelOptions(): IWorkingCopyHistoryModelOptions;
120
+ private onWillShutdown;
121
+ private onDidChangeModels;
122
+ private storeAll;
123
+ }
@@ -1,14 +1,16 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { localize } from 'vscode/vscode/vs/nls';
3
4
  import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
4
5
  import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
5
6
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
6
7
  import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
8
+ import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
7
9
  import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
8
10
  import { WorkingCopyHistoryTracker } from './workingCopyHistoryTracker.js';
9
11
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
10
12
  import { MAX_PARALLEL_HISTORY_IO_OPS } from './workingCopyHistory.js';
11
- import { FileOperationError } from 'vscode/vscode/vs/platform/files/common/files';
13
+ import { FileOperationError, FileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
12
14
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
13
15
  import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
14
16
  import { URI } from 'vscode/vscode/vs/base/common/uri';
@@ -31,7 +33,7 @@ import { escapeRegExpCharacters } from 'vscode/vscode/vs/base/common/strings';
31
33
  var WorkingCopyHistoryService_1, NativeWorkingCopyHistoryService_1;
32
34
  class WorkingCopyHistoryModel {
33
35
  static { this.ENTRIES_FILE = 'entries.json'; }
34
- static { this.FILE_SAVED_SOURCE = SaveSourceRegistry.registerSource('default.source', ( localize(8701, "File Saved"))); }
36
+ static { this.FILE_SAVED_SOURCE = SaveSourceRegistry.registerSource('default.source', ( localize(12110, "File Saved"))); }
35
37
  static { this.SETTINGS = {
36
38
  MAX_ENTRIES: 'workbench.localHistory.maxFileEntries',
37
39
  MERGE_PERIOD: 'workbench.localHistory.mergeWindow'
@@ -56,20 +58,20 @@ class WorkingCopyHistoryModel {
56
58
  this.historyEntriesNameMatcher = undefined;
57
59
  this.versionId = 0;
58
60
  this.storedVersionId = this.versionId;
59
- this.storeLimiter = ( (new Limiter(1)));
61
+ this.storeLimiter = ( new Limiter(1));
60
62
  this.setWorkingCopy(workingCopyResource);
61
63
  }
62
64
  setWorkingCopy(workingCopyResource) {
63
65
  this.workingCopyResource = workingCopyResource;
64
66
  this.workingCopyName = this.labelService.getUriBasenameLabel(workingCopyResource);
65
- this.historyEntriesNameMatcher = ( (new RegExp(`[A-Za-z0-9]{4}${escapeRegExpCharacters(extname(workingCopyResource))}`)));
67
+ this.historyEntriesNameMatcher = ( new RegExp(`[A-Za-z0-9]{4}${escapeRegExpCharacters(extname(workingCopyResource))}`));
66
68
  this.historyEntriesFolder = this.toHistoryEntriesFolder(this.historyHome, workingCopyResource);
67
69
  this.historyEntriesListingFile = joinPath(this.historyEntriesFolder, WorkingCopyHistoryModel.ENTRIES_FILE);
68
70
  this.entries = [];
69
71
  this.whenResolved = undefined;
70
72
  }
71
73
  toHistoryEntriesFolder(historyHome, workingCopyResource) {
72
- return joinPath(historyHome, ( (hash(( (workingCopyResource.toString()))).toString(16))));
74
+ return joinPath(historyHome, ( hash(( workingCopyResource.toString())).toString(16)));
73
75
  }
74
76
  async addEntry(source = WorkingCopyHistoryModel.FILE_SAVED_SOURCE, sourceDescription = undefined, timestamp = Date.now(), token) {
75
77
  let entryToReplace = undefined;
@@ -181,7 +183,7 @@ class WorkingCopyHistoryModel {
181
183
  for (const entry of this.entries) {
182
184
  entries.set(entry.id, entry);
183
185
  }
184
- this.entries = Array.from(( (entries.values()))).sort((entryA, entryB) => entryA.timestamp - entryB.timestamp);
186
+ this.entries = Array.from(( entries.values())).sort((entryA, entryB) => entryA.timestamp - entryB.timestamp);
185
187
  }
186
188
  async resolveEntriesFromDisk() {
187
189
  const workingCopyResource = assertIsDefined(this.workingCopyResource);
@@ -190,7 +192,7 @@ class WorkingCopyHistoryModel {
190
192
  this.readEntriesFile(),
191
193
  this.readEntriesFolder()
192
194
  ]);
193
- const entries = ( (new Map()));
195
+ const entries = ( new Map());
194
196
  if (entryStats) {
195
197
  for (const entryStat of entryStats) {
196
198
  entries.set(entryStat.name, {
@@ -324,15 +326,15 @@ class WorkingCopyHistoryModel {
324
326
  const historyEntriesListingFile = assertIsDefined(this.historyEntriesListingFile);
325
327
  const serializedModel = {
326
328
  version: 1,
327
- resource: ( (workingCopyResource.toString())),
328
- entries: ( (this.entries.map(entry => {
329
+ resource: ( workingCopyResource.toString()),
330
+ entries: ( this.entries.map(entry => {
329
331
  return {
330
332
  id: entry.id,
331
333
  source: entry.source !== WorkingCopyHistoryModel.FILE_SAVED_SOURCE ? entry.source : undefined,
332
334
  sourceDescription: entry.sourceDescription,
333
335
  timestamp: entry.timestamp
334
336
  };
335
- })))
337
+ }))
336
338
  };
337
339
  await this.fileService.writeFile(historyEntriesListingFile, VSBuffer.fromString(JSON.stringify(serializedModel)));
338
340
  }
@@ -340,7 +342,7 @@ class WorkingCopyHistoryModel {
340
342
  const historyEntriesListingFile = assertIsDefined(this.historyEntriesListingFile);
341
343
  let serializedModel = undefined;
342
344
  try {
343
- serializedModel = JSON.parse(( ((await this.fileService.readFile(historyEntriesListingFile)).value.toString())));
345
+ serializedModel = JSON.parse(( (await this.fileService.readFile(historyEntriesListingFile)).value.toString()));
344
346
  }
345
347
  catch (error) {
346
348
  if (!this.isFileNotFound(error)) {
@@ -369,7 +371,7 @@ class WorkingCopyHistoryModel {
369
371
  );
370
372
  }
371
373
  isFileNotFound(error) {
372
- return error instanceof FileOperationError && error.fileOperationResult === 1 ;
374
+ return error instanceof FileOperationError && error.fileOperationResult === FileOperationResult.FILE_NOT_FOUND;
373
375
  }
374
376
  traceError(error) {
375
377
  this.logService.trace('[Working Copy History Service]', error);
@@ -377,8 +379,8 @@ class WorkingCopyHistoryModel {
377
379
  }
378
380
  let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposable {
379
381
  static { WorkingCopyHistoryService_1 = this; }
380
- static { this.FILE_MOVED_SOURCE = SaveSourceRegistry.registerSource('moved.source', ( localize(8702, "File Moved"))); }
381
- static { this.FILE_RENAMED_SOURCE = SaveSourceRegistry.registerSource('renamed.source', ( localize(8703, "File Renamed"))); }
382
+ static { this.FILE_MOVED_SOURCE = SaveSourceRegistry.registerSource('moved.source', ( localize(12111, "File Moved"))); }
383
+ static { this.FILE_RENAMED_SOURCE = SaveSourceRegistry.registerSource('renamed.source', ( localize(12112, "File Renamed"))); }
382
384
  constructor(fileService, remoteAgentService, environmentService, uriIdentityService, labelService, logService, configurationService) {
383
385
  super();
384
386
  this.fileService = fileService;
@@ -388,20 +390,20 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
388
390
  this.labelService = labelService;
389
391
  this.logService = logService;
390
392
  this.configurationService = configurationService;
391
- this._onDidAddEntry = this._register(( (new Emitter())));
393
+ this._onDidAddEntry = this._register(( new Emitter()));
392
394
  this.onDidAddEntry = this._onDidAddEntry.event;
393
- this._onDidChangeEntry = this._register(( (new Emitter())));
395
+ this._onDidChangeEntry = this._register(( new Emitter()));
394
396
  this.onDidChangeEntry = this._onDidChangeEntry.event;
395
- this._onDidReplaceEntry = this._register(( (new Emitter())));
397
+ this._onDidReplaceEntry = this._register(( new Emitter()));
396
398
  this.onDidReplaceEntry = this._onDidReplaceEntry.event;
397
- this._onDidMoveEntries = this._register(( (new Emitter())));
399
+ this._onDidMoveEntries = this._register(( new Emitter()));
398
400
  this.onDidMoveEntries = this._onDidMoveEntries.event;
399
- this._onDidRemoveEntry = this._register(( (new Emitter())));
401
+ this._onDidRemoveEntry = this._register(( new Emitter()));
400
402
  this.onDidRemoveEntry = this._onDidRemoveEntry.event;
401
- this._onDidRemoveEntries = this._register(( (new Emitter())));
403
+ this._onDidRemoveEntries = this._register(( new Emitter()));
402
404
  this.onDidRemoveEntries = this._onDidRemoveEntries.event;
403
- this.localHistoryHome = ( (new DeferredPromise()));
404
- this.models = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
405
+ this.localHistoryHome = ( new DeferredPromise());
406
+ this.models = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
405
407
  this.resolveLocalHistoryHome();
406
408
  }
407
409
  async resolveLocalHistoryHome() {
@@ -421,7 +423,7 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
421
423
  this.localHistoryHome.complete(historyHome);
422
424
  }
423
425
  async moveEntries(source, target) {
424
- const limiter = ( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
426
+ const limiter = ( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS));
425
427
  const promises = [];
426
428
  for (const [resource, model] of this.models) {
427
429
  if (!this.uriIdentityService.extUri.isEqualOrParent(resource, source)) {
@@ -504,7 +506,7 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
504
506
  if (token.isCancellationRequested) {
505
507
  return [];
506
508
  }
507
- const all = ( (new ResourceMap()));
509
+ const all = ( new ResourceMap());
508
510
  for (const [resource, model] of this.models) {
509
511
  const hasInMemoryEntries = await model.hasEntries(true );
510
512
  if (hasInMemoryEntries) {
@@ -514,7 +516,7 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
514
516
  try {
515
517
  const resolvedHistoryHome = await this.fileService.resolve(historyHome);
516
518
  if (resolvedHistoryHome.children) {
517
- const limiter = ( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
519
+ const limiter = ( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS));
518
520
  const promises = [];
519
521
  for (const child of resolvedHistoryHome.children) {
520
522
  promises.push(limiter.queue(async () => {
@@ -522,9 +524,9 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
522
524
  return;
523
525
  }
524
526
  try {
525
- const serializedModel = JSON.parse(( ((await this.fileService.readFile(joinPath(child.resource, WorkingCopyHistoryModel.ENTRIES_FILE))).value.toString())));
527
+ const serializedModel = JSON.parse(( (await this.fileService.readFile(joinPath(child.resource, WorkingCopyHistoryModel.ENTRIES_FILE))).value.toString()));
526
528
  if (serializedModel.entries.length > 0) {
527
- all.set(( (URI.parse(serializedModel.resource))), true);
529
+ all.set(( URI.parse(serializedModel.resource)), true);
528
530
  }
529
531
  }
530
532
  catch (error) {
@@ -536,13 +538,13 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
536
538
  }
537
539
  catch (error) {
538
540
  }
539
- return Array.from(( (all.keys())));
541
+ return Array.from(( all.keys()));
540
542
  }
541
543
  async getModel(resource) {
542
544
  const historyHome = await this.localHistoryHome.p;
543
545
  let model = this.models.get(resource);
544
546
  if (!model) {
545
- model = ( (new WorkingCopyHistoryModel(
547
+ model = ( new WorkingCopyHistoryModel(
546
548
  resource,
547
549
  historyHome,
548
550
  this._onDidAddEntry,
@@ -554,21 +556,21 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
554
556
  this.labelService,
555
557
  this.logService,
556
558
  this.configurationService
557
- )));
559
+ ));
558
560
  this.models.set(resource, model);
559
561
  }
560
562
  return model;
561
563
  }
562
564
  };
563
- WorkingCopyHistoryService = WorkingCopyHistoryService_1 = ( (__decorate([
564
- ( (__param(0, IFileService))),
565
- ( (__param(1, IRemoteAgentService))),
566
- ( (__param(2, IWorkbenchEnvironmentService))),
567
- ( (__param(3, IUriIdentityService))),
568
- ( (__param(4, ILabelService))),
569
- ( (__param(5, ILogService))),
570
- ( (__param(6, IConfigurationService)))
571
- ], WorkingCopyHistoryService)));
565
+ WorkingCopyHistoryService = WorkingCopyHistoryService_1 = ( __decorate([
566
+ ( __param(0, IFileService)),
567
+ ( __param(1, IRemoteAgentService)),
568
+ ( __param(2, IWorkbenchEnvironmentService)),
569
+ ( __param(3, IUriIdentityService)),
570
+ ( __param(4, ILabelService)),
571
+ ( __param(5, ILogService)),
572
+ ( __param(6, IConfigurationService))
573
+ ], WorkingCopyHistoryService));
572
574
  let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService extends WorkingCopyHistoryService {
573
575
  static { NativeWorkingCopyHistoryService_1 = this; }
574
576
  static { this.STORE_ALL_INTERVAL = 5 * 60 * 1000; }
@@ -576,11 +578,11 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
576
578
  super(fileService, remoteAgentService, environmentService, uriIdentityService, labelService, logService, configurationService);
577
579
  this.lifecycleService = lifecycleService;
578
580
  this.isRemotelyStored = typeof this.environmentService.remoteAuthority === 'string';
579
- this.storeAllCts = this._register(( (new CancellationTokenSource())));
580
- this.storeAllScheduler = this._register(( (new RunOnceScheduler(
581
+ this.storeAllCts = this._register(( new CancellationTokenSource()));
582
+ this.storeAllScheduler = this._register(( new RunOnceScheduler(
581
583
  () => this.storeAll(this.storeAllCts.token),
582
584
  NativeWorkingCopyHistoryService_1.STORE_ALL_INTERVAL
583
- ))));
585
+ )));
584
586
  this.registerListeners();
585
587
  }
586
588
  registerListeners() {
@@ -595,7 +597,7 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
595
597
  onWillShutdown(e) {
596
598
  this.storeAllScheduler.dispose();
597
599
  this.storeAllCts.dispose(true);
598
- e.join(this.storeAll(e.token), { id: 'join.workingCopyHistory', label: ( localize(8704, "Saving local history")) });
600
+ e.join(this.storeAll(e.token), { id: 'join.workingCopyHistory', label: ( localize(12113, "Saving local history")) });
599
601
  }
600
602
  onDidChangeModels() {
601
603
  if (!this.storeAllScheduler.isScheduled()) {
@@ -603,9 +605,9 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
603
605
  }
604
606
  }
605
607
  async storeAll(token) {
606
- const limiter = ( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
608
+ const limiter = ( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS));
607
609
  const promises = [];
608
- const models = Array.from(( (this.models.values())));
610
+ const models = Array.from(( this.models.values()));
609
611
  for (const model of models) {
610
612
  promises.push(limiter.queue(async () => {
611
613
  if (token.isCancellationRequested) {
@@ -622,16 +624,16 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
622
624
  await Promise.all(promises);
623
625
  }
624
626
  };
625
- NativeWorkingCopyHistoryService = NativeWorkingCopyHistoryService_1 = ( (__decorate([
626
- ( (__param(0, IFileService))),
627
- ( (__param(1, IRemoteAgentService))),
628
- ( (__param(2, IWorkbenchEnvironmentService))),
629
- ( (__param(3, IUriIdentityService))),
630
- ( (__param(4, ILabelService))),
631
- ( (__param(5, ILifecycleService))),
632
- ( (__param(6, ILogService))),
633
- ( (__param(7, IConfigurationService)))
634
- ], NativeWorkingCopyHistoryService)));
635
- ( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(WorkingCopyHistoryTracker, 3 );
627
+ NativeWorkingCopyHistoryService = NativeWorkingCopyHistoryService_1 = ( __decorate([
628
+ ( __param(0, IFileService)),
629
+ ( __param(1, IRemoteAgentService)),
630
+ ( __param(2, IWorkbenchEnvironmentService)),
631
+ ( __param(3, IUriIdentityService)),
632
+ ( __param(4, ILabelService)),
633
+ ( __param(5, ILifecycleService)),
634
+ ( __param(6, ILogService)),
635
+ ( __param(7, IConfigurationService))
636
+ ], NativeWorkingCopyHistoryService));
637
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(WorkingCopyHistoryTracker, LifecyclePhase.Restored);
636
638
 
637
639
  export { NativeWorkingCopyHistoryService, WorkingCopyHistoryModel, WorkingCopyHistoryService };
@@ -0,0 +1,37 @@
1
+ import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
2
+ import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
3
+ import { IUndoRedoService } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo.service";
4
+ import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
5
+ import { IWorkbenchContribution } from "vscode/vscode/vs/workbench/common/contributions";
6
+ import { IPathService } from "vscode/vscode/vs/workbench/services/path/common/pathService.service";
7
+ import { IWorkingCopyHistoryService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service";
8
+ import { IWorkingCopyService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service";
9
+ import { IWorkspaceContextService } from "vscode/vscode/vs/platform/workspace/common/workspace.service";
10
+ import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
11
+ export declare class WorkingCopyHistoryTracker extends Disposable implements IWorkbenchContribution {
12
+ private readonly workingCopyService;
13
+ private readonly workingCopyHistoryService;
14
+ private readonly uriIdentityService;
15
+ private readonly pathService;
16
+ private readonly configurationService;
17
+ private readonly undoRedoService;
18
+ private readonly contextService;
19
+ private readonly fileService;
20
+ private static readonly SETTINGS;
21
+ private static readonly UNDO_REDO_SAVE_SOURCE;
22
+ private readonly limiter;
23
+ private readonly resourceExcludeMatcher;
24
+ private readonly pendingAddHistoryEntryOperations;
25
+ private readonly workingCopyContentVersion;
26
+ private readonly historyEntryContentVersion;
27
+ constructor(workingCopyService: IWorkingCopyService, workingCopyHistoryService: IWorkingCopyHistoryService, uriIdentityService: IUriIdentityService, pathService: IPathService, configurationService: IConfigurationService, undoRedoService: IUndoRedoService, contextService: IWorkspaceContextService, fileService: IFileService);
28
+ private registerListeners;
29
+ private onDidRunFileOperation;
30
+ private onDidChangeContent;
31
+ private getContentVersion;
32
+ private onDidSave;
33
+ private resolveSourceFromUndoRedo;
34
+ private shouldTrackHistoryFromSaveEvent;
35
+ private shouldTrackHistoryFromFileOperationEvent;
36
+ private shouldTrackHistory;
37
+ }
@@ -1,4 +1,5 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { localize } from 'vscode/vscode/vs/nls';
3
4
  import { Limiter, GlobalIdleValue } from 'vscode/vscode/vs/base/common/async';
4
5
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
@@ -9,13 +10,14 @@ import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undo
9
10
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
10
11
  import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
11
12
  import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService.service';
12
- import { isStoredFileWorkingCopySaveEvent } from 'vscode/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
13
+ import { isStoredFileWorkingCopySaveEvent } from '@codingame/monaco-vscode-99f24462-c56d-5407-83fb-2ea9dd33cc8c-common/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
13
14
  import { MAX_PARALLEL_HISTORY_IO_OPS } from './workingCopyHistory.js';
14
15
  import { IWorkingCopyHistoryService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service';
15
16
  import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
16
17
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
17
- import { ResourceGlobMatcher } from 'vscode/vscode/vs/workbench/common/resources';
18
+ import { ResourceGlobMatcher } from '@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/common/resources';
18
19
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
20
+ import { FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
19
21
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
20
22
 
21
23
  var WorkingCopyHistoryTracker_1;
@@ -26,7 +28,7 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
26
28
  SIZE_LIMIT: 'workbench.localHistory.maxFileSize',
27
29
  EXCLUDES: 'workbench.localHistory.exclude'
28
30
  }; }
29
- static { this.UNDO_REDO_SAVE_SOURCE = SaveSourceRegistry.registerSource('undoRedo.source', ( localize(11096, "Undo / Redo"))); }
31
+ static { this.UNDO_REDO_SAVE_SOURCE = SaveSourceRegistry.registerSource('undoRedo.source', ( localize(12114, "Undo / Redo"))); }
30
32
  constructor(workingCopyService, workingCopyHistoryService, uriIdentityService, pathService, configurationService, undoRedoService, contextService, fileService) {
31
33
  super();
32
34
  this.workingCopyService = workingCopyService;
@@ -37,19 +39,19 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
37
39
  this.undoRedoService = undoRedoService;
38
40
  this.contextService = contextService;
39
41
  this.fileService = fileService;
40
- this.limiter = this._register(( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS))));
41
- this.resourceExcludeMatcher = this._register(( (new GlobalIdleValue(() => {
42
- const matcher = this._register(( (new ResourceGlobMatcher(
42
+ this.limiter = this._register(( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
43
+ this.resourceExcludeMatcher = this._register(( new GlobalIdleValue(() => {
44
+ const matcher = this._register(( new ResourceGlobMatcher(
43
45
  root => this.configurationService.getValue(WorkingCopyHistoryTracker_1.SETTINGS.EXCLUDES, { resource: root }),
44
46
  event => event.affectsConfiguration(WorkingCopyHistoryTracker_1.SETTINGS.EXCLUDES),
45
47
  this.contextService,
46
48
  this.configurationService
47
- ))));
49
+ )));
48
50
  return matcher;
49
- }))));
50
- this.pendingAddHistoryEntryOperations = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
51
- this.workingCopyContentVersion = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
52
- this.historyEntryContentVersion = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
51
+ })));
52
+ this.pendingAddHistoryEntryOperations = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
53
+ this.workingCopyContentVersion = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
54
+ this.historyEntryContentVersion = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
53
55
  this.registerListeners();
54
56
  }
55
57
  registerListeners() {
@@ -85,7 +87,7 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
85
87
  return;
86
88
  }
87
89
  this.pendingAddHistoryEntryOperations.get(e.workingCopy.resource)?.dispose(true);
88
- const cts = ( (new CancellationTokenSource()));
90
+ const cts = ( new CancellationTokenSource());
89
91
  this.pendingAddHistoryEntryOperations.set(e.workingCopy.resource, cts);
90
92
  this.limiter.queue(async () => {
91
93
  if (cts.token.isCancellationRequested) {
@@ -125,7 +127,7 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
125
127
  return this.shouldTrackHistory(e.workingCopy.resource, e.stat);
126
128
  }
127
129
  shouldTrackHistoryFromFileOperationEvent(e) {
128
- if (!e.isOperation(2 )) {
130
+ if (!e.isOperation(FileOperation.MOVE)) {
129
131
  return false;
130
132
  }
131
133
  return this.shouldTrackHistory(e.target.resource, e.target);
@@ -147,15 +149,15 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
147
149
  return !this.resourceExcludeMatcher.value.matches(resource);
148
150
  }
149
151
  };
150
- WorkingCopyHistoryTracker = WorkingCopyHistoryTracker_1 = ( (__decorate([
151
- ( (__param(0, IWorkingCopyService))),
152
- ( (__param(1, IWorkingCopyHistoryService))),
153
- ( (__param(2, IUriIdentityService))),
154
- ( (__param(3, IPathService))),
155
- ( (__param(4, IConfigurationService))),
156
- ( (__param(5, IUndoRedoService))),
157
- ( (__param(6, IWorkspaceContextService))),
158
- ( (__param(7, IFileService)))
159
- ], WorkingCopyHistoryTracker)));
152
+ WorkingCopyHistoryTracker = WorkingCopyHistoryTracker_1 = ( __decorate([
153
+ ( __param(0, IWorkingCopyService)),
154
+ ( __param(1, IWorkingCopyHistoryService)),
155
+ ( __param(2, IUriIdentityService)),
156
+ ( __param(3, IPathService)),
157
+ ( __param(4, IConfigurationService)),
158
+ ( __param(5, IUndoRedoService)),
159
+ ( __param(6, IWorkspaceContextService)),
160
+ ( __param(7, IFileService))
161
+ ], WorkingCopyHistoryTracker));
160
162
 
161
163
  export { WorkingCopyHistoryTracker };
@@ -0,0 +1,36 @@
1
+ import { URI } from "vscode/vscode/vs/base/common/uri";
2
+ import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
3
+ import { IWorkingCopy, IWorkingCopyIdentifier, IWorkingCopySaveEvent as IBaseWorkingCopySaveEvent } from "@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/services/workingCopy/common/workingCopy";
4
+ import { IWorkingCopyService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service";
5
+ export interface IWorkingCopySaveEvent extends IBaseWorkingCopySaveEvent {
6
+ readonly workingCopy: IWorkingCopy;
7
+ }
8
+ export declare class WorkingCopyService extends Disposable implements IWorkingCopyService {
9
+ readonly _serviceBrand: undefined;
10
+ private readonly _onDidRegister;
11
+ readonly onDidRegister: import("vscode/vscode/vs/base/common/event").Event<IWorkingCopy>;
12
+ private readonly _onDidUnregister;
13
+ readonly onDidUnregister: import("vscode/vscode/vs/base/common/event").Event<IWorkingCopy>;
14
+ private readonly _onDidChangeDirty;
15
+ readonly onDidChangeDirty: import("vscode/vscode/vs/base/common/event").Event<IWorkingCopy>;
16
+ private readonly _onDidChangeContent;
17
+ readonly onDidChangeContent: import("vscode/vscode/vs/base/common/event").Event<IWorkingCopy>;
18
+ private readonly _onDidSave;
19
+ readonly onDidSave: import("vscode/vscode/vs/base/common/event").Event<IWorkingCopySaveEvent>;
20
+ get workingCopies(): IWorkingCopy[];
21
+ private _workingCopies;
22
+ private readonly mapResourceToWorkingCopies;
23
+ private readonly mapWorkingCopyToListeners;
24
+ registerWorkingCopy(workingCopy: IWorkingCopy): IDisposable;
25
+ protected unregisterWorkingCopy(workingCopy: IWorkingCopy): void;
26
+ has(identifier: IWorkingCopyIdentifier): boolean;
27
+ has(resource: URI): boolean;
28
+ get(identifier: IWorkingCopyIdentifier): IWorkingCopy | undefined;
29
+ getAll(resource: URI): readonly IWorkingCopy[] | undefined;
30
+ get hasDirty(): boolean;
31
+ get dirtyCount(): number;
32
+ get dirtyWorkingCopies(): IWorkingCopy[];
33
+ get modifiedCount(): number;
34
+ get modifiedWorkingCopies(): IWorkingCopy[];
35
+ isDirty(resource: URI, typeId?: string): boolean;
36
+ }
@@ -1,3 +1,5 @@
1
+
2
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
1
3
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
2
4
  import { URI } from 'vscode/vscode/vs/base/common/uri';
3
5
  import { Disposable, DisposableMap, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
package/workingCopy.js DELETED
@@ -1,45 +0,0 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
3
- import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup.service';
4
- import { WorkingCopyService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyService.js';
5
- import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
6
- import { WorkingCopyEditorService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyEditorService.js';
7
- import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service';
8
- import { IWorkingCopyHistoryService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service';
9
- import { BrowserWorkingCopyHistoryService } from './vscode/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.js';
10
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
11
- import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
12
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
13
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
14
- import { joinPath } from 'vscode/vscode/vs/base/common/resources';
15
- import { WorkingCopyBackupService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyBackupService.js';
16
- import getServiceOverride$1 from '@codingame/monaco-vscode-files-service-override';
17
-
18
- let BrowserWorkingCopyBackupService = class BrowserWorkingCopyBackupService extends WorkingCopyBackupService {
19
- constructor(memory, contextService, environmentService, fileService, logService) {
20
- super(memory
21
- ? undefined
22
- : joinPath(environmentService.userRoamingDataHome, 'Backups', contextService.getWorkspace().id), fileService, logService);
23
- }
24
- };
25
- BrowserWorkingCopyBackupService = __decorate([
26
- ( __param(1, IWorkspaceContextService)),
27
- ( __param(2, IWorkbenchEnvironmentService)),
28
- ( __param(3, IFileService)),
29
- ( __param(4, ILogService))
30
- ], BrowserWorkingCopyBackupService);
31
- function getServiceOverride({ storage = 'userData' } = {}) {
32
- return {
33
- ...getServiceOverride$1(),
34
- ...(storage != null
35
- ? {
36
- [( IWorkingCopyBackupService.toString())]: new SyncDescriptor(BrowserWorkingCopyBackupService, [storage === 'memory'], false)
37
- }
38
- : {}),
39
- [( IWorkingCopyService.toString())]: new SyncDescriptor(WorkingCopyService, [], false),
40
- [( IWorkingCopyEditorService.toString())]: new SyncDescriptor(WorkingCopyEditorService, [], false),
41
- [( IWorkingCopyHistoryService.toString())]: new SyncDescriptor(BrowserWorkingCopyHistoryService, [], false)
42
- };
43
- }
44
-
45
- export { getServiceOverride as default };