@theia/plugin-ext 1.19.0 → 1.21.0-next.14
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/lib/common/connection.d.ts +47 -33
- package/lib/common/connection.d.ts.map +1 -1
- package/lib/common/connection.js +90 -28
- package/lib/common/connection.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +2 -3
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +2 -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.js +1 -1
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +4 -1
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts +3 -3
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +1 -2
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +4 -4
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/file-system-main-impl.js +1 -1
- package/lib/main/browser/file-system-main-impl.js.map +1 -1
- package/lib/main/browser/main-context.js +2 -2
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/tasks-main.d.ts.map +1 -1
- package/lib/main/browser/tasks-main.js +6 -0
- package/lib/main/browser/tasks-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +14 -3
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +0 -3
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +1 -11
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +5 -5
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +4 -4
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +3 -4
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +7 -7
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js +6 -6
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +7 -5
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +6 -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 +2 -2
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/quick-open.d.ts +1 -1
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +2 -4
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +1 -3
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.js +3 -17
- package/lib/plugin/tasks/tasks.js.map +1 -1
- package/package.json +24 -24
- package/src/common/connection.ts +98 -41
- package/src/common/plugin-api-rpc.ts +2 -4
- package/src/common/plugin-protocol.ts +2 -2
- package/src/hosted/browser/hosted-plugin.ts +1 -1
- package/src/hosted/node/scanners/scanner-theia.ts +5 -3
- package/src/main/browser/debug/debug-main.ts +3 -4
- package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
- package/src/main/browser/file-system-main-impl.ts +1 -1
- package/src/main/browser/main-context.ts +3 -3
- package/src/main/browser/style/tree.css +4 -0
- package/src/main/browser/tasks-main.ts +7 -0
- package/src/main/browser/view/plugin-view-registry.ts +16 -3
- package/src/main/browser/view/tree-view-widget.tsx +2 -19
- package/src/plugin/message-registry.ts +5 -6
- package/src/plugin/node/debug/debug.ts +7 -8
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +9 -9
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +11 -18
- package/src/plugin/plugin-context.ts +4 -3
- package/src/plugin/quick-open.ts +4 -7
- package/src/plugin/tasks/tasks.ts +4 -18
- package/lib/common/plugin-message-reader.d.ts +0 -46
- package/lib/common/plugin-message-reader.d.ts.map +0 -1
- package/lib/common/plugin-message-reader.js +0 -116
- package/lib/common/plugin-message-reader.js.map +0 -1
- package/lib/common/plugin-message-writer.d.ts +0 -38
- package/lib/common/plugin-message-writer.d.ts.map +0 -1
- package/lib/common/plugin-message-writer.js +0 -67
- package/lib/common/plugin-message-writer.js.map +0 -1
- package/lib/main/browser/connection-main.d.ts +0 -59
- package/lib/main/browser/connection-main.d.ts.map +0 -1
- package/lib/main/browser/connection-main.js +0 -98
- package/lib/main/browser/connection-main.js.map +0 -1
- package/lib/plugin/connection-ext.d.ts +0 -56
- package/lib/plugin/connection-ext.d.ts.map +0 -1
- package/lib/plugin/connection-ext.js +0 -88
- package/lib/plugin/connection-ext.js.map +0 -1
- package/src/common/plugin-message-reader.ts +0 -111
- package/src/common/plugin-message-writer.ts +0 -65
- package/src/main/browser/connection-main.ts +0 -107
- package/src/plugin/connection-ext.ts +0 -95
|
@@ -21,9 +21,8 @@ import { Breakpoint } from '../../../common/plugin-api-rpc-model';
|
|
|
21
21
|
import { DebugConfigurationProviderTriggerKind, DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
|
|
22
22
|
import { PluginPackageDebuggersContribution } from '../../../common/plugin-protocol';
|
|
23
23
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
24
|
-
import { PluginWebSocketChannel } from '../../../common/connection';
|
|
25
24
|
import { CommandRegistryImpl } from '../../command-registry';
|
|
26
|
-
import {
|
|
25
|
+
import { ConnectionImpl } from '../../../common/connection';
|
|
27
26
|
import {
|
|
28
27
|
Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range,
|
|
29
28
|
DebugAdapterServer, DebugAdapterExecutable, DebugAdapterNamedPipeServer, DebugAdapterInlineImplementation
|
|
@@ -33,7 +32,7 @@ import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
|
|
|
33
32
|
import { connectInlineDebugAdapter, connectPipeDebugAdapter, connectSocketDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
|
|
34
33
|
import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
|
|
35
34
|
import uuid = require('uuid');
|
|
36
|
-
import {
|
|
35
|
+
import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
|
|
37
36
|
|
|
38
37
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
39
38
|
|
|
@@ -60,7 +59,7 @@ export class DebugExtImpl implements DebugExt {
|
|
|
60
59
|
private trackerFactories: [string, theia.DebugAdapterTrackerFactory][] = [];
|
|
61
60
|
private contributionPaths = new Map<string, string>();
|
|
62
61
|
|
|
63
|
-
private connectionExt:
|
|
62
|
+
private connectionExt: ConnectionImpl;
|
|
64
63
|
private commandRegistryExt: CommandRegistryImpl;
|
|
65
64
|
|
|
66
65
|
private proxy: DebugMain;
|
|
@@ -91,7 +90,7 @@ export class DebugExtImpl implements DebugExt {
|
|
|
91
90
|
/**
|
|
92
91
|
* Sets dependencies.
|
|
93
92
|
*/
|
|
94
|
-
assistedInject(connectionExt:
|
|
93
|
+
assistedInject(connectionExt: ConnectionImpl, commandRegistryExt: CommandRegistryImpl): void {
|
|
95
94
|
this.connectionExt = connectionExt;
|
|
96
95
|
this.commandRegistryExt = commandRegistryExt;
|
|
97
96
|
}
|
|
@@ -301,13 +300,13 @@ export class DebugExtImpl implements DebugExt {
|
|
|
301
300
|
};
|
|
302
301
|
|
|
303
302
|
const tracker = await this.createDebugAdapterTracker(theiaSession);
|
|
304
|
-
const communicationProvider = await this.
|
|
303
|
+
const communicationProvider = await this.createDebugAdapter(theiaSession, debugConfiguration);
|
|
305
304
|
|
|
306
305
|
const debugAdapterSession = new PluginDebugAdapterSession(communicationProvider, tracker, theiaSession);
|
|
307
306
|
this.sessions.set(sessionId, debugAdapterSession);
|
|
308
307
|
|
|
309
308
|
const connection = await this.connectionExt!.ensureConnection(sessionId);
|
|
310
|
-
debugAdapterSession.start(
|
|
309
|
+
debugAdapterSession.start(connection);
|
|
311
310
|
|
|
312
311
|
return sessionId;
|
|
313
312
|
}
|
|
@@ -406,7 +405,7 @@ export class DebugExtImpl implements DebugExt {
|
|
|
406
405
|
return PluginDebugAdapterTracker.create(session, this.trackerFactories);
|
|
407
406
|
}
|
|
408
407
|
|
|
409
|
-
protected async
|
|
408
|
+
protected async createDebugAdapter(session: theia.DebugSession, debugConfiguration: theia.DebugConfiguration): Promise<DebugAdapter> {
|
|
410
409
|
const executable = await this.resolveDebugAdapterExecutable(debugConfiguration);
|
|
411
410
|
const descriptorFactory = this.descriptorFactories.get(session.type);
|
|
412
411
|
if (descriptorFactory) {
|
|
@@ -16,32 +16,32 @@
|
|
|
16
16
|
|
|
17
17
|
import { DebugAdapterSessionImpl } from '@theia/debug/lib/node/debug-adapter-session';
|
|
18
18
|
import * as theia from '@theia/plugin';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
|
|
20
|
+
import { Channel } from '@theia/debug/lib/common/debug-service';
|
|
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
|
|
27
|
+
export class PluginDebugAdapterSession extends DebugAdapterSessionImpl {
|
|
28
28
|
readonly type: string;
|
|
29
29
|
readonly name: string;
|
|
30
30
|
readonly configuration: theia.DebugConfiguration;
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
|
-
readonly
|
|
33
|
+
readonly debugAdapter: DebugAdapter,
|
|
34
34
|
protected readonly tracker: theia.DebugAdapterTracker,
|
|
35
35
|
protected readonly theiaSession: theia.DebugSession) {
|
|
36
36
|
|
|
37
|
-
super(theiaSession.id,
|
|
37
|
+
super(theiaSession.id, debugAdapter);
|
|
38
38
|
|
|
39
39
|
this.type = theiaSession.type;
|
|
40
40
|
this.name = theiaSession.name;
|
|
41
41
|
this.configuration = theiaSession.configuration;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
async start(channel:
|
|
44
|
+
async start(channel: Channel): Promise<void> {
|
|
45
45
|
if (this.tracker.onWillStartSession) {
|
|
46
46
|
this.tracker.onWillStartSession();
|
|
47
47
|
}
|
|
@@ -83,10 +83,10 @@ export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implement
|
|
|
83
83
|
super.write(message);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
protected onDebugAdapterExit(
|
|
86
|
+
protected onDebugAdapterExit(): void {
|
|
87
87
|
if (this.tracker.onExit) {
|
|
88
|
-
this.tracker.onExit(
|
|
88
|
+
this.tracker.onExit(undefined, undefined);
|
|
89
89
|
}
|
|
90
|
-
super.onDebugAdapterExit(
|
|
90
|
+
super.onDebugAdapterExit();
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -16,17 +16,16 @@
|
|
|
16
16
|
|
|
17
17
|
import * as net from 'net';
|
|
18
18
|
import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
|
|
19
|
-
import {
|
|
20
|
-
import { StreamCommunicationProvider } from '@theia/debug/lib/node/stream-communication-provider';
|
|
21
|
-
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
19
|
+
import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
|
|
22
20
|
import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
|
|
23
|
-
import {
|
|
21
|
+
import { InlineDebugAdapter } from '@theia/debug/lib/node/inline-debug-adapter';
|
|
22
|
+
import { ProcessDebugAdapter, SocketDebugAdapter } from '@theia/debug/lib/node/stream-debug-adapter';
|
|
24
23
|
const isElectron = require('is-electron');
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Starts debug adapter process.
|
|
28
27
|
*/
|
|
29
|
-
export function startDebugAdapter(executable: DebugAdapterExecutable):
|
|
28
|
+
export function startDebugAdapter(executable: DebugAdapterExecutable): DebugAdapter {
|
|
30
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
30
|
const options: any = { stdio: ['pipe', 'pipe', 2] };
|
|
32
31
|
|
|
@@ -66,28 +65,22 @@ export function startDebugAdapter(executable: DebugAdapterExecutable): Communica
|
|
|
66
65
|
childProcess = spawn(command, args, options);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
provider.push(Disposable.create(() => childProcess.kill()));
|
|
71
|
-
return provider;
|
|
68
|
+
return new ProcessDebugAdapter(childProcess);
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
/**
|
|
75
72
|
* Connects to a remote debug server.
|
|
76
73
|
*/
|
|
77
|
-
export function connectSocketDebugAdapter(server: DebugAdapterServer):
|
|
74
|
+
export function connectSocketDebugAdapter(server: DebugAdapterServer): SocketDebugAdapter {
|
|
78
75
|
const socket = net.createConnection(server.port, server.host);
|
|
79
|
-
|
|
80
|
-
provider.push(Disposable.create(() => socket.end()));
|
|
81
|
-
return provider;
|
|
76
|
+
return new SocketDebugAdapter(socket);
|
|
82
77
|
}
|
|
83
78
|
|
|
84
|
-
export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer):
|
|
79
|
+
export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): SocketDebugAdapter {
|
|
85
80
|
const socket = net.createConnection(adapter.path);
|
|
86
|
-
|
|
87
|
-
provider.push(Disposable.create(() => socket.end()));
|
|
88
|
-
return provider;
|
|
81
|
+
return new SocketDebugAdapter(socket);
|
|
89
82
|
}
|
|
90
83
|
|
|
91
|
-
export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation):
|
|
92
|
-
return new
|
|
84
|
+
export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): InlineDebugAdapter {
|
|
85
|
+
return new InlineDebugAdapter(adapter.implementation);
|
|
93
86
|
}
|
|
@@ -28,7 +28,8 @@ import {
|
|
|
28
28
|
PluginManager,
|
|
29
29
|
PluginAPIFactory,
|
|
30
30
|
MainMessageType,
|
|
31
|
-
DebugConfigurationProviderTriggerKind
|
|
31
|
+
DebugConfigurationProviderTriggerKind,
|
|
32
|
+
PLUGIN_RPC_CONTEXT
|
|
32
33
|
} from '../common/plugin-api-rpc';
|
|
33
34
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
34
35
|
import { MessageRegistryExt } from './message-registry';
|
|
@@ -156,7 +157,7 @@ import { NotificationExtImpl } from './notification';
|
|
|
156
157
|
import { score } from '@theia/callhierarchy/lib/common/language-selector';
|
|
157
158
|
import { MarkdownString } from './markdown-string';
|
|
158
159
|
import { TreeViewsExtImpl } from './tree/tree-views';
|
|
159
|
-
import {
|
|
160
|
+
import { ConnectionImpl } from '../common/connection';
|
|
160
161
|
import { TasksExtImpl } from './tasks/tasks';
|
|
161
162
|
import { DebugExtImpl } from './node/debug/debug';
|
|
162
163
|
import { FileSystemExtImpl } from './file-system-ext-impl';
|
|
@@ -200,7 +201,7 @@ export function createAPIFactory(
|
|
|
200
201
|
const languagesExt = rpc.set(MAIN_RPC_CONTEXT.LANGUAGES_EXT, new LanguagesExtImpl(rpc, documents, commandRegistry));
|
|
201
202
|
const treeViewsExt = rpc.set(MAIN_RPC_CONTEXT.TREE_VIEWS_EXT, new TreeViewsExtImpl(rpc, commandRegistry));
|
|
202
203
|
const tasksExt = rpc.set(MAIN_RPC_CONTEXT.TASKS_EXT, new TasksExtImpl(rpc, terminalExt));
|
|
203
|
-
const connectionExt = rpc.set(MAIN_RPC_CONTEXT.CONNECTION_EXT, new
|
|
204
|
+
const connectionExt = rpc.set(MAIN_RPC_CONTEXT.CONNECTION_EXT, new ConnectionImpl(rpc.getProxy(PLUGIN_RPC_CONTEXT.CONNECTION_MAIN)));
|
|
204
205
|
const fileSystemExt = rpc.set(MAIN_RPC_CONTEXT.FILE_SYSTEM_EXT, new FileSystemExtImpl(rpc, languagesExt));
|
|
205
206
|
const extHostFileSystemEvent = rpc.set(MAIN_RPC_CONTEXT.ExtHostFileSystemEventService, new ExtHostFileSystemEventService(rpc, editorsAndDocumentsExt));
|
|
206
207
|
const scmExt = rpc.set(MAIN_RPC_CONTEXT.SCM_EXT, new ScmExtImpl(rpc, commandRegistry));
|
package/src/plugin/quick-open.ts
CHANGED
|
@@ -30,6 +30,7 @@ import * as path from 'path';
|
|
|
30
30
|
import { convertToTransferQuickPickItems } from './type-converters';
|
|
31
31
|
import { PluginPackage } from '../common/plugin-protocol';
|
|
32
32
|
import { QuickInputButtonHandle } from '@theia/core/lib/browser';
|
|
33
|
+
import { MaybePromise } from '@theia/core/lib/common/types';
|
|
33
34
|
|
|
34
35
|
const canceledName = 'Canceled';
|
|
35
36
|
/**
|
|
@@ -64,7 +65,7 @@ export function getDarkIconUri(iconPath: URI | { light: URI; dark: URI; }): URI
|
|
|
64
65
|
export class QuickOpenExtImpl implements QuickOpenExt {
|
|
65
66
|
private proxy: QuickOpenMain;
|
|
66
67
|
private onDidSelectItem: undefined | ((handle: number) => void);
|
|
67
|
-
private validateInputHandler
|
|
68
|
+
private validateInputHandler?: (input: string) => MaybePromise<string | null | undefined>;
|
|
68
69
|
private _sessions = new Map<number, QuickInputExt>(); // Each quickinput will have a number so that we know where to fire events
|
|
69
70
|
private _instances = 0;
|
|
70
71
|
|
|
@@ -143,17 +144,13 @@ export class QuickOpenExtImpl implements QuickOpenExt {
|
|
|
143
144
|
// ---- input
|
|
144
145
|
|
|
145
146
|
showInput(options?: InputBoxOptions, token: theia.CancellationToken = CancellationToken.None): PromiseLike<string | undefined> {
|
|
146
|
-
|
|
147
|
-
this.validateInputHandler = options.validateInput;
|
|
148
|
-
}
|
|
149
|
-
|
|
147
|
+
this.validateInputHandler = options?.validateInput;
|
|
150
148
|
if (!options) { options = { placeHolder: '' }; }
|
|
151
149
|
return this.proxy.$input(options, typeof this.validateInputHandler === 'function', token);
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
async showInputBox(options: TransferInputBox): Promise<string | undefined> {
|
|
155
|
-
this.validateInputHandler = options
|
|
156
|
-
|
|
153
|
+
this.validateInputHandler = typeof options.validateInput === 'function' ? options.validateInput : undefined;
|
|
157
154
|
return this.proxy.$showInputBox(options, typeof this.validateInputHandler === 'function');
|
|
158
155
|
}
|
|
159
156
|
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import * as theia from '@theia/plugin';
|
|
25
25
|
import * as converter from '../type-converters';
|
|
26
26
|
import { CustomExecution, Disposable } from '../types-impl';
|
|
27
|
-
import { RPCProtocol
|
|
27
|
+
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
28
28
|
import { TaskProviderAdapter } from './task-provider';
|
|
29
29
|
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
30
30
|
import { TerminalServiceExtImpl } from '../terminal-ext';
|
|
@@ -49,15 +49,8 @@ export class TasksExtImpl implements TasksExt {
|
|
|
49
49
|
private readonly onDidExecuteTaskProcess: Emitter<theia.TaskProcessStartEvent> = new Emitter<theia.TaskProcessStartEvent>();
|
|
50
50
|
private readonly onDidTerminateTaskProcess: Emitter<theia.TaskProcessEndEvent> = new Emitter<theia.TaskProcessEndEvent>();
|
|
51
51
|
|
|
52
|
-
private disposed = false;
|
|
53
|
-
|
|
54
52
|
constructor(rpc: RPCProtocol, readonly terminalExt: TerminalServiceExtImpl) {
|
|
55
53
|
this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.TASKS_MAIN);
|
|
56
|
-
this.fetchTaskExecutions();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
dispose(): void {
|
|
60
|
-
this.disposed = true;
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
get taskExecutions(): ReadonlyArray<theia.TaskExecution> {
|
|
@@ -216,16 +209,9 @@ export class TasksExtImpl implements TasksExt {
|
|
|
216
209
|
});
|
|
217
210
|
}
|
|
218
211
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
taskExecutions.forEach(execution => this.getTaskExecution(execution));
|
|
223
|
-
} catch (error) {
|
|
224
|
-
if (this.disposed && ConnectionClosedError.is(error)) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
console.error(`Can not fetch running tasks: ${error}`);
|
|
228
|
-
}
|
|
212
|
+
// Initial `this.executions` map with the running tasks from the previous session
|
|
213
|
+
async $initLoadedTasks(taskExecutions: TaskExecutionDto[]): Promise<void> {
|
|
214
|
+
taskExecutions.forEach(execution => this.getTaskExecution(execution));
|
|
229
215
|
}
|
|
230
216
|
|
|
231
217
|
private getTaskExecution(execution: TaskExecutionDto): theia.TaskExecution {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
import { DataCallback, Emitter, Event, PartialMessageInfo } from '@theia/core/shared/vscode-ws-jsonrpc';
|
|
17
|
-
export declare abstract class AbstractMessageReader {
|
|
18
|
-
protected errorEmitter: Emitter<Error>;
|
|
19
|
-
protected closeEmitter: Emitter<void>;
|
|
20
|
-
protected partialMessageEmitter: Emitter<PartialMessageInfo>;
|
|
21
|
-
dispose(): void;
|
|
22
|
-
get onError(): Event<Error>;
|
|
23
|
-
fireError(error: Error): void;
|
|
24
|
-
get onClose(): Event<void>;
|
|
25
|
-
fireClose(): void;
|
|
26
|
-
get onPartialMessage(): Event<PartialMessageInfo>;
|
|
27
|
-
firePartialMessage(info: PartialMessageInfo): void;
|
|
28
|
-
asError(error: any): Error;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Support for reading string message through RPC protocol.
|
|
32
|
-
*/
|
|
33
|
-
export declare class PluginMessageReader extends AbstractMessageReader {
|
|
34
|
-
protected state: 'initial' | 'listening' | 'closed';
|
|
35
|
-
protected callback: DataCallback | undefined;
|
|
36
|
-
protected readonly events: {
|
|
37
|
-
message?: any;
|
|
38
|
-
error?: any;
|
|
39
|
-
}[];
|
|
40
|
-
constructor();
|
|
41
|
-
listen(callback: DataCallback): void;
|
|
42
|
-
readMessage(message: string): void;
|
|
43
|
-
fireError(error: any): void;
|
|
44
|
-
fireClose(): void;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=plugin-message-reader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-message-reader.d.ts","sourceRoot":"","sources":["../../src/common/plugin-message-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAExG,8BAAsB,qBAAqB;IACvC,SAAS,CAAC,YAAY,iBAAwB;IAC9C,SAAS,CAAC,YAAY,gBAAuB;IAC7C,SAAS,CAAC,qBAAqB,8BAAqC;IACpE,OAAO,IAAI,IAAI;IAIf,IAAI,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAE1B;IACD,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAG7B,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAEzB;IACD,SAAS,IAAI,IAAI;IAGjB,IAAI,gBAAgB,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAEhD;IACD,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAIlD,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK;CAO7B;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,qBAAqB;IAC1D,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAa;IAChE,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAE7C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAM;;IAMjE,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAiBpC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAUlC,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAQ3B,SAAS,IAAI,IAAI;CAQpB"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.PluginMessageReader = exports.AbstractMessageReader = void 0;
|
|
19
|
-
const vscode_ws_jsonrpc_1 = require("@theia/core/shared/vscode-ws-jsonrpc");
|
|
20
|
-
class AbstractMessageReader {
|
|
21
|
-
constructor() {
|
|
22
|
-
this.errorEmitter = new vscode_ws_jsonrpc_1.Emitter();
|
|
23
|
-
this.closeEmitter = new vscode_ws_jsonrpc_1.Emitter();
|
|
24
|
-
this.partialMessageEmitter = new vscode_ws_jsonrpc_1.Emitter();
|
|
25
|
-
}
|
|
26
|
-
dispose() {
|
|
27
|
-
this.errorEmitter.dispose();
|
|
28
|
-
this.closeEmitter.dispose();
|
|
29
|
-
}
|
|
30
|
-
get onError() {
|
|
31
|
-
return this.errorEmitter.event;
|
|
32
|
-
}
|
|
33
|
-
fireError(error) {
|
|
34
|
-
this.errorEmitter.fire(this.asError(error));
|
|
35
|
-
}
|
|
36
|
-
get onClose() {
|
|
37
|
-
return this.closeEmitter.event;
|
|
38
|
-
}
|
|
39
|
-
fireClose() {
|
|
40
|
-
this.closeEmitter.fire(undefined);
|
|
41
|
-
}
|
|
42
|
-
get onPartialMessage() {
|
|
43
|
-
return this.partialMessageEmitter.event;
|
|
44
|
-
}
|
|
45
|
-
firePartialMessage(info) {
|
|
46
|
-
this.partialMessageEmitter.fire(info);
|
|
47
|
-
}
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
asError(error) {
|
|
50
|
-
if (error instanceof Error) {
|
|
51
|
-
return error;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return new Error(`Reader received error. Reason: ${typeof error.message === 'string' ? error.message : 'unknown'}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.AbstractMessageReader = AbstractMessageReader;
|
|
59
|
-
/**
|
|
60
|
-
* Support for reading string message through RPC protocol.
|
|
61
|
-
*/
|
|
62
|
-
class PluginMessageReader extends AbstractMessageReader {
|
|
63
|
-
constructor() {
|
|
64
|
-
super();
|
|
65
|
-
this.state = 'initial';
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
this.events = [];
|
|
68
|
-
}
|
|
69
|
-
listen(callback) {
|
|
70
|
-
if (this.state === 'initial') {
|
|
71
|
-
this.state = 'listening';
|
|
72
|
-
this.callback = callback;
|
|
73
|
-
while (this.events.length !== 0) {
|
|
74
|
-
const event = this.events.pop();
|
|
75
|
-
if (event.message) {
|
|
76
|
-
this.readMessage(event.message);
|
|
77
|
-
}
|
|
78
|
-
else if (event.error) {
|
|
79
|
-
this.fireError(event.error);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.fireClose();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
readMessage(message) {
|
|
88
|
-
if (this.state === 'initial') {
|
|
89
|
-
this.events.splice(0, 0, { message });
|
|
90
|
-
}
|
|
91
|
-
else if (this.state === 'listening') {
|
|
92
|
-
const data = JSON.parse(message);
|
|
93
|
-
this.callback(data);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
-
fireError(error) {
|
|
98
|
-
if (this.state === 'initial') {
|
|
99
|
-
this.events.splice(0, 0, { error });
|
|
100
|
-
}
|
|
101
|
-
else if (this.state === 'listening') {
|
|
102
|
-
super.fireError(error);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
fireClose() {
|
|
106
|
-
if (this.state === 'initial') {
|
|
107
|
-
this.events.splice(0, 0, {});
|
|
108
|
-
}
|
|
109
|
-
else if (this.state === 'listening') {
|
|
110
|
-
super.fireClose();
|
|
111
|
-
}
|
|
112
|
-
this.state = 'closed';
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.PluginMessageReader = PluginMessageReader;
|
|
116
|
-
//# sourceMappingURL=plugin-message-reader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-message-reader.js","sourceRoot":"","sources":["../../src/common/plugin-message-reader.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
import { Message, MessageWriter, Emitter, Event } from '@theia/core/shared/vscode-ws-jsonrpc';
|
|
17
|
-
import { ConnectionMain, ConnectionExt } from './plugin-api-rpc';
|
|
18
|
-
export declare abstract class AbstractMessageWriter {
|
|
19
|
-
protected errorEmitter: Emitter<[Error, Message | undefined, number | undefined]>;
|
|
20
|
-
protected closeEmitter: Emitter<void>;
|
|
21
|
-
dispose(): void;
|
|
22
|
-
get onError(): Event<[Error, Message | undefined, number | undefined]>;
|
|
23
|
-
fireError(error: Error, message: Message | undefined, count: number | undefined): void;
|
|
24
|
-
get onClose(): Event<void>;
|
|
25
|
-
fireClose(): void;
|
|
26
|
-
asError(error: any): Error;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Support for writing string message through RPC protocol.
|
|
30
|
-
*/
|
|
31
|
-
export declare class PluginMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
|
32
|
-
protected readonly id: string;
|
|
33
|
-
protected readonly proxy: ConnectionMain | ConnectionExt;
|
|
34
|
-
constructor(id: string, proxy: ConnectionMain | ConnectionExt);
|
|
35
|
-
write(message: string): void;
|
|
36
|
-
write(message: Message): void;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=plugin-message-writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-message-writer.d.ts","sourceRoot":"","sources":["../../src/common/plugin-message-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjE,8BAAsB,qBAAqB;IACvC,SAAS,CAAC,YAAY,4DAAmE;IACzF,SAAS,CAAC,YAAY,gBAAuB;IAC7C,OAAO,IAAI,IAAI;IAIf,IAAI,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAErE;IACD,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAGtF,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAEzB;IACD,SAAS,IAAI,IAAI;IAIjB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK;CAO7B;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,qBAAsB,YAAW,aAAa;IAE/E,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM;IAC7B,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa;gBADrC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,cAAc,GAAG,aAAa;IAI5D,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAC5B,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAKhC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.PluginMessageWriter = exports.AbstractMessageWriter = void 0;
|
|
19
|
-
const vscode_ws_jsonrpc_1 = require("@theia/core/shared/vscode-ws-jsonrpc");
|
|
20
|
-
class AbstractMessageWriter {
|
|
21
|
-
constructor() {
|
|
22
|
-
this.errorEmitter = new vscode_ws_jsonrpc_1.Emitter();
|
|
23
|
-
this.closeEmitter = new vscode_ws_jsonrpc_1.Emitter();
|
|
24
|
-
}
|
|
25
|
-
dispose() {
|
|
26
|
-
this.errorEmitter.dispose();
|
|
27
|
-
this.closeEmitter.dispose();
|
|
28
|
-
}
|
|
29
|
-
get onError() {
|
|
30
|
-
return this.errorEmitter.event;
|
|
31
|
-
}
|
|
32
|
-
fireError(error, message, count) {
|
|
33
|
-
this.errorEmitter.fire([this.asError(error), message, count]);
|
|
34
|
-
}
|
|
35
|
-
get onClose() {
|
|
36
|
-
return this.closeEmitter.event;
|
|
37
|
-
}
|
|
38
|
-
fireClose() {
|
|
39
|
-
this.closeEmitter.fire(undefined);
|
|
40
|
-
}
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
asError(error) {
|
|
43
|
-
if (error instanceof Error) {
|
|
44
|
-
return error;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return new Error(`Writer received error. Reason: ${typeof error.message === 'string' ? error.message : 'unknown'}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.AbstractMessageWriter = AbstractMessageWriter;
|
|
52
|
-
/**
|
|
53
|
-
* Support for writing string message through RPC protocol.
|
|
54
|
-
*/
|
|
55
|
-
class PluginMessageWriter extends AbstractMessageWriter {
|
|
56
|
-
constructor(id, proxy) {
|
|
57
|
-
super();
|
|
58
|
-
this.id = id;
|
|
59
|
-
this.proxy = proxy;
|
|
60
|
-
}
|
|
61
|
-
write(arg) {
|
|
62
|
-
const content = JSON.stringify(arg);
|
|
63
|
-
this.proxy.$sendMessage(this.id, content);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.PluginMessageWriter = PluginMessageWriter;
|
|
67
|
-
//# sourceMappingURL=plugin-message-writer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-message-writer.js","sourceRoot":"","sources":["../../src/common/plugin-message-writer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,4EAA8F;AAG9F,MAAsB,qBAAqB;IAA3C;QACc,iBAAY,GAAG,IAAI,2BAAO,EAAoD,CAAC;QAC/E,iBAAY,GAAG,IAAI,2BAAO,EAAQ,CAAC;IAyBjD,CAAC;IAxBG,OAAO;QACH,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IACD,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACnC,CAAC;IACD,SAAS,CAAC,KAAY,EAAE,OAA4B,EAAE,KAAyB;QAC3E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACnC,CAAC;IACD,SAAS;QACL,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IACD,8DAA8D;IAC9D,OAAO,CAAC,KAAU;QACd,IAAI,KAAK,YAAY,KAAK,EAAE;YACxB,OAAO,KAAK,CAAC;SAChB;aAAM;YACH,OAAO,IAAI,KAAK,CAAC,kCAAkC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;SACvH;IACL,CAAC;CACJ;AA3BD,sDA2BC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,qBAAqB;IAC1D,YACuB,EAAU,EACV,KAAqC;QACxD,KAAK,EAAE,CAAC;QAFW,OAAE,GAAF,EAAE,CAAQ;QACV,UAAK,GAAL,KAAK,CAAgC;IAE5D,CAAC;IAID,KAAK,CAAC,GAAqB;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACJ;AAbD,kDAaC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
17
|
-
import { ConnectionMain } from '../../common/plugin-api-rpc';
|
|
18
|
-
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
19
|
-
import { PluginConnection } from '../../common/connection';
|
|
20
|
-
/**
|
|
21
|
-
* Implementation of connection system of the plugin API.
|
|
22
|
-
* Creates holds the connections to the plugins. Allows to send a message to the plugin by getting already created connection via id.
|
|
23
|
-
*/
|
|
24
|
-
export declare class ConnectionMainImpl implements ConnectionMain, Disposable {
|
|
25
|
-
private readonly proxy;
|
|
26
|
-
private readonly connections;
|
|
27
|
-
private readonly toDispose;
|
|
28
|
-
constructor(rpc: RPCProtocol);
|
|
29
|
-
dispose(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Gets the connection between plugin by id and sends string message to it.
|
|
32
|
-
*
|
|
33
|
-
* @param id connection's id
|
|
34
|
-
* @param message incoming message
|
|
35
|
-
*/
|
|
36
|
-
$sendMessage(id: string, message: string): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Instantiates a new connection by the given id.
|
|
39
|
-
* @param id the connection id
|
|
40
|
-
*/
|
|
41
|
-
$createConnection(id: string): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Deletes a connection.
|
|
44
|
-
* @param id the connection id
|
|
45
|
-
*/
|
|
46
|
-
$deleteConnection(id: string): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Returns existed connection or creates a new one.
|
|
49
|
-
* @param id the connection id
|
|
50
|
-
*/
|
|
51
|
-
ensureConnection(id: string): Promise<PluginConnection>;
|
|
52
|
-
/**
|
|
53
|
-
* Returns existed connection or creates a new one.
|
|
54
|
-
* @param id the connection id
|
|
55
|
-
*/
|
|
56
|
-
doEnsureConnection(id: string): Promise<PluginConnection>;
|
|
57
|
-
protected doCreateConnection(id: string): Promise<PluginConnection>;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=connection-main.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection-main.d.ts","sourceRoot":"","sources":["../../../src/main/browser/connection-main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,UAAU,EAAwB,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAoB,cAAc,EAAiB,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc,EAAE,UAAU;IAEjE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuC;IACnE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;gBAC5C,GAAG,EAAE,WAAW;IAI5B,OAAO,IAAI,IAAI;IAIf;;;;;OAKG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9D;;;OAGG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD;;;OAGG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD;;;OAGG;IACG,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAM7D;;;OAGG;IACG,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;cAM/C,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAgB5E"}
|