@codingame/monaco-vscode-edit-sessions-service-override 3.2.2 → 3.2.3
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/editSessions.js
CHANGED
|
@@ -3,13 +3,16 @@ import { EditSessionsLogService } from './vscode/src/vs/workbench/contrib/editSe
|
|
|
3
3
|
import { IEditSessionsLogService, IEditSessionsStorageService } from 'vscode/vscode/vs/workbench/contrib/editSessions/common/editSessions';
|
|
4
4
|
import { EditSessionsWorkbenchService } from './vscode/src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.js';
|
|
5
5
|
import { IWorkspaceIdentityService, WorkspaceIdentityService } from 'vscode/vscode/vs/workbench/services/workspaces/common/workspaceIdentityService';
|
|
6
|
+
import { IEditSessionIdentityService } from 'vscode/vscode/vs/platform/workspace/common/editSessions';
|
|
7
|
+
import { EditSessionIdentityService } from './vscode/src/vs/workbench/services/workspaces/common/editSessionIdentityService.js';
|
|
6
8
|
import './vscode/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.js';
|
|
7
9
|
|
|
8
10
|
function getServiceOverride() {
|
|
9
11
|
return {
|
|
10
12
|
[( IEditSessionsLogService.toString())]: new SyncDescriptor(EditSessionsLogService, [], false),
|
|
11
13
|
[( IEditSessionsStorageService.toString())]: new SyncDescriptor(EditSessionsWorkbenchService, [], false),
|
|
12
|
-
[( IWorkspaceIdentityService.toString())]: new SyncDescriptor(WorkspaceIdentityService, [], false)
|
|
14
|
+
[( IWorkspaceIdentityService.toString())]: new SyncDescriptor(WorkspaceIdentityService, [], false),
|
|
15
|
+
[( IEditSessionIdentityService.toString())]: new SyncDescriptor(EditSessionIdentityService, [], false)
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-edit-sessions-service-override",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@3.2.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@3.2.3"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { insert } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
+
import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
5
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
6
|
+
|
|
7
|
+
let EditSessionIdentityService = class EditSessionIdentityService {
|
|
8
|
+
constructor(_extensionService, _logService) {
|
|
9
|
+
this._extensionService = _extensionService;
|
|
10
|
+
this._logService = _logService;
|
|
11
|
+
this._editSessionIdentifierProviders = ( new Map());
|
|
12
|
+
this._participants = [];
|
|
13
|
+
}
|
|
14
|
+
registerEditSessionIdentityProvider(provider) {
|
|
15
|
+
if (this._editSessionIdentifierProviders.get(provider.scheme)) {
|
|
16
|
+
throw new Error(`A provider has already been registered for scheme ${provider.scheme}`);
|
|
17
|
+
}
|
|
18
|
+
this._editSessionIdentifierProviders.set(provider.scheme, provider);
|
|
19
|
+
return toDisposable(() => {
|
|
20
|
+
this._editSessionIdentifierProviders.delete(provider.scheme);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async getEditSessionIdentifier(workspaceFolder, token) {
|
|
24
|
+
const { scheme } = workspaceFolder.uri;
|
|
25
|
+
const provider = await this.activateProvider(scheme);
|
|
26
|
+
this._logService.trace(`EditSessionIdentityProvider for scheme ${scheme} available: ${!!provider}`);
|
|
27
|
+
return provider?.getEditSessionIdentifier(workspaceFolder, token);
|
|
28
|
+
}
|
|
29
|
+
async provideEditSessionIdentityMatch(workspaceFolder, identity1, identity2, cancellationToken) {
|
|
30
|
+
const { scheme } = workspaceFolder.uri;
|
|
31
|
+
const provider = await this.activateProvider(scheme);
|
|
32
|
+
this._logService.trace(`EditSessionIdentityProvider for scheme ${scheme} available: ${!!provider}`);
|
|
33
|
+
return provider?.provideEditSessionIdentityMatch?.(workspaceFolder, identity1, identity2, cancellationToken);
|
|
34
|
+
}
|
|
35
|
+
async onWillCreateEditSessionIdentity(workspaceFolder, cancellationToken) {
|
|
36
|
+
this._logService.debug('Running onWillCreateEditSessionIdentity participants...');
|
|
37
|
+
for (const participant of this._participants) {
|
|
38
|
+
await participant.participate(workspaceFolder, cancellationToken);
|
|
39
|
+
}
|
|
40
|
+
this._logService.debug(`Done running ${this._participants.length} onWillCreateEditSessionIdentity participants.`);
|
|
41
|
+
}
|
|
42
|
+
addEditSessionIdentityCreateParticipant(participant) {
|
|
43
|
+
const dispose = insert(this._participants, participant);
|
|
44
|
+
return toDisposable(() => dispose());
|
|
45
|
+
}
|
|
46
|
+
async activateProvider(scheme) {
|
|
47
|
+
const transformedScheme = scheme === 'vscode-remote' ? 'file' : scheme;
|
|
48
|
+
const provider = this._editSessionIdentifierProviders.get(scheme);
|
|
49
|
+
if (provider) {
|
|
50
|
+
return provider;
|
|
51
|
+
}
|
|
52
|
+
await this._extensionService.activateByEvent(`onEditSession:${transformedScheme}`);
|
|
53
|
+
return this._editSessionIdentifierProviders.get(scheme);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
EditSessionIdentityService = ( __decorate([
|
|
57
|
+
( __param(0, IExtensionService)),
|
|
58
|
+
( __param(1, ILogService))
|
|
59
|
+
], EditSessionIdentityService));
|
|
60
|
+
|
|
61
|
+
export { EditSessionIdentityService };
|