@codingame/monaco-vscode-api 1.79.3-next.3 → 1.79.3-next.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/dist/createApi.js +24 -0
- package/dist/custom-fetch.js +35 -0
- package/dist/default-extensions/bat.js +1 -2
- package/dist/default-extensions/clojure.js +1 -2
- package/dist/default-extensions/coffeescript.js +1 -2
- package/dist/default-extensions/cpp.js +1 -2
- package/dist/default-extensions/csharp.js +1 -2
- package/dist/default-extensions/css.js +1 -2
- package/dist/default-extensions/dart.js +1 -2
- package/dist/default-extensions/diff.js +1 -2
- package/dist/default-extensions/docker.js +1 -2
- package/dist/default-extensions/fsharp.js +1 -2
- package/dist/default-extensions/go.js +1 -2
- package/dist/default-extensions/groovy.js +1 -2
- package/dist/default-extensions/handlebars.js +1 -2
- package/dist/default-extensions/hlsl.js +1 -2
- package/dist/default-extensions/html.js +1 -2
- package/dist/default-extensions/ini.js +1 -2
- package/dist/default-extensions/java.js +1 -2
- package/dist/default-extensions/javascript.js +1 -2
- package/dist/default-extensions/json.js +1 -2
- package/dist/default-extensions/julia.js +1 -2
- package/dist/default-extensions/latex.js +1 -2
- package/dist/default-extensions/less.js +1 -2
- package/dist/default-extensions/log.js +1 -2
- package/dist/default-extensions/lua.js +1 -2
- package/dist/default-extensions/make.js +1 -2
- package/dist/default-extensions/markdown-basics.js +1 -2
- package/dist/default-extensions/objective-c.js +1 -2
- package/dist/default-extensions/perl.js +1 -2
- package/dist/default-extensions/php.js +1 -2
- package/dist/default-extensions/powershell.js +1 -2
- package/dist/default-extensions/pug.js +1 -2
- package/dist/default-extensions/python.js +1 -2
- package/dist/default-extensions/r.js +1 -2
- package/dist/default-extensions/razor.js +1 -2
- package/dist/default-extensions/references-view.js +1 -2
- package/dist/default-extensions/ruby.js +1 -2
- package/dist/default-extensions/rust.js +1 -2
- package/dist/default-extensions/scss.js +1 -2
- package/dist/default-extensions/search-result.js +1 -2
- package/dist/default-extensions/shaderlab.js +1 -2
- package/dist/default-extensions/shellscript.js +1 -2
- package/dist/default-extensions/sql.js +1 -2
- package/dist/default-extensions/swift.js +1 -2
- package/dist/default-extensions/theme-abyss.js +1 -2
- package/dist/default-extensions/theme-defaults.js +1 -2
- package/dist/default-extensions/theme-kimbie-dark.js +1 -2
- package/dist/default-extensions/theme-monokai-dimmed.js +1 -2
- package/dist/default-extensions/theme-monokai.js +1 -2
- package/dist/default-extensions/theme-quietlight.js +1 -2
- package/dist/default-extensions/theme-red.js +1 -2
- package/dist/default-extensions/theme-seti.js +1 -2
- package/dist/default-extensions/theme-solarized-dark.js +1 -2
- package/dist/default-extensions/theme-solarized-light.js +1 -2
- package/dist/default-extensions/theme-tomorrow-night-blue.js +1 -2
- package/dist/default-extensions/typescript-basics.js +1 -2
- package/dist/default-extensions/vb.js +1 -2
- package/dist/default-extensions/xml.js +1 -2
- package/dist/default-extensions/yaml.js +1 -2
- package/dist/extensions.d.ts +3 -19
- package/dist/extensions.d2.ts +1 -1
- package/dist/extensions.js +31 -116
- package/dist/extensionsRegistry.d.ts +1 -1
- package/dist/override/vs/workbench/api/common/extHost.api.impl.js +5 -0
- package/dist/rollup-extension-directory-plugin.d.ts +1 -2
- package/dist/rollup-extension-directory-plugin.js +2 -4
- package/dist/rollup-vsix-plugin.d.ts +1 -2
- package/dist/rollup-vsix-plugin.js +2 -4
- package/dist/service-override/configuration.d.ts +1 -1
- package/dist/service-override/editor.d.ts +2 -2
- package/dist/service-override/files.d.ts +3 -3
- package/dist/service-override/keybindings.js +4 -1
- package/dist/service-override/languages.d.ts +1 -1
- package/dist/service-override/terminal.d.ts +2 -2
- package/dist/service-override/views.d.ts +3 -3
- package/dist/services.d.ts +1 -1
- package/dist/views.d.ts +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDecorations.js +100 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadExtensionService.js +73 -1
- package/dist/vscode/vs/workbench/api/common/extHostRequireInterceptor.js +248 -0
- package/dist/vscode/vs/workbench/api/worker/extHostExtensionService.js +114 -0
- package/dist/vscode/vs/workbench/services/commands/common/commandService.js +77 -0
- package/dist/vscode/vs/workbench/services/extensions/common/extensions.js +14 -1
- package/dist/vscode-services/extHost.js +9 -14
- package/dist/vscode-services/missing-services.js +13 -1
- package/package.json +3 -2
- package/dist/extension-tools-05ce2858.js +0 -25937
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { I as IEditorOverrideServices } from '../standaloneServices.js';
|
|
2
|
-
import { V as ViewContainerLocation } from '../views.js';
|
|
3
1
|
import { a as ServicesAccessor } from '../instantiation.js';
|
|
4
2
|
import { a as IDisposable } from '../event.js';
|
|
5
3
|
export { I as IReference } from '../event.js';
|
|
4
|
+
import { I as IEditorOverrideServices } from '../standaloneServices.js';
|
|
5
|
+
import { V as ViewContainerLocation } from '../views.js';
|
|
6
6
|
export { I as IEditorOptions, a as IResolvedTextEditorModel } from '../editorBrowser.js';
|
|
7
7
|
import { T as ThemeIcon } from '../themables.js';
|
|
8
8
|
import { O as OpenEditor } from '../editor.js';
|
|
9
|
+
import 'vscode';
|
|
9
10
|
import 'monaco-editor';
|
|
10
11
|
import '../uri.js';
|
|
11
12
|
import '../contextkey.js';
|
|
12
13
|
import '../extensions.d2.ts';
|
|
13
14
|
import '../composite.js';
|
|
14
|
-
import 'vscode';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The Codicon library is a set of default icons that are built-in in VS Code.
|
package/dist/services.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { I as IconIdentifier, T as ThemeIcon } from './themables.js';
|
|
|
19
19
|
import { I as IJSONSchema, a as IJSONSchemaMap } from './jsonSchema.js';
|
|
20
20
|
import { I as IView$3, a as IViewDescriptorService, b as IViewPaneContainer, c as ViewContainer, d as IViewContainerModel, e as IViewDescriptor, f as IAddedViewDescriptorRef, g as IPaneComposite, V as ViewContainerLocation } from './views.js';
|
|
21
21
|
export { h as IViewsService } from './views.js';
|
|
22
|
-
import { e as ICommandAction, f as ICommandActionTitle, g as Icon, h as IEnvironmentService, E as ExtensionIdentifier, T as TargetPlatform,
|
|
22
|
+
import { e as ICommandAction, f as ICommandActionTitle, g as Icon, h as IEnvironmentService, E as ExtensionIdentifier, T as TargetPlatform, a as IExtensionDescription } from './extensions.d2.ts';
|
|
23
23
|
import { b as IProgress, c as IProgressStep, I as IComposite, d as ICompositeControl, a as IProgressIndicator } from './composite.js';
|
|
24
24
|
import { a as IContextKeyService, C as ContextKeyExpression } from './contextkey.js';
|
|
25
25
|
import { a as IExtensionService } from './extensionsRegistry.js';
|
package/dist/views.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { U as URI } from './uri.js';
|
|
|
3
3
|
import { E as Event } from './event.js';
|
|
4
4
|
import { T as ThemeIcon } from './themables.js';
|
|
5
5
|
import { C as ContextKeyExpression } from './contextkey.js';
|
|
6
|
-
import {
|
|
6
|
+
import { c as ILocalizedString, E as ExtensionIdentifier } from './extensions.d2.ts';
|
|
7
7
|
import { I as IComposite, a as IProgressIndicator } from './composite.js';
|
|
8
8
|
|
|
9
9
|
interface IKeybindings {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
3
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
+
import { dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { ExtHostContext, MainContext } from '../common/extHost.protocol.js';
|
|
6
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
7
|
+
import { IDecorationsService } from '../../services/decorations/common/decorations.js';
|
|
8
|
+
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
9
|
+
class DecorationRequestsQueue {
|
|
10
|
+
constructor(_proxy, _handle) {
|
|
11
|
+
this._proxy = _proxy;
|
|
12
|
+
this._handle = _handle;
|
|
13
|
+
this._idPool = 0;
|
|
14
|
+
this._requests = ( new Map());
|
|
15
|
+
this._resolver = ( new Map());
|
|
16
|
+
}
|
|
17
|
+
enqueue(uri, token) {
|
|
18
|
+
const id = ++this._idPool;
|
|
19
|
+
const result = ( new Promise(resolve => {
|
|
20
|
+
this._requests.set(id, { id, uri });
|
|
21
|
+
this._resolver.set(id, resolve);
|
|
22
|
+
this._processQueue();
|
|
23
|
+
}));
|
|
24
|
+
const sub = token.onCancellationRequested(() => {
|
|
25
|
+
this._requests.delete(id);
|
|
26
|
+
this._resolver.delete(id);
|
|
27
|
+
});
|
|
28
|
+
return result.finally(() => sub.dispose());
|
|
29
|
+
}
|
|
30
|
+
_processQueue() {
|
|
31
|
+
if (typeof this._timer === 'number') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this._timer = setTimeout(() => {
|
|
35
|
+
const requests = this._requests;
|
|
36
|
+
const resolver = this._resolver;
|
|
37
|
+
this._proxy.$provideDecorations(this._handle, [...( requests.values())], CancellationToken.None).then(data => {
|
|
38
|
+
for (const [id, resolve] of resolver) {
|
|
39
|
+
resolve(data[id]);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
this._requests = ( new Map());
|
|
43
|
+
this._resolver = ( new Map());
|
|
44
|
+
this._timer = undefined;
|
|
45
|
+
}, 0);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
let MainThreadDecorations = class MainThreadDecorations {
|
|
49
|
+
constructor(context, _decorationsService) {
|
|
50
|
+
this._decorationsService = _decorationsService;
|
|
51
|
+
this._provider = ( new Map());
|
|
52
|
+
this._proxy = ( context.getProxy(ExtHostContext.ExtHostDecorations));
|
|
53
|
+
}
|
|
54
|
+
dispose() {
|
|
55
|
+
this._provider.forEach(value => dispose(value));
|
|
56
|
+
this._provider.clear();
|
|
57
|
+
}
|
|
58
|
+
$registerDecorationProvider(handle, label) {
|
|
59
|
+
const emitter = ( new Emitter());
|
|
60
|
+
const queue = ( new DecorationRequestsQueue(this._proxy, handle));
|
|
61
|
+
const registration = this._decorationsService.registerDecorationsProvider({
|
|
62
|
+
label,
|
|
63
|
+
onDidChange: emitter.event,
|
|
64
|
+
provideDecorations: async (uri, token) => {
|
|
65
|
+
const data = await queue.enqueue(uri, token);
|
|
66
|
+
if (!data) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const [bubble, tooltip, letter, themeColor] = data;
|
|
70
|
+
return {
|
|
71
|
+
weight: 10,
|
|
72
|
+
bubble: bubble ?? false,
|
|
73
|
+
color: themeColor?.id,
|
|
74
|
+
tooltip,
|
|
75
|
+
letter
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
this._provider.set(handle, [emitter, registration]);
|
|
80
|
+
}
|
|
81
|
+
$onDidChange(handle, resources) {
|
|
82
|
+
const provider = this._provider.get(handle);
|
|
83
|
+
if (provider) {
|
|
84
|
+
const [emitter] = provider;
|
|
85
|
+
emitter.fire(resources && ( resources.map(r => URI.revive(r))));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
$unregisterDecorationProvider(handle) {
|
|
89
|
+
const provider = this._provider.get(handle);
|
|
90
|
+
if (provider) {
|
|
91
|
+
dispose(provider);
|
|
92
|
+
this._provider.delete(handle);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
MainThreadDecorations = __decorate([
|
|
97
|
+
extHostNamedCustomer(MainContext.MainThreadDecorations),
|
|
98
|
+
( __param(1, IDecorationsService))
|
|
99
|
+
], MainThreadDecorations);
|
|
100
|
+
export { MainThreadDecorations };
|
|
@@ -8,7 +8,8 @@ import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
|
8
8
|
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
9
9
|
import { areSameExtensions } from '../../../platform/extensionManagement/common/extensionManagementUtil.js';
|
|
10
10
|
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
11
|
-
import {
|
|
11
|
+
import { WebSocketRemoteConnection, ManagedRemoteConnection } from '../../../platform/remote/common/remoteAuthorityResolver.js';
|
|
12
|
+
import { ExtHostContext, MainContext } from '../common/extHost.protocol.js';
|
|
12
13
|
import { IExtensionsWorkbenchService } from '../../contrib/extensions/common/extensions.js';
|
|
13
14
|
import { IWorkbenchEnvironmentService } from '../../services/environment/common/environmentService.js';
|
|
14
15
|
import { IWorkbenchExtensionEnablementService } from '../../services/extensionManagement/common/extensionManagement.js';
|
|
@@ -29,6 +30,8 @@ let MainThreadExtensionService = class MainThreadExtensionService {
|
|
|
29
30
|
this._extensionHostKind = extHostContext.extensionHostKind;
|
|
30
31
|
const internalExtHostContext = extHostContext;
|
|
31
32
|
this._internalExtensionService = internalExtHostContext.internalExtensionService;
|
|
33
|
+
internalExtHostContext._setExtensionHostProxy(( new ExtensionHostProxy(( extHostContext.getProxy(ExtHostContext.ExtHostExtensionService)))));
|
|
34
|
+
internalExtHostContext._setAllMainProxyIdentifiers(( ( Object.keys(MainContext)).map((key) => MainContext[key])));
|
|
32
35
|
}
|
|
33
36
|
dispose() {
|
|
34
37
|
}
|
|
@@ -210,4 +213,73 @@ MainThreadExtensionService = __decorate([
|
|
|
210
213
|
( __param(7, ICommandService)),
|
|
211
214
|
( __param(8, IWorkbenchEnvironmentService))
|
|
212
215
|
], MainThreadExtensionService);
|
|
216
|
+
class ExtensionHostProxy {
|
|
217
|
+
constructor(_actual) {
|
|
218
|
+
this._actual = _actual;
|
|
219
|
+
}
|
|
220
|
+
async resolveAuthority(remoteAuthority, resolveAttempt) {
|
|
221
|
+
const resolved = reviveResolveAuthorityResult(await this._actual.$resolveAuthority(remoteAuthority, resolveAttempt));
|
|
222
|
+
return resolved;
|
|
223
|
+
}
|
|
224
|
+
async getCanonicalURI(remoteAuthority, uri) {
|
|
225
|
+
const uriComponents = await this._actual.$getCanonicalURI(remoteAuthority, uri);
|
|
226
|
+
return (uriComponents ? URI.revive(uriComponents) : uriComponents);
|
|
227
|
+
}
|
|
228
|
+
startExtensionHost(extensionsDelta) {
|
|
229
|
+
return this._actual.$startExtensionHost(extensionsDelta);
|
|
230
|
+
}
|
|
231
|
+
extensionTestsExecute() {
|
|
232
|
+
return this._actual.$extensionTestsExecute();
|
|
233
|
+
}
|
|
234
|
+
activateByEvent(activationEvent, activationKind) {
|
|
235
|
+
return this._actual.$activateByEvent(activationEvent, activationKind);
|
|
236
|
+
}
|
|
237
|
+
activate(extensionId, reason) {
|
|
238
|
+
return this._actual.$activate(extensionId, reason);
|
|
239
|
+
}
|
|
240
|
+
setRemoteEnvironment(env) {
|
|
241
|
+
return this._actual.$setRemoteEnvironment(env);
|
|
242
|
+
}
|
|
243
|
+
updateRemoteConnectionData(connectionData) {
|
|
244
|
+
return this._actual.$updateRemoteConnectionData(connectionData);
|
|
245
|
+
}
|
|
246
|
+
deltaExtensions(extensionsDelta) {
|
|
247
|
+
return this._actual.$deltaExtensions(extensionsDelta);
|
|
248
|
+
}
|
|
249
|
+
test_latency(n) {
|
|
250
|
+
return this._actual.$test_latency(n);
|
|
251
|
+
}
|
|
252
|
+
test_up(b) {
|
|
253
|
+
return this._actual.$test_up(b);
|
|
254
|
+
}
|
|
255
|
+
test_down(size) {
|
|
256
|
+
return this._actual.$test_down(size);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function reviveResolveAuthorityResult(result) {
|
|
260
|
+
if (result.type === 'ok') {
|
|
261
|
+
return {
|
|
262
|
+
type: 'ok',
|
|
263
|
+
value: {
|
|
264
|
+
...result.value,
|
|
265
|
+
authority: reviveResolvedAuthority(result.value.authority),
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function reviveResolvedAuthority(resolvedAuthority) {
|
|
274
|
+
return {
|
|
275
|
+
...resolvedAuthority,
|
|
276
|
+
connectTo: reviveConnection(resolvedAuthority.connectTo),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function reviveConnection(connection) {
|
|
280
|
+
if (connection.type === 0 ) {
|
|
281
|
+
return ( new WebSocketRemoteConnection(connection.host, connection.port));
|
|
282
|
+
}
|
|
283
|
+
return ( new ManagedRemoteConnection(connection.id));
|
|
284
|
+
}
|
|
213
285
|
export { MainThreadExtensionService };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import * as performance from 'monaco-editor/esm/vs/base/common/performance.js';
|
|
3
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
4
|
+
import { MainContext } from './extHost.protocol.js';
|
|
5
|
+
import { IExtHostConfiguration } from './extHostConfiguration.js';
|
|
6
|
+
import { nullExtensionDescription } from '../../services/extensions/common/extensions.js';
|
|
7
|
+
import { ExtensionIdentifierMap } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
|
|
8
|
+
import { IExtHostRpcService } from './extHostRpcService.js';
|
|
9
|
+
import { IExtHostInitDataService } from './extHostInitDataService.js';
|
|
10
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
+
import { IExtHostExtensionService } from './extHostExtensionService.js';
|
|
12
|
+
import { platform } from 'monaco-editor/esm/vs/base/common/process.js';
|
|
13
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
14
|
+
import { escapeRegExpCharacters } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
15
|
+
let RequireInterceptor = class RequireInterceptor {
|
|
16
|
+
constructor(_apiFactory, _extensionRegistry, _instaService, _extHostConfiguration, _extHostExtensionService, _initData, _logService) {
|
|
17
|
+
this._apiFactory = _apiFactory;
|
|
18
|
+
this._extensionRegistry = _extensionRegistry;
|
|
19
|
+
this._instaService = _instaService;
|
|
20
|
+
this._extHostConfiguration = _extHostConfiguration;
|
|
21
|
+
this._extHostExtensionService = _extHostExtensionService;
|
|
22
|
+
this._initData = _initData;
|
|
23
|
+
this._logService = _logService;
|
|
24
|
+
this._factories = ( new Map());
|
|
25
|
+
this._alternatives = [];
|
|
26
|
+
}
|
|
27
|
+
async install() {
|
|
28
|
+
this._installInterceptor();
|
|
29
|
+
performance.mark('code/extHost/willWaitForConfig');
|
|
30
|
+
const configProvider = await this._extHostConfiguration.getConfigProvider();
|
|
31
|
+
performance.mark('code/extHost/didWaitForConfig');
|
|
32
|
+
const extensionPaths = await this._extHostExtensionService.getExtensionPathIndex();
|
|
33
|
+
this.register(( new VSCodeNodeModuleFactory(
|
|
34
|
+
this._apiFactory,
|
|
35
|
+
extensionPaths,
|
|
36
|
+
this._extensionRegistry,
|
|
37
|
+
configProvider,
|
|
38
|
+
this._logService
|
|
39
|
+
)));
|
|
40
|
+
this.register(this._instaService.createInstance(KeytarNodeModuleFactory, extensionPaths));
|
|
41
|
+
this.register(this._instaService.createInstance(NodeModuleAliasingModuleFactory));
|
|
42
|
+
if (this._initData.remote.isRemote) {
|
|
43
|
+
this.register(this._instaService.createInstance(OpenNodeModuleFactory, extensionPaths, this._initData.environment.appUriScheme));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
register(interceptor) {
|
|
47
|
+
if ('nodeModuleName' in interceptor) {
|
|
48
|
+
if (Array.isArray(interceptor.nodeModuleName)) {
|
|
49
|
+
for (const moduleName of interceptor.nodeModuleName) {
|
|
50
|
+
this._factories.set(moduleName, interceptor);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this._factories.set(interceptor.nodeModuleName, interceptor);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (typeof interceptor.alternativeModuleName === 'function') {
|
|
58
|
+
this._alternatives.push((moduleName) => {
|
|
59
|
+
return interceptor.alternativeModuleName(moduleName);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
RequireInterceptor = ( __decorate([
|
|
65
|
+
( __param(2, IInstantiationService)),
|
|
66
|
+
( __param(3, IExtHostConfiguration)),
|
|
67
|
+
( __param(4, IExtHostExtensionService)),
|
|
68
|
+
( __param(5, IExtHostInitDataService)),
|
|
69
|
+
( __param(6, ILogService))
|
|
70
|
+
], RequireInterceptor));
|
|
71
|
+
let NodeModuleAliasingModuleFactory = class NodeModuleAliasingModuleFactory {
|
|
72
|
+
constructor(initData) {
|
|
73
|
+
if (initData.environment.appRoot && NodeModuleAliasingModuleFactory.aliased.size) {
|
|
74
|
+
const root = escapeRegExpCharacters(this.forceForwardSlashes(initData.environment.appRoot.fsPath));
|
|
75
|
+
const npmIdChrs = `[a-z0-9_.-]`;
|
|
76
|
+
const npmModuleName = `@${npmIdChrs}+\\/${npmIdChrs}+|${npmIdChrs}+`;
|
|
77
|
+
const moduleFolders = 'node_modules|node_modules\\.asar(?:\\.unpacked)?';
|
|
78
|
+
this.re = ( new RegExp(`^(${root}/${moduleFolders}\\/)(${npmModuleName})(.*)$`, 'i'));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
alternativeModuleName(name) {
|
|
82
|
+
if (!this.re) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const result = this.re.exec(this.forceForwardSlashes(name));
|
|
86
|
+
if (!result) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const [, prefix, moduleName, suffix] = result;
|
|
90
|
+
const dealiased = NodeModuleAliasingModuleFactory.aliased.get(moduleName);
|
|
91
|
+
if (dealiased === undefined) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
console.warn(`${moduleName} as been renamed to ${dealiased}, please update your imports`);
|
|
95
|
+
return prefix + dealiased + suffix;
|
|
96
|
+
}
|
|
97
|
+
forceForwardSlashes(str) {
|
|
98
|
+
return str.replace(/\\/g, '/');
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
NodeModuleAliasingModuleFactory.aliased = ( new Map([
|
|
102
|
+
['vscode-ripgrep', '@vscode/ripgrep'],
|
|
103
|
+
['vscode-windows-registry', '@vscode/windows-registry'],
|
|
104
|
+
]));
|
|
105
|
+
NodeModuleAliasingModuleFactory = ( __decorate([
|
|
106
|
+
( __param(0, IExtHostInitDataService))
|
|
107
|
+
], NodeModuleAliasingModuleFactory));
|
|
108
|
+
class VSCodeNodeModuleFactory {
|
|
109
|
+
constructor(_apiFactory, _extensionPaths, _extensionRegistry, _configProvider, _logService) {
|
|
110
|
+
this._apiFactory = _apiFactory;
|
|
111
|
+
this._extensionPaths = _extensionPaths;
|
|
112
|
+
this._extensionRegistry = _extensionRegistry;
|
|
113
|
+
this._configProvider = _configProvider;
|
|
114
|
+
this._logService = _logService;
|
|
115
|
+
this.nodeModuleName = 'vscode';
|
|
116
|
+
this._extApiImpl = ( new ExtensionIdentifierMap());
|
|
117
|
+
}
|
|
118
|
+
load(_request, parent) {
|
|
119
|
+
const ext = this._extensionPaths.findSubstr(parent);
|
|
120
|
+
if (ext) {
|
|
121
|
+
let apiImpl = this._extApiImpl.get(ext.identifier);
|
|
122
|
+
if (!apiImpl) {
|
|
123
|
+
apiImpl = this._apiFactory(ext, this._extensionRegistry, this._configProvider);
|
|
124
|
+
this._extApiImpl.set(ext.identifier, apiImpl);
|
|
125
|
+
}
|
|
126
|
+
return apiImpl;
|
|
127
|
+
}
|
|
128
|
+
if (!this._defaultApiImpl) {
|
|
129
|
+
let extensionPathsPretty = '';
|
|
130
|
+
this._extensionPaths.forEach((value, index) => extensionPathsPretty += `\t${index} -> ${value.identifier.value}\n`);
|
|
131
|
+
this._logService.warn(`Could not identify extension for 'vscode' require call from ${parent}. These are the extension path mappings: \n${extensionPathsPretty}`);
|
|
132
|
+
this._defaultApiImpl = this._apiFactory(nullExtensionDescription, this._extensionRegistry, this._configProvider);
|
|
133
|
+
}
|
|
134
|
+
return this._defaultApiImpl;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
let KeytarNodeModuleFactory = class KeytarNodeModuleFactory {
|
|
138
|
+
constructor(_extensionPaths, rpcService, initData) {
|
|
139
|
+
this._extensionPaths = _extensionPaths;
|
|
140
|
+
this.nodeModuleName = 'keytar';
|
|
141
|
+
this._mainThreadTelemetry = ( rpcService.getProxy(MainContext.MainThreadTelemetry));
|
|
142
|
+
const { environment } = initData;
|
|
143
|
+
const mainThreadKeytar = ( rpcService.getProxy(MainContext.MainThreadKeytar));
|
|
144
|
+
if (environment.appRoot) {
|
|
145
|
+
let appRoot = environment.appRoot.fsPath;
|
|
146
|
+
if (platform === 'win32') {
|
|
147
|
+
appRoot = appRoot.replace(/\\/g, '/');
|
|
148
|
+
}
|
|
149
|
+
if (appRoot[appRoot.length - 1] === '/') {
|
|
150
|
+
appRoot = appRoot.substr(0, appRoot.length - 1);
|
|
151
|
+
}
|
|
152
|
+
this.alternativeNames = ( new Set());
|
|
153
|
+
this.alternativeNames.add(`${appRoot}/node_modules.asar/keytar`);
|
|
154
|
+
this.alternativeNames.add(`${appRoot}/node_modules/keytar`);
|
|
155
|
+
}
|
|
156
|
+
this._impl = {
|
|
157
|
+
getPassword: (service, account) => {
|
|
158
|
+
return mainThreadKeytar.$getPassword(service, account);
|
|
159
|
+
},
|
|
160
|
+
setPassword: (service, account, password) => {
|
|
161
|
+
return mainThreadKeytar.$setPassword(service, account, password);
|
|
162
|
+
},
|
|
163
|
+
deletePassword: (service, account) => {
|
|
164
|
+
return mainThreadKeytar.$deletePassword(service, account);
|
|
165
|
+
},
|
|
166
|
+
findPassword: (service) => {
|
|
167
|
+
return mainThreadKeytar.$findPassword(service);
|
|
168
|
+
},
|
|
169
|
+
findCredentials(service) {
|
|
170
|
+
return mainThreadKeytar.$findCredentials(service);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
load(_request, parent) {
|
|
175
|
+
const ext = this._extensionPaths.findSubstr(parent);
|
|
176
|
+
this._mainThreadTelemetry.$publicLog2('shimming.keytar', { extension: ext?.identifier.value ?? 'unknown_extension' });
|
|
177
|
+
return this._impl;
|
|
178
|
+
}
|
|
179
|
+
alternativeModuleName(name) {
|
|
180
|
+
const length = name.length;
|
|
181
|
+
if (length <= 7 || !this.alternativeNames) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
const sep = length - 7;
|
|
185
|
+
if ((name.charAt(sep) === '/' || name.charAt(sep) === '\\') && name.endsWith('keytar')) {
|
|
186
|
+
name = name.replace(/\\/g, '/');
|
|
187
|
+
if (( this.alternativeNames.has(name))) {
|
|
188
|
+
return 'keytar';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
KeytarNodeModuleFactory = ( __decorate([
|
|
195
|
+
( __param(1, IExtHostRpcService)),
|
|
196
|
+
( __param(2, IExtHostInitDataService))
|
|
197
|
+
], KeytarNodeModuleFactory));
|
|
198
|
+
let OpenNodeModuleFactory = class OpenNodeModuleFactory {
|
|
199
|
+
constructor(_extensionPaths, _appUriScheme, rpcService) {
|
|
200
|
+
this._extensionPaths = _extensionPaths;
|
|
201
|
+
this._appUriScheme = _appUriScheme;
|
|
202
|
+
this.nodeModuleName = ['open', 'opn'];
|
|
203
|
+
this._mainThreadTelemetry = ( rpcService.getProxy(MainContext.MainThreadTelemetry));
|
|
204
|
+
const mainThreadWindow = ( rpcService.getProxy(MainContext.MainThreadWindow));
|
|
205
|
+
this._impl = (target, options) => {
|
|
206
|
+
const uri = ( URI.parse(target));
|
|
207
|
+
if (options) {
|
|
208
|
+
return this.callOriginal(target, options);
|
|
209
|
+
}
|
|
210
|
+
if (uri.scheme === 'http' || uri.scheme === 'https') {
|
|
211
|
+
return mainThreadWindow.$openUri(uri, target, { allowTunneling: true });
|
|
212
|
+
}
|
|
213
|
+
else if (uri.scheme === 'mailto' || uri.scheme === this._appUriScheme) {
|
|
214
|
+
return mainThreadWindow.$openUri(uri, target, {});
|
|
215
|
+
}
|
|
216
|
+
return this.callOriginal(target, options);
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
load(request, parent, original) {
|
|
220
|
+
const extension = this._extensionPaths.findSubstr(parent);
|
|
221
|
+
if (extension) {
|
|
222
|
+
this._extensionId = extension.identifier.value;
|
|
223
|
+
this.sendShimmingTelemetry();
|
|
224
|
+
}
|
|
225
|
+
this._original = original(request);
|
|
226
|
+
return this._impl;
|
|
227
|
+
}
|
|
228
|
+
callOriginal(target, options) {
|
|
229
|
+
this.sendNoForwardTelemetry();
|
|
230
|
+
return this._original(target, options);
|
|
231
|
+
}
|
|
232
|
+
sendShimmingTelemetry() {
|
|
233
|
+
if (!this._extensionId) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this._mainThreadTelemetry.$publicLog2('shimming.open', { extension: this._extensionId });
|
|
237
|
+
}
|
|
238
|
+
sendNoForwardTelemetry() {
|
|
239
|
+
if (!this._extensionId) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this._mainThreadTelemetry.$publicLog2('shimming.open.call.noForward', { extension: this._extensionId });
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
OpenNodeModuleFactory = ( __decorate([
|
|
246
|
+
( __param(2, IExtHostRpcService))
|
|
247
|
+
], OpenNodeModuleFactory));
|
|
248
|
+
export { RequireInterceptor };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import fetch from '../../../../../custom-fetch.js';
|
|
2
|
+
import { createApiFactoryAndRegisterActors } from '../../../../../override/vs/workbench/api/common/extHost.api.impl.js';
|
|
3
|
+
import { AbstractExtHostExtensionService } from '../common/extHostExtensionService.js';
|
|
4
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
5
|
+
import { RequireInterceptor } from '../common/extHostRequireInterceptor.js';
|
|
6
|
+
import { ExtensionRuntime } from '../common/extHostTypes.js';
|
|
7
|
+
import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
8
|
+
class WorkerRequireInterceptor extends RequireInterceptor {
|
|
9
|
+
_installInterceptor() { }
|
|
10
|
+
getModule(request, parent) {
|
|
11
|
+
for (const alternativeModuleName of this._alternatives) {
|
|
12
|
+
const alternative = alternativeModuleName(request);
|
|
13
|
+
if (alternative) {
|
|
14
|
+
request = alternative;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (( (this._factories.has(request)))) {
|
|
19
|
+
return this._factories.get(request).load(request, parent, () => { throw new Error('CANNOT LOAD MODULE from here.'); });
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class ExtHostExtensionService extends AbstractExtHostExtensionService {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.extensionRuntime = ExtensionRuntime.Webworker;
|
|
28
|
+
}
|
|
29
|
+
async _beforeAlmostReadyToRunExtensions() {
|
|
30
|
+
const apiFactory = this._instaService.invokeFunction(createApiFactoryAndRegisterActors);
|
|
31
|
+
this._fakeModules = this._instaService.createInstance(WorkerRequireInterceptor, apiFactory, { mine: this._myRegistry, all: this._globalRegistry });
|
|
32
|
+
await this._fakeModules.install();
|
|
33
|
+
performance.mark('code/extHost/didInitAPI');
|
|
34
|
+
await this._waitForDebuggerAttachment();
|
|
35
|
+
}
|
|
36
|
+
_getEntryPoint(extensionDescription) {
|
|
37
|
+
return extensionDescription.browser;
|
|
38
|
+
}
|
|
39
|
+
async _loadCommonJSModule(extension, module, activationTimesBuilder) {
|
|
40
|
+
module = module.with({ path: ensureSuffix(module.path, '.js') });
|
|
41
|
+
const extensionId = extension?.identifier.value;
|
|
42
|
+
if (extensionId) {
|
|
43
|
+
performance.mark(`code/extHost/willFetchExtensionCode/${extensionId}`);
|
|
44
|
+
}
|
|
45
|
+
const browserUri = URI.revive(await this._mainThreadExtensionsProxy.$asBrowserUri(module));
|
|
46
|
+
const response = await fetch(( (browserUri.toString(true))));
|
|
47
|
+
if (extensionId) {
|
|
48
|
+
performance.mark(`code/extHost/didFetchExtensionCode/${extensionId}`);
|
|
49
|
+
}
|
|
50
|
+
if (response.status !== 200) {
|
|
51
|
+
throw new Error(response.statusText);
|
|
52
|
+
}
|
|
53
|
+
const source = await response.text();
|
|
54
|
+
const sourceURL = `${( ( module.toString(true)))}#vscode-extension`;
|
|
55
|
+
const fullSource = `${source}\n//# sourceURL=${sourceURL}`;
|
|
56
|
+
let initFn;
|
|
57
|
+
try {
|
|
58
|
+
initFn = ( (new Function('module', 'exports', 'require', fullSource)));
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
if (extensionId) {
|
|
62
|
+
console.error(`Loading code for extension ${extensionId} failed: ${err.message}`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
console.error(`Loading code failed: ${err.message}`);
|
|
66
|
+
}
|
|
67
|
+
console.error(`${( ( module.toString(true)))}${typeof err.line === 'number' ? ` line ${err.line}` : ''}${typeof err.column === 'number' ? ` column ${err.column}` : ''}`);
|
|
68
|
+
console.error(err);
|
|
69
|
+
throw err;
|
|
70
|
+
}
|
|
71
|
+
if (extension) {
|
|
72
|
+
await this._extHostLocalizationService.initializeLocalizedMessages(extension);
|
|
73
|
+
}
|
|
74
|
+
const _exports = {};
|
|
75
|
+
const _module = { exports: _exports };
|
|
76
|
+
const _require = (request) => {
|
|
77
|
+
const result = this._fakeModules.getModule(request, module);
|
|
78
|
+
if (result === undefined) {
|
|
79
|
+
throw new Error(`Cannot load module '${request}'`);
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
};
|
|
83
|
+
try {
|
|
84
|
+
activationTimesBuilder.codeLoadingStart();
|
|
85
|
+
if (extensionId) {
|
|
86
|
+
performance.mark(`code/extHost/willLoadExtensionCode/${extensionId}`);
|
|
87
|
+
}
|
|
88
|
+
initFn(_module, _exports, _require);
|
|
89
|
+
return (_module.exports !== _exports ? _module.exports : _exports);
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
if (extensionId) {
|
|
93
|
+
performance.mark(`code/extHost/didLoadExtensionCode/${extensionId}`);
|
|
94
|
+
}
|
|
95
|
+
activationTimesBuilder.codeLoadingStop();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async $setRemoteEnvironment(_env) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
async _waitForDebuggerAttachment(waitTimeout = 5000) {
|
|
102
|
+
if (!this._initData.environment.isExtensionDevelopmentDebug) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const deadline = Date.now() + waitTimeout;
|
|
106
|
+
while (Date.now() < deadline && !('__jsDebugIsReady' in globalThis)) {
|
|
107
|
+
await timeout(10);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function ensureSuffix(path, suffix) {
|
|
112
|
+
return path.endsWith(suffix) ? path : path + suffix;
|
|
113
|
+
}
|
|
114
|
+
export { ExtHostExtensionService };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
3
|
+
import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
4
|
+
import { IExtensionService } from '../../extensions/common/extensions.js';
|
|
5
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
6
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
7
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
8
|
+
import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
9
|
+
let CommandService = class CommandService extends Disposable {
|
|
10
|
+
constructor(_instantiationService, _extensionService, _logService) {
|
|
11
|
+
super();
|
|
12
|
+
this._instantiationService = _instantiationService;
|
|
13
|
+
this._extensionService = _extensionService;
|
|
14
|
+
this._logService = _logService;
|
|
15
|
+
this._extensionHostIsReady = false;
|
|
16
|
+
this._onWillExecuteCommand = this._register(( new Emitter()));
|
|
17
|
+
this.onWillExecuteCommand = this._onWillExecuteCommand.event;
|
|
18
|
+
this._onDidExecuteCommand = ( new Emitter());
|
|
19
|
+
this.onDidExecuteCommand = this._onDidExecuteCommand.event;
|
|
20
|
+
this._extensionService.whenInstalledExtensionsRegistered().then(value => this._extensionHostIsReady = value);
|
|
21
|
+
this._starActivation = null;
|
|
22
|
+
}
|
|
23
|
+
_activateStar() {
|
|
24
|
+
if (!this._starActivation) {
|
|
25
|
+
this._starActivation = Promise.race([
|
|
26
|
+
this._extensionService.activateByEvent(`*`),
|
|
27
|
+
timeout(30000)
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
return this._starActivation;
|
|
31
|
+
}
|
|
32
|
+
async executeCommand(id, ...args) {
|
|
33
|
+
this._logService.trace('CommandService#executeCommand', id);
|
|
34
|
+
const activationEvent = `onCommand:${id}`;
|
|
35
|
+
const commandIsRegistered = !!CommandsRegistry.getCommand(id);
|
|
36
|
+
if (commandIsRegistered) {
|
|
37
|
+
if (this._extensionService.activationEventIsDone(activationEvent)) {
|
|
38
|
+
return this._tryExecuteCommand(id, args);
|
|
39
|
+
}
|
|
40
|
+
if (!this._extensionHostIsReady) {
|
|
41
|
+
this._extensionService.activateByEvent(activationEvent);
|
|
42
|
+
return this._tryExecuteCommand(id, args);
|
|
43
|
+
}
|
|
44
|
+
await this._extensionService.activateByEvent(activationEvent);
|
|
45
|
+
return this._tryExecuteCommand(id, args);
|
|
46
|
+
}
|
|
47
|
+
await Promise.all([
|
|
48
|
+
this._extensionService.activateByEvent(activationEvent),
|
|
49
|
+
Promise.race([
|
|
50
|
+
this._activateStar(),
|
|
51
|
+
Event.toPromise(Event.filter(CommandsRegistry.onDidRegisterCommand, e => e === id))
|
|
52
|
+
]),
|
|
53
|
+
]);
|
|
54
|
+
return this._tryExecuteCommand(id, args);
|
|
55
|
+
}
|
|
56
|
+
_tryExecuteCommand(id, args) {
|
|
57
|
+
const command = CommandsRegistry.getCommand(id);
|
|
58
|
+
if (!command) {
|
|
59
|
+
return Promise.reject(( new Error(`command '${id}' not found`)));
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
this._onWillExecuteCommand.fire({ commandId: id, args });
|
|
63
|
+
const result = this._instantiationService.invokeFunction(command.handler, ...args);
|
|
64
|
+
this._onDidExecuteCommand.fire({ commandId: id, args });
|
|
65
|
+
return Promise.resolve(result);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return Promise.reject(err);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
CommandService = ( __decorate([
|
|
73
|
+
( __param(0, IInstantiationService)),
|
|
74
|
+
( __param(1, IExtensionService)),
|
|
75
|
+
( __param(2, ILogService))
|
|
76
|
+
], CommandService));
|
|
77
|
+
export { CommandService };
|