@theia/plugin-ext 1.18.0-next.88 → 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/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/plugin/node/debug/debug.d.ts +1 -1
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +10 -4
- 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 +2 -0
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +33 -0
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +61 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +23 -23
- package/src/main/browser/debug/plugin-debug-session-factory.ts +1 -1
- package/src/plugin/node/debug/debug.ts +14 -7
- 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 +4 -0
- package/src/plugin/types-impl.ts +52 -0
|
@@ -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
|
}
|
|
@@ -106,6 +106,8 @@ import {
|
|
|
106
106
|
Task2,
|
|
107
107
|
DebugAdapterExecutable,
|
|
108
108
|
DebugAdapterServer,
|
|
109
|
+
DebugAdapterNamedPipeServer,
|
|
110
|
+
DebugAdapterInlineImplementation,
|
|
109
111
|
Breakpoint,
|
|
110
112
|
SourceBreakpoint,
|
|
111
113
|
FunctionBreakpoint,
|
|
@@ -930,6 +932,8 @@ export function createAPIFactory(
|
|
|
930
932
|
Task2,
|
|
931
933
|
DebugAdapterExecutable,
|
|
932
934
|
DebugAdapterServer,
|
|
935
|
+
DebugAdapterNamedPipeServer,
|
|
936
|
+
DebugAdapterInlineImplementation,
|
|
933
937
|
DebugConfigurationProviderTriggerKind,
|
|
934
938
|
Breakpoint,
|
|
935
939
|
SourceBreakpoint,
|
package/src/plugin/types-impl.ts
CHANGED
|
@@ -2120,6 +2120,12 @@ export class DebugAdapterExecutable {
|
|
|
2120
2120
|
}
|
|
2121
2121
|
}
|
|
2122
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
|
+
|
|
2123
2129
|
/**
|
|
2124
2130
|
* Represents a debug adapter running as a socket based server.
|
|
2125
2131
|
*/
|
|
@@ -2145,6 +2151,52 @@ export class DebugAdapterServer {
|
|
|
2145
2151
|
}
|
|
2146
2152
|
}
|
|
2147
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
|
+
|
|
2148
2200
|
export enum LogLevel {
|
|
2149
2201
|
Trace = 1,
|
|
2150
2202
|
Debug = 2,
|