@codingame/monaco-vscode-working-copy-service-override 4.4.1 → 4.5.0-improve-code-splitting.1
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 +11 -3
- package/vscode/src/vs/workbench/services/workingCopy/browser/workingCopyBackupService.js +4 -4
- package/vscode/src/vs/workbench/services/workingCopy/browser/workingCopyBackupTracker.js +8 -8
- package/vscode/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.js +7 -7
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyBackupService.js +3 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyEditorService.js +41 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistory.js +3 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistoryService.js +10 -9
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistoryTracker.js +9 -8
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyService.js +127 -0
- package/workingCopy.js +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-working-copy-service-override",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-improve-code-splitting.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -17,8 +17,16 @@
|
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"default": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"./vscode/*": {
|
|
25
|
+
"default": "./vscode/src/*.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
20
28
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.
|
|
22
|
-
"@codingame/monaco-vscode-files-service-override": "4.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.5.0-improve-code-splitting.1",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "4.5.0-improve-code-splitting.1"
|
|
23
31
|
}
|
|
24
32
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
3
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
4
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
2
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
3
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
4
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
5
5
|
import { WorkingCopyBackupService } from '../common/workingCopyBackupService.js';
|
|
6
6
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
7
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
8
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
8
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
9
9
|
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
10
10
|
import { BrowserWorkingCopyBackupTracker } from './workingCopyBackupTracker.js';
|
|
11
11
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup';
|
|
3
|
-
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
4
|
-
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService';
|
|
5
|
-
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
6
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
2
|
+
import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup.service';
|
|
3
|
+
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
4
|
+
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
5
|
+
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
6
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
7
7
|
import { WorkingCopyBackupTracker } from '../common/workingCopyBackupTracker.js';
|
|
8
|
-
import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService';
|
|
9
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
10
|
-
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
8
|
+
import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service';
|
|
9
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
10
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
11
11
|
|
|
12
12
|
let BrowserWorkingCopyBackupTracker = class BrowserWorkingCopyBackupTracker extends WorkingCopyBackupTracker {
|
|
13
13
|
static { this.ID = 'workbench.contrib.browserWorkingCopyBackupTracker'; }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
3
|
-
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
|
|
4
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
5
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
6
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
7
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
8
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
2
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
3
|
+
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
4
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
5
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
6
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
7
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
8
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
9
9
|
import { WorkingCopyHistoryService } from '../common/workingCopyHistoryService.js';
|
|
10
10
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
11
|
|
|
@@ -3,13 +3,13 @@ import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
|
3
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
4
|
import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
|
|
5
5
|
import { deepClone, equals } from 'vscode/vscode/vs/base/common/objects';
|
|
6
|
-
import {
|
|
7
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
6
|
+
import { Promises, ResourceQueue } from 'vscode/vscode/vs/base/common/async';
|
|
7
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
8
8
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
9
9
|
import { isReadableStream, peekStream } from 'vscode/vscode/vs/base/common/stream';
|
|
10
10
|
import { VSBuffer, prefixedBufferStream, prefixedBufferReadable, bufferToStream, streamToBuffer, readableToBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
11
11
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
12
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
12
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
13
13
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
14
14
|
import { hash } from 'vscode/vscode/vs/base/common/hash';
|
|
15
15
|
import { isEmptyObject } from 'vscode/vscode/vs/base/common/types';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
5
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
|
+
|
|
7
|
+
let WorkingCopyEditorService = class WorkingCopyEditorService extends Disposable {
|
|
8
|
+
constructor(editorService) {
|
|
9
|
+
super();
|
|
10
|
+
this.editorService = editorService;
|
|
11
|
+
this._onDidRegisterHandler = this._register(( new Emitter()));
|
|
12
|
+
this.onDidRegisterHandler = this._onDidRegisterHandler.event;
|
|
13
|
+
this.handlers = ( new Set());
|
|
14
|
+
}
|
|
15
|
+
registerHandler(handler) {
|
|
16
|
+
this.handlers.add(handler);
|
|
17
|
+
this._onDidRegisterHandler.fire(handler);
|
|
18
|
+
return toDisposable(() => this.handlers.delete(handler));
|
|
19
|
+
}
|
|
20
|
+
findEditor(workingCopy) {
|
|
21
|
+
for (const editorIdentifier of this.editorService.getEditors(0 )) {
|
|
22
|
+
if (this.isOpen(workingCopy, editorIdentifier.editor)) {
|
|
23
|
+
return editorIdentifier;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
isOpen(workingCopy, editor) {
|
|
29
|
+
for (const handler of this.handlers) {
|
|
30
|
+
if (handler.isOpen(workingCopy, editor)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
WorkingCopyEditorService = ( __decorate([
|
|
38
|
+
( __param(0, IEditorService))
|
|
39
|
+
], WorkingCopyEditorService));
|
|
40
|
+
|
|
41
|
+
export { WorkingCopyEditorService };
|
|
@@ -4,26 +4,27 @@ import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
|
4
4
|
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
5
5
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
6
6
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
7
|
-
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
7
|
+
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
8
8
|
import { WorkingCopyHistoryTracker } from './workingCopyHistoryTracker.js';
|
|
9
9
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
10
|
-
import { MAX_PARALLEL_HISTORY_IO_OPS } from '
|
|
11
|
-
import { FileOperationError
|
|
12
|
-
import {
|
|
10
|
+
import { MAX_PARALLEL_HISTORY_IO_OPS } from './workingCopyHistory.js';
|
|
11
|
+
import { FileOperationError } from 'vscode/vscode/vs/platform/files/common/files';
|
|
12
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
13
|
+
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
13
14
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
14
15
|
import { Limiter, DeferredPromise, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
15
16
|
import { extname, joinPath, isEqual, dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
16
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
17
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
17
18
|
import { hash } from 'vscode/vscode/vs/base/common/hash';
|
|
18
19
|
import { randomPath, indexOfPath } from 'vscode/vscode/vs/base/common/extpath';
|
|
19
20
|
import { CancellationToken, CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
20
21
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
21
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
22
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
22
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
23
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
23
24
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
24
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
25
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
25
26
|
import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
|
|
26
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
27
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
27
28
|
import { lastOrDefault } from 'vscode/vscode/vs/base/common/arrays';
|
|
28
29
|
import { escapeRegExpCharacters } from 'vscode/vscode/vs/base/common/strings';
|
|
29
30
|
|
|
@@ -4,18 +4,19 @@ import { Limiter, GlobalIdleValue } from 'vscode/vscode/vs/base/common/async';
|
|
|
4
4
|
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
5
5
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
6
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
7
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
-
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
9
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
7
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
+
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
9
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
10
10
|
import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
|
|
11
|
-
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
11
|
+
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService.service';
|
|
12
12
|
import { isStoredFileWorkingCopySaveEvent } from 'vscode/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
|
|
13
|
-
import { MAX_PARALLEL_HISTORY_IO_OPS
|
|
14
|
-
import {
|
|
13
|
+
import { MAX_PARALLEL_HISTORY_IO_OPS } from './workingCopyHistory.js';
|
|
14
|
+
import { IWorkingCopyHistoryService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service';
|
|
15
|
+
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
15
16
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
16
17
|
import { ResourceGlobMatcher } from 'vscode/vscode/vs/workbench/common/resources';
|
|
17
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
18
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
18
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
19
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
19
20
|
|
|
20
21
|
var WorkingCopyHistoryTracker_1;
|
|
21
22
|
let WorkingCopyHistoryTracker = class WorkingCopyHistoryTracker extends Disposable {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
2
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
+
import { Disposable, DisposableMap, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
5
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
|
+
|
|
7
|
+
class WorkingCopyService extends Disposable {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this._onDidRegister = this._register(( new Emitter()));
|
|
11
|
+
this.onDidRegister = this._onDidRegister.event;
|
|
12
|
+
this._onDidUnregister = this._register(( new Emitter()));
|
|
13
|
+
this.onDidUnregister = this._onDidUnregister.event;
|
|
14
|
+
this._onDidChangeDirty = this._register(( new Emitter()));
|
|
15
|
+
this.onDidChangeDirty = this._onDidChangeDirty.event;
|
|
16
|
+
this._onDidChangeContent = this._register(( new Emitter()));
|
|
17
|
+
this.onDidChangeContent = this._onDidChangeContent.event;
|
|
18
|
+
this._onDidSave = this._register(( new Emitter()));
|
|
19
|
+
this.onDidSave = this._onDidSave.event;
|
|
20
|
+
this._workingCopies = ( new Set());
|
|
21
|
+
this.mapResourceToWorkingCopies = ( new ResourceMap());
|
|
22
|
+
this.mapWorkingCopyToListeners = this._register(( new DisposableMap()));
|
|
23
|
+
}
|
|
24
|
+
get workingCopies() { return Array.from(( this._workingCopies.values())); }
|
|
25
|
+
registerWorkingCopy(workingCopy) {
|
|
26
|
+
let workingCopiesForResource = this.mapResourceToWorkingCopies.get(workingCopy.resource);
|
|
27
|
+
if (workingCopiesForResource?.has(workingCopy.typeId)) {
|
|
28
|
+
throw new Error(`Cannot register more than one working copy with the same resource ${workingCopy.resource.toString()} and type ${workingCopy.typeId}.`);
|
|
29
|
+
}
|
|
30
|
+
this._workingCopies.add(workingCopy);
|
|
31
|
+
if (!workingCopiesForResource) {
|
|
32
|
+
workingCopiesForResource = ( new Map());
|
|
33
|
+
this.mapResourceToWorkingCopies.set(workingCopy.resource, workingCopiesForResource);
|
|
34
|
+
}
|
|
35
|
+
workingCopiesForResource.set(workingCopy.typeId, workingCopy);
|
|
36
|
+
const disposables = ( new DisposableStore());
|
|
37
|
+
disposables.add(workingCopy.onDidChangeContent(() => this._onDidChangeContent.fire(workingCopy)));
|
|
38
|
+
disposables.add(workingCopy.onDidChangeDirty(() => this._onDidChangeDirty.fire(workingCopy)));
|
|
39
|
+
disposables.add(workingCopy.onDidSave(e => this._onDidSave.fire({ workingCopy, ...e })));
|
|
40
|
+
this.mapWorkingCopyToListeners.set(workingCopy, disposables);
|
|
41
|
+
this._onDidRegister.fire(workingCopy);
|
|
42
|
+
if (workingCopy.isDirty()) {
|
|
43
|
+
this._onDidChangeDirty.fire(workingCopy);
|
|
44
|
+
}
|
|
45
|
+
return toDisposable(() => {
|
|
46
|
+
this.unregisterWorkingCopy(workingCopy);
|
|
47
|
+
this._onDidUnregister.fire(workingCopy);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
unregisterWorkingCopy(workingCopy) {
|
|
51
|
+
this._workingCopies.delete(workingCopy);
|
|
52
|
+
const workingCopiesForResource = this.mapResourceToWorkingCopies.get(workingCopy.resource);
|
|
53
|
+
if (workingCopiesForResource?.delete(workingCopy.typeId) && workingCopiesForResource.size === 0) {
|
|
54
|
+
this.mapResourceToWorkingCopies.delete(workingCopy.resource);
|
|
55
|
+
}
|
|
56
|
+
if (workingCopy.isDirty()) {
|
|
57
|
+
this._onDidChangeDirty.fire(workingCopy);
|
|
58
|
+
}
|
|
59
|
+
this.mapWorkingCopyToListeners.deleteAndDispose(workingCopy);
|
|
60
|
+
}
|
|
61
|
+
has(resourceOrIdentifier) {
|
|
62
|
+
if (URI.isUri(resourceOrIdentifier)) {
|
|
63
|
+
return ( this.mapResourceToWorkingCopies.has(resourceOrIdentifier));
|
|
64
|
+
}
|
|
65
|
+
return this.mapResourceToWorkingCopies.get(resourceOrIdentifier.resource)?.has(resourceOrIdentifier.typeId) ?? false;
|
|
66
|
+
}
|
|
67
|
+
get(identifier) {
|
|
68
|
+
return this.mapResourceToWorkingCopies.get(identifier.resource)?.get(identifier.typeId);
|
|
69
|
+
}
|
|
70
|
+
getAll(resource) {
|
|
71
|
+
const workingCopies = this.mapResourceToWorkingCopies.get(resource);
|
|
72
|
+
if (!workingCopies) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return Array.from(( workingCopies.values()));
|
|
76
|
+
}
|
|
77
|
+
get hasDirty() {
|
|
78
|
+
for (const workingCopy of this._workingCopies) {
|
|
79
|
+
if (workingCopy.isDirty()) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
get dirtyCount() {
|
|
86
|
+
let totalDirtyCount = 0;
|
|
87
|
+
for (const workingCopy of this._workingCopies) {
|
|
88
|
+
if (workingCopy.isDirty()) {
|
|
89
|
+
totalDirtyCount++;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return totalDirtyCount;
|
|
93
|
+
}
|
|
94
|
+
get dirtyWorkingCopies() {
|
|
95
|
+
return this.workingCopies.filter(workingCopy => workingCopy.isDirty());
|
|
96
|
+
}
|
|
97
|
+
get modifiedCount() {
|
|
98
|
+
let totalModifiedCount = 0;
|
|
99
|
+
for (const workingCopy of this._workingCopies) {
|
|
100
|
+
if (workingCopy.isModified()) {
|
|
101
|
+
totalModifiedCount++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return totalModifiedCount;
|
|
105
|
+
}
|
|
106
|
+
get modifiedWorkingCopies() {
|
|
107
|
+
return this.workingCopies.filter(workingCopy => workingCopy.isModified());
|
|
108
|
+
}
|
|
109
|
+
isDirty(resource, typeId) {
|
|
110
|
+
const workingCopies = this.mapResourceToWorkingCopies.get(resource);
|
|
111
|
+
if (workingCopies) {
|
|
112
|
+
if (typeof typeId === 'string') {
|
|
113
|
+
return workingCopies.get(typeId)?.isDirty() ?? false;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
for (const [, workingCopy] of workingCopies) {
|
|
117
|
+
if (workingCopy.isDirty()) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { WorkingCopyService };
|
package/workingCopy.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
2
|
import { BrowserWorkingCopyBackupService } from './vscode/src/vs/workbench/services/workingCopy/browser/workingCopyBackupService.js';
|
|
3
|
-
import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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';
|
|
7
9
|
import { BrowserWorkingCopyHistoryService } from './vscode/src/vs/workbench/services/workingCopy/browser/workingCopyHistoryService.js';
|
|
8
10
|
import getServiceOverride$1 from '@codingame/monaco-vscode-files-service-override';
|
|
9
11
|
|