@theia/plugin-ext 1.18.0-next.86181832 → 1.18.0-next.89
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/LICENSE +642 -0
- package/lib/common/plugin-api-rpc-model.d.ts +2 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +25 -6
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +21 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +3 -2
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +15 -7
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +1 -0
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +2 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +15 -0
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/quick-open-main.d.ts +1 -1
- package/lib/main/browser/quick-open-main.d.ts.map +1 -1
- package/lib/main/browser/quick-open-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts +3 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +61 -20
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +3 -1
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/call-hierarchy.js +2 -1
- package/lib/plugin/languages/call-hierarchy.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +4 -3
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +34 -15
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +9 -3
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +2 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +24 -3
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +4 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +6 -1
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +9 -2
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +7 -4
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +54 -1
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +81 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +29 -27
- package/src/common/plugin-api-rpc-model.ts +2 -0
- package/src/common/plugin-api-rpc.ts +27 -6
- package/src/common/plugin-protocol.ts +1 -0
- package/src/hosted/browser/hosted-plugin.ts +17 -8
- package/src/hosted/browser/worker/debug-stub.ts +1 -0
- package/src/hosted/node/scanners/scanner-theia.ts +2 -1
- package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +2 -1
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -1
- package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
- package/src/main/browser/debug/plugin-debug-service.ts +23 -0
- package/src/main/browser/debug/plugin-debug-session-factory.ts +1 -1
- package/src/main/browser/quick-open-main.ts +1 -1
- package/src/main/browser/view/plugin-view-registry.ts +66 -23
- package/src/main/browser/view/plugin-view-widget.ts +7 -2
- package/src/main/browser/webview/pre/host.js +19 -10
- package/src/main/browser/webview/pre/main.js +0 -1
- package/src/plugin/languages/call-hierarchy.ts +2 -1
- package/src/plugin/node/debug/debug.ts +40 -19
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
- package/src/plugin/plugin-context.ts +20 -7
- package/src/plugin/plugin-manager.ts +26 -4
- package/src/plugin/plugin-storage.ts +6 -0
- package/src/plugin/quick-open.ts +10 -3
- package/src/plugin/type-converters.ts +7 -5
- package/src/plugin/types-impl.ts +76 -1
|
@@ -15,22 +15,25 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
17
17
|
import { Path } from '@theia/core/lib/common/path';
|
|
18
|
-
import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
|
|
19
18
|
import * as theia from '@theia/plugin';
|
|
20
19
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
21
20
|
import { Breakpoint } from '../../../common/plugin-api-rpc-model';
|
|
22
|
-
import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
|
|
21
|
+
import { DebugConfigurationProviderTriggerKind, DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
|
|
23
22
|
import { PluginPackageDebuggersContribution } from '../../../common/plugin-protocol';
|
|
24
23
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
25
24
|
import { PluginWebSocketChannel } from '../../../common/connection';
|
|
26
25
|
import { CommandRegistryImpl } from '../../command-registry';
|
|
27
26
|
import { ConnectionExtImpl } from '../../connection-ext';
|
|
28
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range,
|
|
29
|
+
DebugAdapterServer, DebugAdapterExecutable, DebugAdapterNamedPipeServer, DebugAdapterInlineImplementation
|
|
30
|
+
} from '../../types-impl';
|
|
29
31
|
import { resolveDebugAdapterExecutable } from './plugin-debug-adapter-executable-resolver';
|
|
30
32
|
import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
|
|
31
|
-
import {
|
|
33
|
+
import { connectInlineDebugAdapter, connectPipeDebugAdapter, connectSocketDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
|
|
32
34
|
import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
|
|
33
35
|
import uuid = require('uuid');
|
|
36
|
+
import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
|
|
34
37
|
|
|
35
38
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
36
39
|
|
|
@@ -43,8 +46,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
43
46
|
// debug sessions by sessionId
|
|
44
47
|
private sessions = new Map<string, PluginDebugAdapterSession>();
|
|
45
48
|
|
|
46
|
-
// providers by type
|
|
49
|
+
// providers by type (initial)
|
|
47
50
|
private configurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
|
|
51
|
+
// providers by type (dynamic)
|
|
52
|
+
private dynamicConfigurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
|
|
53
|
+
|
|
48
54
|
/**
|
|
49
55
|
* Only use internally, don't send it to the frontend. It's expensive!
|
|
50
56
|
* It's already there as a part of the plugin metadata.
|
|
@@ -182,19 +188,22 @@ export class DebugExtImpl implements DebugExt {
|
|
|
182
188
|
});
|
|
183
189
|
}
|
|
184
190
|
|
|
185
|
-
registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider): Disposable {
|
|
186
|
-
console.log(`Debug configuration provider has been registered: ${debugType}`);
|
|
187
|
-
const
|
|
188
|
-
|
|
191
|
+
registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider, trigger: theia.DebugConfigurationProviderTriggerKind): Disposable {
|
|
192
|
+
console.log(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
|
|
193
|
+
const providersByTriggerKind = trigger === DebugConfigurationProviderTriggerKind.Initial ? this.configurationProviders : this.dynamicConfigurationProviders;
|
|
194
|
+
let providers = providersByTriggerKind.get(debugType);
|
|
195
|
+
if (!providers) {
|
|
196
|
+
providersByTriggerKind.set(debugType, providers = new Set());
|
|
197
|
+
}
|
|
189
198
|
providers.add(provider);
|
|
190
199
|
|
|
191
200
|
return Disposable.create(() => {
|
|
192
201
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
193
|
-
const providers =
|
|
202
|
+
const providers = providersByTriggerKind.get(debugType);
|
|
194
203
|
if (providers) {
|
|
195
204
|
providers.delete(provider);
|
|
196
205
|
if (providers.size === 0) {
|
|
197
|
-
|
|
206
|
+
providersByTriggerKind.delete(debugType);
|
|
198
207
|
}
|
|
199
208
|
}
|
|
200
209
|
});
|
|
@@ -319,10 +328,10 @@ export class DebugExtImpl implements DebugExt {
|
|
|
319
328
|
return undefined;
|
|
320
329
|
}
|
|
321
330
|
|
|
322
|
-
async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration[]> {
|
|
331
|
+
async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined, dynamic: boolean = false): Promise<theia.DebugConfiguration[]> {
|
|
323
332
|
let result: theia.DebugConfiguration[] = [];
|
|
324
333
|
|
|
325
|
-
const providers = this.configurationProviders.get(debugType);
|
|
334
|
+
const providers = dynamic ? this.dynamicConfigurationProviders.get(debugType) : this.configurationProviders.get(debugType);
|
|
326
335
|
if (providers) {
|
|
327
336
|
for (const provider of providers) {
|
|
328
337
|
if (provider.provideDebugConfigurations) {
|
|
@@ -337,7 +346,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
337
346
|
async $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration | undefined> {
|
|
338
347
|
let current = debugConfiguration;
|
|
339
348
|
|
|
340
|
-
for (const providers of [
|
|
349
|
+
for (const providers of [
|
|
350
|
+
this.configurationProviders.get(debugConfiguration.type),
|
|
351
|
+
this.dynamicConfigurationProviders.get(debugConfiguration.type),
|
|
352
|
+
this.configurationProviders.get('*')
|
|
353
|
+
]) {
|
|
341
354
|
if (providers) {
|
|
342
355
|
for (const provider of providers) {
|
|
343
356
|
if (provider.resolveDebugConfiguration) {
|
|
@@ -363,7 +376,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
363
376
|
Promise<theia.DebugConfiguration | undefined> {
|
|
364
377
|
let current = debugConfiguration;
|
|
365
378
|
|
|
366
|
-
for (const providers of [
|
|
379
|
+
for (const providers of [
|
|
380
|
+
this.configurationProviders.get(debugConfiguration.type),
|
|
381
|
+
this.dynamicConfigurationProviders.get(debugConfiguration.type),
|
|
382
|
+
this.configurationProviders.get('*')
|
|
383
|
+
]) {
|
|
367
384
|
if (providers) {
|
|
368
385
|
for (const provider of providers) {
|
|
369
386
|
if (provider.resolveDebugConfigurationWithSubstitutedVariables) {
|
|
@@ -409,16 +426,20 @@ export class DebugExtImpl implements DebugExt {
|
|
|
409
426
|
// @param executable The debug adapter's executable information as specified in the package.json (or undefined if no such information exists).
|
|
410
427
|
const descriptor = await descriptorFactory.createDebugAdapterDescriptor(session, executable);
|
|
411
428
|
if (descriptor) {
|
|
412
|
-
if (
|
|
413
|
-
return
|
|
414
|
-
} else {
|
|
429
|
+
if (DebugAdapterServer.is(descriptor)) {
|
|
430
|
+
return connectSocketDebugAdapter(descriptor);
|
|
431
|
+
} else if (DebugAdapterExecutable.is(descriptor)) {
|
|
415
432
|
return startDebugAdapter(descriptor);
|
|
433
|
+
} else if (DebugAdapterNamedPipeServer.is(descriptor)) {
|
|
434
|
+
return connectPipeDebugAdapter(descriptor);
|
|
435
|
+
} else if (DebugAdapterInlineImplementation.is(descriptor)) {
|
|
436
|
+
return connectInlineDebugAdapter(descriptor);
|
|
416
437
|
}
|
|
417
438
|
}
|
|
418
439
|
}
|
|
419
440
|
|
|
420
441
|
if ('debugServer' in debugConfiguration) {
|
|
421
|
-
return
|
|
442
|
+
return connectSocketDebugAdapter({ port: debugConfiguration.debugServer });
|
|
422
443
|
} else {
|
|
423
444
|
if (!executable) {
|
|
424
445
|
throw new Error('It is not possible to provide debug adapter executable.');
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
|
|
18
17
|
import { DebugAdapterSessionImpl } from '@theia/debug/lib/node/debug-adapter-session';
|
|
19
18
|
import * as theia from '@theia/plugin';
|
|
20
19
|
import { IWebSocket } from '@theia/core/shared/vscode-ws-jsonrpc';
|
|
20
|
+
import { CommunicationProvider, DebugAdapterSession } from '@theia/debug/lib/node/debug-model';
|
|
21
21
|
|
|
22
22
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Server debug adapter session.
|
|
26
26
|
*/
|
|
27
|
-
export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession {
|
|
27
|
+
export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession, DebugAdapterSession {
|
|
28
28
|
readonly type: string;
|
|
29
29
|
readonly name: string;
|
|
30
30
|
readonly configuration: theia.DebugConfiguration;
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
|
-
|
|
33
|
+
readonly communicationProvider: CommunicationProvider,
|
|
34
34
|
protected readonly tracker: theia.DebugAdapterTracker,
|
|
35
35
|
protected readonly theiaSession: theia.DebugSession) {
|
|
36
36
|
|
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import * as net from 'net';
|
|
18
|
-
import * as theia from '@theia/plugin';
|
|
19
|
-
import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
|
|
20
18
|
import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
|
|
19
|
+
import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
|
|
20
|
+
import { StreamCommunicationProvider } from '@theia/debug/lib/node/stream-communication-provider';
|
|
21
|
+
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
22
|
+
import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
|
|
23
|
+
import { InlineCommunicationProvider } from '@theia/debug/lib/node/inline-communication-provider';
|
|
21
24
|
const isElectron = require('is-electron');
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Starts debug adapter process.
|
|
25
28
|
*/
|
|
26
|
-
export function startDebugAdapter(executable:
|
|
29
|
+
export function startDebugAdapter(executable: DebugAdapterExecutable): CommunicationProvider {
|
|
27
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
31
|
const options: any = { stdio: ['pipe', 'pipe', 2] };
|
|
29
32
|
|
|
@@ -63,21 +66,28 @@ export function startDebugAdapter(executable: theia.DebugAdapterExecutable): Com
|
|
|
63
66
|
childProcess = spawn(command, args, options);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
dispose: () => childProcess.kill()
|
|
70
|
-
};
|
|
69
|
+
const provider = new StreamCommunicationProvider(childProcess.stdout!, childProcess.stdin!);
|
|
70
|
+
provider.push(Disposable.create(() => childProcess.kill()));
|
|
71
|
+
return provider;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/**
|
|
74
75
|
* Connects to a remote debug server.
|
|
75
76
|
*/
|
|
76
|
-
export function
|
|
77
|
+
export function connectSocketDebugAdapter(server: DebugAdapterServer): CommunicationProvider {
|
|
77
78
|
const socket = net.createConnection(server.port, server.host);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
const provider = new StreamCommunicationProvider(socket, socket);
|
|
80
|
+
provider.push(Disposable.create(() => socket.end()));
|
|
81
|
+
return provider;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): CommunicationProvider {
|
|
85
|
+
const socket = net.createConnection(adapter.path);
|
|
86
|
+
const provider = new StreamCommunicationProvider(socket, socket);
|
|
87
|
+
provider.push(Disposable.create(() => socket.end()));
|
|
88
|
+
return provider;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): CommunicationProvider {
|
|
92
|
+
return new InlineCommunicationProvider(adapter.implementation);
|
|
83
93
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
/* tslint:disable:typedef */
|
|
19
19
|
|
|
20
|
-
import * as theia from '@theia/plugin';
|
|
20
|
+
import type * as theia from '@theia/plugin';
|
|
21
21
|
import { CommandRegistryImpl } from './command-registry';
|
|
22
22
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
23
23
|
import { CancellationTokenSource } from '@theia/core/lib/common/cancellation';
|
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
Plugin as InternalPlugin,
|
|
28
28
|
PluginManager,
|
|
29
29
|
PluginAPIFactory,
|
|
30
|
-
MainMessageType
|
|
30
|
+
MainMessageType,
|
|
31
|
+
DebugConfigurationProviderTriggerKind
|
|
31
32
|
} from '../common/plugin-api-rpc';
|
|
32
33
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
33
34
|
import { MessageRegistryExt } from './message-registry';
|
|
@@ -105,6 +106,8 @@ import {
|
|
|
105
106
|
Task2,
|
|
106
107
|
DebugAdapterExecutable,
|
|
107
108
|
DebugAdapterServer,
|
|
109
|
+
DebugAdapterNamedPipeServer,
|
|
110
|
+
DebugAdapterInlineImplementation,
|
|
108
111
|
Breakpoint,
|
|
109
112
|
SourceBreakpoint,
|
|
110
113
|
FunctionBreakpoint,
|
|
@@ -134,7 +137,8 @@ import {
|
|
|
134
137
|
ColorThemeKind,
|
|
135
138
|
SourceControlInputBoxValidationType,
|
|
136
139
|
URI,
|
|
137
|
-
FileDecoration
|
|
140
|
+
FileDecoration,
|
|
141
|
+
ExtensionMode
|
|
138
142
|
} from './types-impl';
|
|
139
143
|
import { AuthenticationExtImpl } from './authentication-ext';
|
|
140
144
|
import { SymbolKind } from '../common/plugin-api-rpc-model';
|
|
@@ -149,7 +153,7 @@ import { LanguagesExtImpl } from './languages';
|
|
|
149
153
|
import { fromDocumentSelector, pluginToPluginInfo, fromGlobPattern } from './type-converters';
|
|
150
154
|
import { DialogsExtImpl } from './dialogs';
|
|
151
155
|
import { NotificationExtImpl } from './notification';
|
|
152
|
-
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
156
|
+
import { CancellationToken, CancellationError } from '@theia/core/lib/common/cancellation';
|
|
153
157
|
import { score } from '@theia/callhierarchy/lib/common/language-selector';
|
|
154
158
|
import { MarkdownString } from './markdown-string';
|
|
155
159
|
import { TreeViewsExtImpl } from './tree/tree-views';
|
|
@@ -767,8 +771,12 @@ export function createAPIFactory(
|
|
|
767
771
|
registerDebugAdapterDescriptorFactory(debugType: string, factory: theia.DebugAdapterDescriptorFactory): Disposable {
|
|
768
772
|
return debugExt.registerDebugAdapterDescriptorFactory(debugType, factory);
|
|
769
773
|
},
|
|
770
|
-
registerDebugConfigurationProvider(
|
|
771
|
-
|
|
774
|
+
registerDebugConfigurationProvider(
|
|
775
|
+
debugType: string,
|
|
776
|
+
provider: theia.DebugConfigurationProvider,
|
|
777
|
+
triggerKind?: theia.DebugConfigurationProviderTriggerKind
|
|
778
|
+
): Disposable {
|
|
779
|
+
return debugExt.registerDebugConfigurationProvider(debugType, provider, triggerKind || DebugConfigurationProviderTriggerKind.Initial);
|
|
772
780
|
},
|
|
773
781
|
registerDebugAdapterTrackerFactory(debugType: string, factory: theia.DebugAdapterTrackerFactory): Disposable {
|
|
774
782
|
return debugExt.registerDebugAdapterTrackerFactory(debugType, factory);
|
|
@@ -924,6 +932,9 @@ export function createAPIFactory(
|
|
|
924
932
|
Task2,
|
|
925
933
|
DebugAdapterExecutable,
|
|
926
934
|
DebugAdapterServer,
|
|
935
|
+
DebugAdapterNamedPipeServer,
|
|
936
|
+
DebugAdapterInlineImplementation,
|
|
937
|
+
DebugConfigurationProviderTriggerKind,
|
|
927
938
|
Breakpoint,
|
|
928
939
|
SourceBreakpoint,
|
|
929
940
|
FunctionBreakpoint,
|
|
@@ -952,7 +963,9 @@ export function createAPIFactory(
|
|
|
952
963
|
SemanticTokensEdit,
|
|
953
964
|
ColorThemeKind,
|
|
954
965
|
SourceControlInputBoxValidationType,
|
|
955
|
-
FileDecoration
|
|
966
|
+
FileDecoration,
|
|
967
|
+
CancellationError,
|
|
968
|
+
ExtensionMode
|
|
956
969
|
};
|
|
957
970
|
};
|
|
958
971
|
}
|
|
@@ -33,7 +33,7 @@ import * as theia from '@theia/plugin';
|
|
|
33
33
|
import { join } from './path';
|
|
34
34
|
import { EnvExtImpl } from './env';
|
|
35
35
|
import { PreferenceRegistryExtImpl } from './preference-registry';
|
|
36
|
-
import { Memento, KeyValueStorageProxy } from './plugin-storage';
|
|
36
|
+
import { Memento, KeyValueStorageProxy, GlobalState } from './plugin-storage';
|
|
37
37
|
import { ExtPluginApi } from '../common/plugin-ext-api-contribution';
|
|
38
38
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
39
39
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
@@ -79,7 +79,11 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
79
79
|
'*',
|
|
80
80
|
'onLanguage',
|
|
81
81
|
'onCommand',
|
|
82
|
-
'onDebug',
|
|
82
|
+
'onDebug',
|
|
83
|
+
'onDebugInitialConfigurations',
|
|
84
|
+
'onDebugResolve',
|
|
85
|
+
'onDebugAdapterProtocolTracker',
|
|
86
|
+
'onDebugDynamicConfigurations',
|
|
83
87
|
'workspaceContains',
|
|
84
88
|
'onView',
|
|
85
89
|
'onUri',
|
|
@@ -321,6 +325,23 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
321
325
|
}
|
|
322
326
|
|
|
323
327
|
async $activateByEvent(activationEvent: string): Promise<void> {
|
|
328
|
+
if (activationEvent.endsWith(':*')) {
|
|
329
|
+
const baseEvent = activationEvent.substring(0, activationEvent.length - 2);
|
|
330
|
+
await this.activateByBaseEvent(baseEvent);
|
|
331
|
+
} else {
|
|
332
|
+
await this.activateBySingleEvent(activationEvent);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
protected async activateByBaseEvent(baseEvent: string): Promise<void> {
|
|
337
|
+
await Promise.all(Array.from(this.activations.keys(), activation => {
|
|
338
|
+
if (activation.startsWith(baseEvent)) {
|
|
339
|
+
return this.activateBySingleEvent(activation);
|
|
340
|
+
}
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
protected async activateBySingleEvent(activationEvent: string): Promise<void> {
|
|
324
345
|
const activations = this.activations.get(activationEvent);
|
|
325
346
|
if (!activations) {
|
|
326
347
|
return;
|
|
@@ -351,7 +372,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
351
372
|
const pluginContext: theia.PluginContext = {
|
|
352
373
|
extensionPath: plugin.pluginFolder,
|
|
353
374
|
extensionUri: Uri.file(plugin.pluginFolder),
|
|
354
|
-
globalState: new
|
|
375
|
+
globalState: new GlobalState(plugin.model.id, true, this.storageProxy),
|
|
355
376
|
workspaceState: new Memento(plugin.model.id, false, this.storageProxy),
|
|
356
377
|
subscriptions: subscriptions,
|
|
357
378
|
asAbsolutePath: asAbsolutePath,
|
|
@@ -361,7 +382,8 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
361
382
|
secrets,
|
|
362
383
|
globalStoragePath: globalStoragePath,
|
|
363
384
|
globalStorageUri: Uri.file(globalStoragePath),
|
|
364
|
-
environmentVariableCollection: this.terminalService.getEnvironmentVariableCollection(plugin.model.id)
|
|
385
|
+
environmentVariableCollection: this.terminalService.getEnvironmentVariableCollection(plugin.model.id),
|
|
386
|
+
extensionMode: 1 // @todo: implement proper `extensionMode`.
|
|
365
387
|
};
|
|
366
388
|
this.pluginContextsMap.set(plugin.model.id, pluginContext);
|
|
367
389
|
|
|
@@ -60,6 +60,12 @@ export class Memento implements theia.Memento {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
export class GlobalState extends Memento {
|
|
64
|
+
|
|
65
|
+
/** @todo: API is not yet implemented. */
|
|
66
|
+
setKeysForSync(keys: readonly string[]): void { }
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
/**
|
|
64
70
|
* Singleton.
|
|
65
71
|
* Is used to proxy storage requests to main side.
|
package/src/plugin/quick-open.ts
CHANGED
|
@@ -259,7 +259,7 @@ export class QuickInputExt implements QuickInput {
|
|
|
259
259
|
private onDidHideEmitter: Emitter<void>;
|
|
260
260
|
private onDidTriggerButtonEmitter: Emitter<theia.QuickInputButton>;
|
|
261
261
|
private _updateTimeout: any;
|
|
262
|
-
private _pendingUpdate: TransferQuickInput
|
|
262
|
+
private _pendingUpdate: TransferQuickInput = { id: this._id };
|
|
263
263
|
|
|
264
264
|
constructor(readonly quickOpen: QuickOpenExtImpl, readonly quickOpenMain: QuickOpenMain, readonly plugin: Plugin, private _onDidDispose: () => void) {
|
|
265
265
|
this.title = undefined;
|
|
@@ -613,9 +613,16 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
|
|
|
613
613
|
this._handlesToItems.set(i, item);
|
|
614
614
|
this._itemsToHandles.set(item, i);
|
|
615
615
|
});
|
|
616
|
-
items.forEach((item, i) => Object.assign(item, { handle: i }));
|
|
617
616
|
this.update({
|
|
618
|
-
items
|
|
617
|
+
items: items.map((item, i) => ({
|
|
618
|
+
type: item.type,
|
|
619
|
+
label: item.label,
|
|
620
|
+
description: item.description,
|
|
621
|
+
handle: i,
|
|
622
|
+
detail: item.detail,
|
|
623
|
+
picked: item.picked,
|
|
624
|
+
alwaysShow: item.alwaysShow
|
|
625
|
+
}))
|
|
619
626
|
});
|
|
620
627
|
}
|
|
621
628
|
|
|
@@ -169,10 +169,7 @@ export function fromRangeOrRangeWithMessage(ranges: theia.Range[] | theia.Decora
|
|
|
169
169
|
};
|
|
170
170
|
});
|
|
171
171
|
} else {
|
|
172
|
-
return ranges.map((r)
|
|
173
|
-
({
|
|
174
|
-
range: fromRange(r)!
|
|
175
|
-
}));
|
|
172
|
+
return ranges.map(r => ({ range: fromRange(r) }));
|
|
176
173
|
}
|
|
177
174
|
}
|
|
178
175
|
|
|
@@ -272,6 +269,8 @@ export function fromCompletionItemKind(kind?: types.CompletionItemKind): model.C
|
|
|
272
269
|
case types.CompletionItemKind.Event: return model.CompletionItemKind.Event;
|
|
273
270
|
case types.CompletionItemKind.Operator: return model.CompletionItemKind.Operator;
|
|
274
271
|
case types.CompletionItemKind.TypeParameter: return model.CompletionItemKind.TypeParameter;
|
|
272
|
+
case types.CompletionItemKind.User: return model.CompletionItemKind.User;
|
|
273
|
+
case types.CompletionItemKind.Issue: return model.CompletionItemKind.Issue;
|
|
275
274
|
}
|
|
276
275
|
return model.CompletionItemKind.Property;
|
|
277
276
|
}
|
|
@@ -303,6 +302,8 @@ export function toCompletionItemKind(kind?: model.CompletionItemKind): types.Com
|
|
|
303
302
|
case model.CompletionItemKind.Event: return types.CompletionItemKind.Event;
|
|
304
303
|
case model.CompletionItemKind.Operator: return types.CompletionItemKind.Operator;
|
|
305
304
|
case model.CompletionItemKind.TypeParameter: return types.CompletionItemKind.TypeParameter;
|
|
305
|
+
case model.CompletionItemKind.User: return types.CompletionItemKind.User;
|
|
306
|
+
case model.CompletionItemKind.Issue: return types.CompletionItemKind.Issue;
|
|
306
307
|
}
|
|
307
308
|
return types.CompletionItemKind.Property;
|
|
308
309
|
}
|
|
@@ -682,7 +683,8 @@ export function fromCallHierarchyItem(item: theia.CallHierarchyItem): model.Call
|
|
|
682
683
|
detail: item.detail,
|
|
683
684
|
uri: item.uri,
|
|
684
685
|
range: fromRange(item.range),
|
|
685
|
-
selectionRange: fromRange(item.selectionRange)
|
|
686
|
+
selectionRange: fromRange(item.selectionRange),
|
|
687
|
+
tags: item.tags
|
|
686
688
|
};
|
|
687
689
|
}
|
|
688
690
|
|
package/src/plugin/types-impl.ts
CHANGED
|
@@ -189,6 +189,26 @@ export enum ColorThemeKind {
|
|
|
189
189
|
HighContrast = 3
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
export enum ExtensionMode {
|
|
193
|
+
/**
|
|
194
|
+
* The extension is installed normally (for example, from the marketplace
|
|
195
|
+
* or VSIX) in the editor.
|
|
196
|
+
*/
|
|
197
|
+
Production = 1,
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The extension is running from an `--extensionDevelopmentPath` provided
|
|
201
|
+
* when launching the editor.
|
|
202
|
+
*/
|
|
203
|
+
Development = 2,
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The extension is running from an `--extensionTestsPath` and
|
|
207
|
+
* the extension host is running unit tests.
|
|
208
|
+
*/
|
|
209
|
+
Test = 3,
|
|
210
|
+
}
|
|
211
|
+
|
|
192
212
|
/**
|
|
193
213
|
* Represents the validation type of the Source Control input.
|
|
194
214
|
*/
|
|
@@ -892,7 +912,9 @@ export enum CompletionItemKind {
|
|
|
892
912
|
Struct = 21,
|
|
893
913
|
Event = 22,
|
|
894
914
|
Operator = 23,
|
|
895
|
-
TypeParameter = 24
|
|
915
|
+
TypeParameter = 24,
|
|
916
|
+
User = 25,
|
|
917
|
+
Issue = 26
|
|
896
918
|
}
|
|
897
919
|
|
|
898
920
|
@es5ClassCompat
|
|
@@ -2098,6 +2120,12 @@ export class DebugAdapterExecutable {
|
|
|
2098
2120
|
}
|
|
2099
2121
|
}
|
|
2100
2122
|
|
|
2123
|
+
export namespace DebugAdapterExecutable {
|
|
2124
|
+
export function is(adapter: theia.DebugAdapterDescriptor | undefined): adapter is theia.DebugAdapterExecutable {
|
|
2125
|
+
return !!adapter && 'command' in adapter;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2101
2129
|
/**
|
|
2102
2130
|
* Represents a debug adapter running as a socket based server.
|
|
2103
2131
|
*/
|
|
@@ -2123,6 +2151,52 @@ export class DebugAdapterServer {
|
|
|
2123
2151
|
}
|
|
2124
2152
|
}
|
|
2125
2153
|
|
|
2154
|
+
export namespace DebugAdapterServer {
|
|
2155
|
+
export function is(adapter: theia.DebugAdapterDescriptor | undefined): adapter is DebugAdapterServer {
|
|
2156
|
+
return !!adapter && 'port' in adapter;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* Represents a debug adapter running as a Named Pipe (on Windows)/UNIX Domain Socket (on non-Windows) based server.
|
|
2162
|
+
*/
|
|
2163
|
+
@es5ClassCompat
|
|
2164
|
+
export class DebugAdapterNamedPipeServer {
|
|
2165
|
+
/**
|
|
2166
|
+
* Create a description for a debug adapter running as a Named Pipe (on Windows)/UNIX Domain Socket (on non-Windows) based server.
|
|
2167
|
+
*/
|
|
2168
|
+
constructor(readonly path: string) { }
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
export namespace DebugAdapterNamedPipeServer {
|
|
2172
|
+
export function is(adapter: theia.DebugAdapterDescriptor | undefined): adapter is DebugAdapterNamedPipeServer {
|
|
2173
|
+
return !!adapter && 'path' in adapter;
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
/**
|
|
2178
|
+
* A debug adapter descriptor for an inline implementation.
|
|
2179
|
+
*/
|
|
2180
|
+
@es5ClassCompat
|
|
2181
|
+
export class DebugAdapterInlineImplementation {
|
|
2182
|
+
implementation: theia.DebugAdapter;
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Create a descriptor for an inline implementation of a debug adapter.
|
|
2186
|
+
*/
|
|
2187
|
+
constructor(impl: theia.DebugAdapter) {
|
|
2188
|
+
this.implementation = impl;
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
export namespace DebugAdapterInlineImplementation {
|
|
2193
|
+
export function is(adapter: theia.DebugAdapterDescriptor | undefined): adapter is DebugAdapterInlineImplementation {
|
|
2194
|
+
return !!adapter && 'implementation' in adapter;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
export type DebugAdapterDescriptor = DebugAdapterExecutable | DebugAdapterServer | DebugAdapterNamedPipeServer | DebugAdapterInlineImplementation;
|
|
2199
|
+
|
|
2126
2200
|
export enum LogLevel {
|
|
2127
2201
|
Trace = 1,
|
|
2128
2202
|
Debug = 2,
|
|
@@ -2344,6 +2418,7 @@ export class CallHierarchyItem {
|
|
|
2344
2418
|
uri: URI;
|
|
2345
2419
|
range: Range;
|
|
2346
2420
|
selectionRange: Range;
|
|
2421
|
+
tags?: readonly SymbolTag[];
|
|
2347
2422
|
|
|
2348
2423
|
constructor(kind: SymbolKind, name: string, detail: string, uri: URI, range: Range, selectionRange: Range) {
|
|
2349
2424
|
this.kind = kind;
|