@codingame/monaco-vscode-remote-agent-service-override 1.85.2 → 1.85.4
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 @@
|
|
|
1
|
-
export { default } from './remoteAgent.js';
|
|
1
|
+
export { RemoteAgentServiceOverrideParams, default } from './remoteAgent.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-remote-agent-service-override",
|
|
3
|
-
"version": "1.85.
|
|
3
|
+
"version": "1.85.4",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.85.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.85.4",
|
|
22
22
|
"monaco-editor": "0.45.0",
|
|
23
|
-
"@codingame/monaco-vscode-environment-service-override": "1.85.
|
|
23
|
+
"@codingame/monaco-vscode-environment-service-override": "1.85.4"
|
|
24
24
|
}
|
|
25
25
|
}
|
package/remoteAgent.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
2
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
interface RemoteAgentServiceOverrideParams {
|
|
4
|
+
/**
|
|
5
|
+
* if true, the default extensions on the remote agent will be scanned and added
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
scanRemoteExtensions?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function getServiceOverride({ scanRemoteExtensions }?: RemoteAgentServiceOverrideParams): IEditorOverrideServices;
|
|
5
11
|
|
|
6
|
-
export { getServiceOverride as default };
|
|
12
|
+
export { type RemoteAgentServiceOverrideParams, getServiceOverride as default };
|
package/remoteAgent.js
CHANGED
|
@@ -12,7 +12,17 @@ import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.j
|
|
|
12
12
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
13
13
|
import { IRemoteExplorerService, RemoteExplorerService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteExplorerService';
|
|
14
14
|
import { IExternalUriOpenerService, ExternalUriOpenerService } from 'vscode/vscode/vs/workbench/contrib/externalUriOpener/common/externalUriOpenerService';
|
|
15
|
+
import { RemoteExtensionsScannerService } from './vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js';
|
|
16
|
+
import { IRemoteExtensionsScannerService } from 'vscode/vscode/vs/platform/remote/common/remoteExtensionsScanner';
|
|
17
|
+
import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
|
|
18
|
+
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
|
|
19
|
+
import { BrowserRemoteResourceLoader } from './vscode/src/vs/workbench/services/remote/browser/browserRemoteResourceHandler.js';
|
|
20
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
21
|
+
import { IRemoteUserDataProfilesService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles';
|
|
22
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
23
|
+
import { IActiveLanguagePackService } from 'vscode/vscode/vs/workbench/services/localization/common/locale';
|
|
15
24
|
import getServiceOverride$1 from '@codingame/monaco-vscode-environment-service-override';
|
|
25
|
+
import { getWorkbenchConstructionOptions } from 'vscode/workbench';
|
|
16
26
|
import { registerServiceInitializePreParticipant } from 'vscode/lifecycle';
|
|
17
27
|
import './vscode/src/vs/workbench/contrib/remote/common/remote.contribution.js';
|
|
18
28
|
import './vscode/src/vs/workbench/contrib/remote/browser/remote.contribution.js';
|
|
@@ -26,17 +36,53 @@ let CustomRemoteSocketFactoryService = class CustomRemoteSocketFactoryService ex
|
|
|
26
36
|
CustomRemoteSocketFactoryService = __decorate([
|
|
27
37
|
( __param(0, IBrowserWorkbenchEnvironmentService))
|
|
28
38
|
], CustomRemoteSocketFactoryService);
|
|
39
|
+
let InjectedRemoteAuthorityResolverService = class InjectedRemoteAuthorityResolverService extends RemoteAuthorityResolverService {
|
|
40
|
+
constructor(environmentService, productService, logService, fileService) {
|
|
41
|
+
const configuration = getWorkbenchConstructionOptions();
|
|
42
|
+
const connectionToken = environmentService.options.connectionToken;
|
|
43
|
+
const remoteResourceLoader = configuration.remoteResourceProvider != null ? new BrowserRemoteResourceLoader(fileService, configuration.remoteResourceProvider) : undefined;
|
|
44
|
+
const resourceUriProvider = configuration.resourceUriProvider ?? remoteResourceLoader?.getResourceUriProvider();
|
|
45
|
+
super(!environmentService.expectsResolverExtension, connectionToken, resourceUriProvider, productService, logService);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
InjectedRemoteAuthorityResolverService = __decorate([
|
|
49
|
+
( __param(0, IEnvironmentService)),
|
|
50
|
+
( __param(1, IProductService)),
|
|
51
|
+
( __param(2, ILogService)),
|
|
52
|
+
( __param(3, IFileService))
|
|
53
|
+
], InjectedRemoteAuthorityResolverService);
|
|
54
|
+
let CustomRemoteExtensionsScannerService = class CustomRemoteExtensionsScannerService extends RemoteExtensionsScannerService {
|
|
55
|
+
constructor(scanRemoteExtensions, remoteAgentService, environmentService, userDataProfileService, remoteUserDataProfilesService, logService, activeLanguagePackService) {
|
|
56
|
+
super(remoteAgentService, environmentService, userDataProfileService, remoteUserDataProfilesService, logService, activeLanguagePackService);
|
|
57
|
+
this.scanRemoteExtensions = scanRemoteExtensions;
|
|
58
|
+
}
|
|
59
|
+
async scanExtensions() {
|
|
60
|
+
if (!this.scanRemoteExtensions) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return super.scanExtensions();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
CustomRemoteExtensionsScannerService = __decorate([
|
|
67
|
+
( __param(1, IRemoteAgentService)),
|
|
68
|
+
( __param(2, IWorkbenchEnvironmentService)),
|
|
69
|
+
( __param(3, IUserDataProfileService)),
|
|
70
|
+
( __param(4, IRemoteUserDataProfilesService)),
|
|
71
|
+
( __param(5, ILogService)),
|
|
72
|
+
( __param(6, IActiveLanguagePackService))
|
|
73
|
+
], CustomRemoteExtensionsScannerService);
|
|
29
74
|
registerServiceInitializePreParticipant(async (serviceAccessor) => {
|
|
30
75
|
RemoteFileSystemProviderClient.register(serviceAccessor.get(IRemoteAgentService), serviceAccessor.get(IFileService), serviceAccessor.get(ILogService));
|
|
31
76
|
});
|
|
32
|
-
function getServiceOverride(
|
|
77
|
+
function getServiceOverride({ scanRemoteExtensions = false } = {}) {
|
|
33
78
|
return {
|
|
34
79
|
...getServiceOverride$1(),
|
|
35
80
|
[( IRemoteAgentService.toString())]: new SyncDescriptor(RemoteAgentService, [], true),
|
|
36
81
|
[( IRemoteSocketFactoryService.toString())]: new SyncDescriptor(CustomRemoteSocketFactoryService, [], true),
|
|
37
|
-
[( IRemoteAuthorityResolverService.toString())]: new SyncDescriptor(
|
|
82
|
+
[( IRemoteAuthorityResolverService.toString())]: new SyncDescriptor(InjectedRemoteAuthorityResolverService, []),
|
|
38
83
|
[( IRemoteExplorerService.toString())]: new SyncDescriptor(RemoteExplorerService, [], true),
|
|
39
|
-
[( IExternalUriOpenerService.toString())]: new SyncDescriptor(ExternalUriOpenerService, [], true)
|
|
84
|
+
[( IExternalUriOpenerService.toString())]: new SyncDescriptor(ExternalUriOpenerService, [], true),
|
|
85
|
+
[( IRemoteExtensionsScannerService.toString())]: new SyncDescriptor(CustomRemoteExtensionsScannerService, [scanRemoteExtensions], true)
|
|
40
86
|
};
|
|
41
87
|
}
|
|
42
88
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
3
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { getMediaOrTextMime } from 'monaco-editor/esm/vs/base/common/mime.js';
|
|
5
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
6
|
+
import { FileOperationError, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
7
|
+
|
|
8
|
+
let BrowserRemoteResourceLoader = class BrowserRemoteResourceLoader extends Disposable {
|
|
9
|
+
constructor(fileService, provider) {
|
|
10
|
+
super();
|
|
11
|
+
this.provider = provider;
|
|
12
|
+
this._register(provider.onDidReceiveRequest(async (request) => {
|
|
13
|
+
let uri;
|
|
14
|
+
try {
|
|
15
|
+
uri = JSON.parse(decodeURIComponent(request.uri.query));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return request.respondWith(404, ( new Uint8Array()), {});
|
|
19
|
+
}
|
|
20
|
+
let content;
|
|
21
|
+
try {
|
|
22
|
+
content = await fileService.readFile(( URI.from(uri, true)));
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
const str = VSBuffer.fromString(e.message).buffer;
|
|
26
|
+
if (e instanceof FileOperationError && e.fileOperationResult === 1 ) {
|
|
27
|
+
return request.respondWith(404, str, {});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return request.respondWith(500, str, {});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const mime = uri.path && getMediaOrTextMime(uri.path);
|
|
34
|
+
request.respondWith(200, content.value.buffer, mime ? { 'content-type': mime } : {});
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
getResourceUriProvider() {
|
|
38
|
+
const baseUri = ( URI.parse(document.location.href));
|
|
39
|
+
return uri => baseUri.with({
|
|
40
|
+
path: this.provider.path,
|
|
41
|
+
query: JSON.stringify(uri),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
BrowserRemoteResourceLoader = ( __decorate([
|
|
46
|
+
( __param(0, IFileService))
|
|
47
|
+
], BrowserRemoteResourceLoader));
|
|
48
|
+
|
|
49
|
+
export { BrowserRemoteResourceLoader };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
|
|
3
|
+
import { RemoteExtensionsScannerChannelName } from 'vscode/vscode/vs/platform/remote/common/remoteExtensionsScanner';
|
|
4
|
+
import * as platform from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
5
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
6
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
7
|
+
import { IRemoteUserDataProfilesService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles';
|
|
8
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
9
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
10
|
+
import { IActiveLanguagePackService } from 'vscode/vscode/vs/workbench/services/localization/common/locale';
|
|
11
|
+
|
|
12
|
+
let RemoteExtensionsScannerService = class RemoteExtensionsScannerService {
|
|
13
|
+
constructor(remoteAgentService, environmentService, userDataProfileService, remoteUserDataProfilesService, logService, activeLanguagePackService) {
|
|
14
|
+
this.remoteAgentService = remoteAgentService;
|
|
15
|
+
this.environmentService = environmentService;
|
|
16
|
+
this.userDataProfileService = userDataProfileService;
|
|
17
|
+
this.remoteUserDataProfilesService = remoteUserDataProfilesService;
|
|
18
|
+
this.logService = logService;
|
|
19
|
+
this.activeLanguagePackService = activeLanguagePackService;
|
|
20
|
+
}
|
|
21
|
+
whenExtensionsReady() {
|
|
22
|
+
return this.withChannel(channel => channel.call('whenExtensionsReady'), undefined);
|
|
23
|
+
}
|
|
24
|
+
async scanExtensions() {
|
|
25
|
+
try {
|
|
26
|
+
const languagePack = await this.activeLanguagePackService.getExtensionIdProvidingCurrentLocale();
|
|
27
|
+
return await this.withChannel(async (channel) => {
|
|
28
|
+
const profileLocation = this.userDataProfileService.currentProfile.isDefault ? undefined : (await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile)).extensionsResource;
|
|
29
|
+
const scannedExtensions = await channel.call('scanExtensions', [platform.language, profileLocation, this.environmentService.extensionDevelopmentLocationURI, languagePack]);
|
|
30
|
+
scannedExtensions.forEach((extension) => {
|
|
31
|
+
extension.extensionLocation = URI.revive(extension.extensionLocation);
|
|
32
|
+
});
|
|
33
|
+
return scannedExtensions;
|
|
34
|
+
}, []);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
this.logService.error(error);
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async scanSingleExtension(extensionLocation, isBuiltin) {
|
|
42
|
+
try {
|
|
43
|
+
return await this.withChannel(async (channel) => {
|
|
44
|
+
const extension = await channel.call('scanSingleExtension', [extensionLocation, isBuiltin, platform.language]);
|
|
45
|
+
if (extension !== null) {
|
|
46
|
+
extension.extensionLocation = URI.revive(extension.extensionLocation);
|
|
47
|
+
}
|
|
48
|
+
return extension;
|
|
49
|
+
}, null);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.logService.error(error);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
withChannel(callback, fallback) {
|
|
57
|
+
const connection = this.remoteAgentService.getConnection();
|
|
58
|
+
if (!connection) {
|
|
59
|
+
return Promise.resolve(fallback);
|
|
60
|
+
}
|
|
61
|
+
return connection.withChannel(RemoteExtensionsScannerChannelName, (channel) => callback(channel));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
RemoteExtensionsScannerService = ( __decorate([
|
|
65
|
+
( __param(0, IRemoteAgentService)),
|
|
66
|
+
( __param(1, IWorkbenchEnvironmentService)),
|
|
67
|
+
( __param(2, IUserDataProfileService)),
|
|
68
|
+
( __param(3, IRemoteUserDataProfilesService)),
|
|
69
|
+
( __param(4, ILogService)),
|
|
70
|
+
( __param(5, IActiveLanguagePackService))
|
|
71
|
+
], RemoteExtensionsScannerService));
|
|
72
|
+
|
|
73
|
+
export { RemoteExtensionsScannerService };
|