@codingame/monaco-vscode-working-copy-service-override 4.5.1 → 5.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/package.json +3 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistoryService.js +55 -70
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistoryTracker.js +21 -24
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyService.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-working-copy-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
30
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@5.0.0",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "5.0.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -29,13 +29,10 @@ import { lastOrDefault } from 'vscode/vscode/vs/base/common/arrays';
|
|
|
29
29
|
import { escapeRegExpCharacters } from 'vscode/vscode/vs/base/common/strings';
|
|
30
30
|
|
|
31
31
|
var WorkingCopyHistoryService_1, NativeWorkingCopyHistoryService_1;
|
|
32
|
+
const _moduleId = "vs/workbench/services/workingCopy/common/workingCopyHistoryService";
|
|
32
33
|
class WorkingCopyHistoryModel {
|
|
33
34
|
static { this.ENTRIES_FILE = 'entries.json'; }
|
|
34
|
-
static { this.FILE_SAVED_SOURCE = SaveSourceRegistry.registerSource('default.source', ( localizeWithPath(
|
|
35
|
-
'vs/workbench/services/workingCopy/common/workingCopyHistoryService',
|
|
36
|
-
'default.source',
|
|
37
|
-
"File Saved"
|
|
38
|
-
))); }
|
|
35
|
+
static { this.FILE_SAVED_SOURCE = SaveSourceRegistry.registerSource('default.source', ( localizeWithPath(_moduleId, 0, "File Saved"))); }
|
|
39
36
|
static { this.SETTINGS = {
|
|
40
37
|
MAX_ENTRIES: 'workbench.localHistory.maxFileEntries',
|
|
41
38
|
MERGE_PERIOD: 'workbench.localHistory.mergeWindow'
|
|
@@ -60,20 +57,20 @@ class WorkingCopyHistoryModel {
|
|
|
60
57
|
this.historyEntriesNameMatcher = undefined;
|
|
61
58
|
this.versionId = 0;
|
|
62
59
|
this.storedVersionId = this.versionId;
|
|
63
|
-
this.storeLimiter = ( new Limiter(1));
|
|
60
|
+
this.storeLimiter = ( (new Limiter(1)));
|
|
64
61
|
this.setWorkingCopy(workingCopyResource);
|
|
65
62
|
}
|
|
66
63
|
setWorkingCopy(workingCopyResource) {
|
|
67
64
|
this.workingCopyResource = workingCopyResource;
|
|
68
65
|
this.workingCopyName = this.labelService.getUriBasenameLabel(workingCopyResource);
|
|
69
|
-
this.historyEntriesNameMatcher = ( new RegExp(`[A-Za-z0-9]{4}${escapeRegExpCharacters(extname(workingCopyResource))}`));
|
|
66
|
+
this.historyEntriesNameMatcher = ( (new RegExp(`[A-Za-z0-9]{4}${escapeRegExpCharacters(extname(workingCopyResource))}`)));
|
|
70
67
|
this.historyEntriesFolder = this.toHistoryEntriesFolder(this.historyHome, workingCopyResource);
|
|
71
68
|
this.historyEntriesListingFile = joinPath(this.historyEntriesFolder, WorkingCopyHistoryModel.ENTRIES_FILE);
|
|
72
69
|
this.entries = [];
|
|
73
70
|
this.whenResolved = undefined;
|
|
74
71
|
}
|
|
75
72
|
toHistoryEntriesFolder(historyHome, workingCopyResource) {
|
|
76
|
-
return joinPath(historyHome, ( hash(( workingCopyResource.toString())).toString(16)));
|
|
73
|
+
return joinPath(historyHome, ( (hash(( (workingCopyResource.toString()))).toString(16))));
|
|
77
74
|
}
|
|
78
75
|
async addEntry(source = WorkingCopyHistoryModel.FILE_SAVED_SOURCE, timestamp = Date.now(), token) {
|
|
79
76
|
let entryToReplace = undefined;
|
|
@@ -182,7 +179,7 @@ class WorkingCopyHistoryModel {
|
|
|
182
179
|
for (const entry of this.entries) {
|
|
183
180
|
entries.set(entry.id, entry);
|
|
184
181
|
}
|
|
185
|
-
this.entries = Array.from(( entries.values())).sort((entryA, entryB) => entryA.timestamp - entryB.timestamp);
|
|
182
|
+
this.entries = Array.from(( (entries.values()))).sort((entryA, entryB) => entryA.timestamp - entryB.timestamp);
|
|
186
183
|
}
|
|
187
184
|
async resolveEntriesFromDisk() {
|
|
188
185
|
const workingCopyResource = assertIsDefined(this.workingCopyResource);
|
|
@@ -191,7 +188,7 @@ class WorkingCopyHistoryModel {
|
|
|
191
188
|
this.readEntriesFile(),
|
|
192
189
|
this.readEntriesFolder()
|
|
193
190
|
]);
|
|
194
|
-
const entries = ( new Map());
|
|
191
|
+
const entries = ( (new Map()));
|
|
195
192
|
if (entryStats) {
|
|
196
193
|
for (const entryStat of entryStats) {
|
|
197
194
|
entries.set(entryStat.name, {
|
|
@@ -299,14 +296,14 @@ class WorkingCopyHistoryModel {
|
|
|
299
296
|
const historyEntriesListingFile = assertIsDefined(this.historyEntriesListingFile);
|
|
300
297
|
const serializedModel = {
|
|
301
298
|
version: 1,
|
|
302
|
-
resource: ( workingCopyResource.toString()),
|
|
303
|
-
entries: ( this.entries.map(entry => {
|
|
299
|
+
resource: ( (workingCopyResource.toString())),
|
|
300
|
+
entries: ( (this.entries.map(entry => {
|
|
304
301
|
return {
|
|
305
302
|
id: entry.id,
|
|
306
303
|
source: entry.source !== WorkingCopyHistoryModel.FILE_SAVED_SOURCE ? entry.source : undefined,
|
|
307
304
|
timestamp: entry.timestamp
|
|
308
305
|
};
|
|
309
|
-
}))
|
|
306
|
+
})))
|
|
310
307
|
};
|
|
311
308
|
await this.fileService.writeFile(historyEntriesListingFile, VSBuffer.fromString(JSON.stringify(serializedModel)));
|
|
312
309
|
}
|
|
@@ -314,7 +311,7 @@ class WorkingCopyHistoryModel {
|
|
|
314
311
|
const historyEntriesListingFile = assertIsDefined(this.historyEntriesListingFile);
|
|
315
312
|
let serializedModel = undefined;
|
|
316
313
|
try {
|
|
317
|
-
serializedModel = JSON.parse(( (await this.fileService.readFile(historyEntriesListingFile)).value.toString()));
|
|
314
|
+
serializedModel = JSON.parse(( ((await this.fileService.readFile(historyEntriesListingFile)).value.toString())));
|
|
318
315
|
}
|
|
319
316
|
catch (error) {
|
|
320
317
|
if (!((error instanceof FileOperationError && error.fileOperationResult === 1) )) {
|
|
@@ -348,16 +345,8 @@ class WorkingCopyHistoryModel {
|
|
|
348
345
|
}
|
|
349
346
|
let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposable {
|
|
350
347
|
static { WorkingCopyHistoryService_1 = this; }
|
|
351
|
-
static { this.FILE_MOVED_SOURCE = SaveSourceRegistry.registerSource('moved.source', ( localizeWithPath(
|
|
352
|
-
|
|
353
|
-
'moved.source',
|
|
354
|
-
"File Moved"
|
|
355
|
-
))); }
|
|
356
|
-
static { this.FILE_RENAMED_SOURCE = SaveSourceRegistry.registerSource('renamed.source', ( localizeWithPath(
|
|
357
|
-
'vs/workbench/services/workingCopy/common/workingCopyHistoryService',
|
|
358
|
-
'renamed.source',
|
|
359
|
-
"File Renamed"
|
|
360
|
-
))); }
|
|
348
|
+
static { this.FILE_MOVED_SOURCE = SaveSourceRegistry.registerSource('moved.source', ( localizeWithPath(_moduleId, 1, "File Moved"))); }
|
|
349
|
+
static { this.FILE_RENAMED_SOURCE = SaveSourceRegistry.registerSource('renamed.source', ( localizeWithPath(_moduleId, 2, "File Renamed"))); }
|
|
361
350
|
constructor(fileService, remoteAgentService, environmentService, uriIdentityService, labelService, logService, configurationService) {
|
|
362
351
|
super();
|
|
363
352
|
this.fileService = fileService;
|
|
@@ -367,20 +356,20 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
367
356
|
this.labelService = labelService;
|
|
368
357
|
this.logService = logService;
|
|
369
358
|
this.configurationService = configurationService;
|
|
370
|
-
this._onDidAddEntry = this._register(( new Emitter()));
|
|
359
|
+
this._onDidAddEntry = this._register(( (new Emitter())));
|
|
371
360
|
this.onDidAddEntry = this._onDidAddEntry.event;
|
|
372
|
-
this._onDidChangeEntry = this._register(( new Emitter()));
|
|
361
|
+
this._onDidChangeEntry = this._register(( (new Emitter())));
|
|
373
362
|
this.onDidChangeEntry = this._onDidChangeEntry.event;
|
|
374
|
-
this._onDidReplaceEntry = this._register(( new Emitter()));
|
|
363
|
+
this._onDidReplaceEntry = this._register(( (new Emitter())));
|
|
375
364
|
this.onDidReplaceEntry = this._onDidReplaceEntry.event;
|
|
376
|
-
this._onDidMoveEntries = this._register(( new Emitter()));
|
|
365
|
+
this._onDidMoveEntries = this._register(( (new Emitter())));
|
|
377
366
|
this.onDidMoveEntries = this._onDidMoveEntries.event;
|
|
378
|
-
this._onDidRemoveEntry = this._register(( new Emitter()));
|
|
367
|
+
this._onDidRemoveEntry = this._register(( (new Emitter())));
|
|
379
368
|
this.onDidRemoveEntry = this._onDidRemoveEntry.event;
|
|
380
|
-
this._onDidRemoveEntries = this._register(( new Emitter()));
|
|
369
|
+
this._onDidRemoveEntries = this._register(( (new Emitter())));
|
|
381
370
|
this.onDidRemoveEntries = this._onDidRemoveEntries.event;
|
|
382
|
-
this.localHistoryHome = ( new DeferredPromise());
|
|
383
|
-
this.models = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
|
|
371
|
+
this.localHistoryHome = ( (new DeferredPromise()));
|
|
372
|
+
this.models = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
|
|
384
373
|
this.resolveLocalHistoryHome();
|
|
385
374
|
}
|
|
386
375
|
async resolveLocalHistoryHome() {
|
|
@@ -400,7 +389,7 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
400
389
|
this.localHistoryHome.complete(historyHome);
|
|
401
390
|
}
|
|
402
391
|
async moveEntries(source, target) {
|
|
403
|
-
const limiter = ( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS));
|
|
392
|
+
const limiter = ( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
|
|
404
393
|
const promises = [];
|
|
405
394
|
for (const [resource, model] of this.models) {
|
|
406
395
|
if (!this.uriIdentityService.extUri.isEqualOrParent(resource, source)) {
|
|
@@ -482,7 +471,7 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
482
471
|
if (token.isCancellationRequested) {
|
|
483
472
|
return [];
|
|
484
473
|
}
|
|
485
|
-
const all = ( new ResourceMap());
|
|
474
|
+
const all = ( (new ResourceMap()));
|
|
486
475
|
for (const [resource, model] of this.models) {
|
|
487
476
|
const hasInMemoryEntries = await model.hasEntries(true );
|
|
488
477
|
if (hasInMemoryEntries) {
|
|
@@ -492,7 +481,7 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
492
481
|
try {
|
|
493
482
|
const resolvedHistoryHome = await this.fileService.resolve(historyHome);
|
|
494
483
|
if (resolvedHistoryHome.children) {
|
|
495
|
-
const limiter = ( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS));
|
|
484
|
+
const limiter = ( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
|
|
496
485
|
const promises = [];
|
|
497
486
|
for (const child of resolvedHistoryHome.children) {
|
|
498
487
|
promises.push(limiter.queue(async () => {
|
|
@@ -500,9 +489,9 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
500
489
|
return;
|
|
501
490
|
}
|
|
502
491
|
try {
|
|
503
|
-
const serializedModel = JSON.parse(( (await this.fileService.readFile(joinPath(child.resource, WorkingCopyHistoryModel.ENTRIES_FILE))).value.toString()));
|
|
492
|
+
const serializedModel = JSON.parse(( ((await this.fileService.readFile(joinPath(child.resource, WorkingCopyHistoryModel.ENTRIES_FILE))).value.toString())));
|
|
504
493
|
if (serializedModel.entries.length > 0) {
|
|
505
|
-
all.set(( URI.parse(serializedModel.resource)), true);
|
|
494
|
+
all.set(( (URI.parse(serializedModel.resource))), true);
|
|
506
495
|
}
|
|
507
496
|
}
|
|
508
497
|
catch (error) {
|
|
@@ -514,13 +503,13 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
514
503
|
}
|
|
515
504
|
catch (error) {
|
|
516
505
|
}
|
|
517
|
-
return Array.from(( all.keys()));
|
|
506
|
+
return Array.from(( (all.keys())));
|
|
518
507
|
}
|
|
519
508
|
async getModel(resource) {
|
|
520
509
|
const historyHome = await this.localHistoryHome.p;
|
|
521
510
|
let model = this.models.get(resource);
|
|
522
511
|
if (!model) {
|
|
523
|
-
model = ( new WorkingCopyHistoryModel(
|
|
512
|
+
model = ( (new WorkingCopyHistoryModel(
|
|
524
513
|
resource,
|
|
525
514
|
historyHome,
|
|
526
515
|
this._onDidAddEntry,
|
|
@@ -532,21 +521,21 @@ let WorkingCopyHistoryService = class WorkingCopyHistoryService extends Disposab
|
|
|
532
521
|
this.labelService,
|
|
533
522
|
this.logService,
|
|
534
523
|
this.configurationService
|
|
535
|
-
));
|
|
524
|
+
)));
|
|
536
525
|
this.models.set(resource, model);
|
|
537
526
|
}
|
|
538
527
|
return model;
|
|
539
528
|
}
|
|
540
529
|
};
|
|
541
|
-
WorkingCopyHistoryService = WorkingCopyHistoryService_1 = ( __decorate([
|
|
542
|
-
( __param(0, IFileService)),
|
|
543
|
-
( __param(1, IRemoteAgentService)),
|
|
544
|
-
( __param(2, IWorkbenchEnvironmentService)),
|
|
545
|
-
( __param(3, IUriIdentityService)),
|
|
546
|
-
( __param(4, ILabelService)),
|
|
547
|
-
( __param(5, ILogService)),
|
|
548
|
-
( __param(6, IConfigurationService))
|
|
549
|
-
], WorkingCopyHistoryService));
|
|
530
|
+
WorkingCopyHistoryService = WorkingCopyHistoryService_1 = ( (__decorate([
|
|
531
|
+
( (__param(0, IFileService))),
|
|
532
|
+
( (__param(1, IRemoteAgentService))),
|
|
533
|
+
( (__param(2, IWorkbenchEnvironmentService))),
|
|
534
|
+
( (__param(3, IUriIdentityService))),
|
|
535
|
+
( (__param(4, ILabelService))),
|
|
536
|
+
( (__param(5, ILogService))),
|
|
537
|
+
( (__param(6, IConfigurationService)))
|
|
538
|
+
], WorkingCopyHistoryService)));
|
|
550
539
|
let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService extends WorkingCopyHistoryService {
|
|
551
540
|
static { NativeWorkingCopyHistoryService_1 = this; }
|
|
552
541
|
static { this.STORE_ALL_INTERVAL = 5 * 60 * 1000; }
|
|
@@ -554,11 +543,11 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
|
|
|
554
543
|
super(fileService, remoteAgentService, environmentService, uriIdentityService, labelService, logService, configurationService);
|
|
555
544
|
this.lifecycleService = lifecycleService;
|
|
556
545
|
this.isRemotelyStored = typeof this.environmentService.remoteAuthority === 'string';
|
|
557
|
-
this.storeAllCts = this._register(( new CancellationTokenSource()));
|
|
558
|
-
this.storeAllScheduler = this._register(( new RunOnceScheduler(
|
|
546
|
+
this.storeAllCts = this._register(( (new CancellationTokenSource())));
|
|
547
|
+
this.storeAllScheduler = this._register(( (new RunOnceScheduler(
|
|
559
548
|
() => this.storeAll(this.storeAllCts.token),
|
|
560
549
|
NativeWorkingCopyHistoryService_1.STORE_ALL_INTERVAL
|
|
561
|
-
)));
|
|
550
|
+
))));
|
|
562
551
|
this.registerListeners();
|
|
563
552
|
}
|
|
564
553
|
registerListeners() {
|
|
@@ -573,11 +562,7 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
|
|
|
573
562
|
onWillShutdown(e) {
|
|
574
563
|
this.storeAllScheduler.dispose();
|
|
575
564
|
this.storeAllCts.dispose(true);
|
|
576
|
-
e.join(this.storeAll(e.token), { id: 'join.workingCopyHistory', label: ( localizeWithPath(
|
|
577
|
-
'vs/workbench/services/workingCopy/common/workingCopyHistoryService',
|
|
578
|
-
'join.workingCopyHistory',
|
|
579
|
-
"Saving local history"
|
|
580
|
-
)) });
|
|
565
|
+
e.join(this.storeAll(e.token), { id: 'join.workingCopyHistory', label: ( localizeWithPath(_moduleId, 3, "Saving local history")) });
|
|
581
566
|
}
|
|
582
567
|
onDidChangeModels() {
|
|
583
568
|
if (!this.storeAllScheduler.isScheduled()) {
|
|
@@ -585,9 +570,9 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
|
|
|
585
570
|
}
|
|
586
571
|
}
|
|
587
572
|
async storeAll(token) {
|
|
588
|
-
const limiter = ( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS));
|
|
573
|
+
const limiter = ( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
|
|
589
574
|
const promises = [];
|
|
590
|
-
const models = Array.from(( this.models.values()));
|
|
575
|
+
const models = Array.from(( (this.models.values())));
|
|
591
576
|
for (const model of models) {
|
|
592
577
|
promises.push(limiter.queue(async () => {
|
|
593
578
|
if (token.isCancellationRequested) {
|
|
@@ -604,16 +589,16 @@ let NativeWorkingCopyHistoryService = class NativeWorkingCopyHistoryService exte
|
|
|
604
589
|
await Promise.all(promises);
|
|
605
590
|
}
|
|
606
591
|
};
|
|
607
|
-
NativeWorkingCopyHistoryService = NativeWorkingCopyHistoryService_1 = ( __decorate([
|
|
608
|
-
( __param(0, IFileService)),
|
|
609
|
-
( __param(1, IRemoteAgentService)),
|
|
610
|
-
( __param(2, IWorkbenchEnvironmentService)),
|
|
611
|
-
( __param(3, IUriIdentityService)),
|
|
612
|
-
( __param(4, ILabelService)),
|
|
613
|
-
( __param(5, ILifecycleService)),
|
|
614
|
-
( __param(6, ILogService)),
|
|
615
|
-
( __param(7, IConfigurationService))
|
|
616
|
-
], NativeWorkingCopyHistoryService));
|
|
617
|
-
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(WorkingCopyHistoryTracker, 3 );
|
|
592
|
+
NativeWorkingCopyHistoryService = NativeWorkingCopyHistoryService_1 = ( (__decorate([
|
|
593
|
+
( (__param(0, IFileService))),
|
|
594
|
+
( (__param(1, IRemoteAgentService))),
|
|
595
|
+
( (__param(2, IWorkbenchEnvironmentService))),
|
|
596
|
+
( (__param(3, IUriIdentityService))),
|
|
597
|
+
( (__param(4, ILabelService))),
|
|
598
|
+
( (__param(5, ILifecycleService))),
|
|
599
|
+
( (__param(6, ILogService))),
|
|
600
|
+
( (__param(7, IConfigurationService)))
|
|
601
|
+
], NativeWorkingCopyHistoryService)));
|
|
602
|
+
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(WorkingCopyHistoryTracker, 3 );
|
|
618
603
|
|
|
619
604
|
export { NativeWorkingCopyHistoryService, WorkingCopyHistoryModel, WorkingCopyHistoryService };
|
|
@@ -19,6 +19,7 @@ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/co
|
|
|
19
19
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
20
20
|
|
|
21
21
|
var WorkingCopyHistoryTracker_1;
|
|
22
|
+
const _moduleId = "vs/workbench/services/workingCopy/common/workingCopyHistoryTracker";
|
|
22
23
|
let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposable {
|
|
23
24
|
static { WorkingCopyHistoryTracker_1 = this; }
|
|
24
25
|
static { this.SETTINGS = {
|
|
@@ -26,11 +27,7 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
|
|
|
26
27
|
SIZE_LIMIT: 'workbench.localHistory.maxFileSize',
|
|
27
28
|
EXCLUDES: 'workbench.localHistory.exclude'
|
|
28
29
|
}; }
|
|
29
|
-
static { this.UNDO_REDO_SAVE_SOURCE = SaveSourceRegistry.registerSource('undoRedo.source', ( localizeWithPath(
|
|
30
|
-
'vs/workbench/services/workingCopy/common/workingCopyHistoryTracker',
|
|
31
|
-
'undoRedo.source',
|
|
32
|
-
"Undo / Redo"
|
|
33
|
-
))); }
|
|
30
|
+
static { this.UNDO_REDO_SAVE_SOURCE = SaveSourceRegistry.registerSource('undoRedo.source', ( localizeWithPath(_moduleId, 0, "Undo / Redo"))); }
|
|
34
31
|
constructor(workingCopyService, workingCopyHistoryService, uriIdentityService, pathService, configurationService, undoRedoService, contextService, fileService) {
|
|
35
32
|
super();
|
|
36
33
|
this.workingCopyService = workingCopyService;
|
|
@@ -41,19 +38,19 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
|
|
|
41
38
|
this.undoRedoService = undoRedoService;
|
|
42
39
|
this.contextService = contextService;
|
|
43
40
|
this.fileService = fileService;
|
|
44
|
-
this.limiter = this._register(( new Limiter(MAX_PARALLEL_HISTORY_IO_OPS)));
|
|
45
|
-
this.resourceExcludeMatcher = this._register(( new GlobalIdleValue(() => {
|
|
46
|
-
const matcher = this._register(( new ResourceGlobMatcher(
|
|
41
|
+
this.limiter = this._register(( (new Limiter(MAX_PARALLEL_HISTORY_IO_OPS))));
|
|
42
|
+
this.resourceExcludeMatcher = this._register(( (new GlobalIdleValue(() => {
|
|
43
|
+
const matcher = this._register(( (new ResourceGlobMatcher(
|
|
47
44
|
root => this.configurationService.getValue(WorkingCopyHistoryTracker_1.SETTINGS.EXCLUDES, { resource: root }),
|
|
48
45
|
event => event.affectsConfiguration(WorkingCopyHistoryTracker_1.SETTINGS.EXCLUDES),
|
|
49
46
|
this.contextService,
|
|
50
47
|
this.configurationService
|
|
51
|
-
)));
|
|
48
|
+
))));
|
|
52
49
|
return matcher;
|
|
53
|
-
})));
|
|
54
|
-
this.pendingAddHistoryEntryOperations = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
|
|
55
|
-
this.workingCopyContentVersion = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
|
|
56
|
-
this.historyEntryContentVersion = ( new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource)));
|
|
50
|
+
}))));
|
|
51
|
+
this.pendingAddHistoryEntryOperations = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
|
|
52
|
+
this.workingCopyContentVersion = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
|
|
53
|
+
this.historyEntryContentVersion = ( (new ResourceMap(resource => this.uriIdentityService.extUri.getComparisonKey(resource))));
|
|
57
54
|
this.registerListeners();
|
|
58
55
|
}
|
|
59
56
|
registerListeners() {
|
|
@@ -89,7 +86,7 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
|
|
|
89
86
|
return;
|
|
90
87
|
}
|
|
91
88
|
this.pendingAddHistoryEntryOperations.get(e.workingCopy.resource)?.dispose(true);
|
|
92
|
-
const cts = ( new CancellationTokenSource());
|
|
89
|
+
const cts = ( (new CancellationTokenSource()));
|
|
93
90
|
this.pendingAddHistoryEntryOperations.set(e.workingCopy.resource, cts);
|
|
94
91
|
this.limiter.queue(async () => {
|
|
95
92
|
if (cts.token.isCancellationRequested) {
|
|
@@ -151,15 +148,15 @@ let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposab
|
|
|
151
148
|
return !this.resourceExcludeMatcher.value.matches(resource);
|
|
152
149
|
}
|
|
153
150
|
};
|
|
154
|
-
WorkingCopyHistoryTracker = WorkingCopyHistoryTracker_1 = ( __decorate([
|
|
155
|
-
( __param(0, IWorkingCopyService)),
|
|
156
|
-
( __param(1, IWorkingCopyHistoryService)),
|
|
157
|
-
( __param(2, IUriIdentityService)),
|
|
158
|
-
( __param(3, IPathService)),
|
|
159
|
-
( __param(4, IConfigurationService)),
|
|
160
|
-
( __param(5, IUndoRedoService)),
|
|
161
|
-
( __param(6, IWorkspaceContextService)),
|
|
162
|
-
( __param(7, IFileService))
|
|
163
|
-
], WorkingCopyHistoryTracker));
|
|
151
|
+
WorkingCopyHistoryTracker = WorkingCopyHistoryTracker_1 = ( (__decorate([
|
|
152
|
+
( (__param(0, IWorkingCopyService))),
|
|
153
|
+
( (__param(1, IWorkingCopyHistoryService))),
|
|
154
|
+
( (__param(2, IUriIdentityService))),
|
|
155
|
+
( (__param(3, IPathService))),
|
|
156
|
+
( (__param(4, IConfigurationService))),
|
|
157
|
+
( (__param(5, IUndoRedoService))),
|
|
158
|
+
( (__param(6, IWorkspaceContextService))),
|
|
159
|
+
( (__param(7, IFileService)))
|
|
160
|
+
], WorkingCopyHistoryTracker)));
|
|
164
161
|
|
|
165
162
|
export { WorkingCopyHistoryTracker };
|
|
@@ -25,7 +25,9 @@ class WorkingCopyService extends Disposable {
|
|
|
25
25
|
registerWorkingCopy(workingCopy) {
|
|
26
26
|
let workingCopiesForResource = this.mapResourceToWorkingCopies.get(workingCopy.resource);
|
|
27
27
|
if (workingCopiesForResource?.has(workingCopy.typeId)) {
|
|
28
|
-
throw new Error(
|
|
28
|
+
throw ( new Error(
|
|
29
|
+
`Cannot register more than one working copy with the same resource ${( workingCopy.resource.toString())} and type ${workingCopy.typeId}.`
|
|
30
|
+
));
|
|
29
31
|
}
|
|
30
32
|
this._workingCopies.add(workingCopy);
|
|
31
33
|
if (!workingCopiesForResource) {
|