@theia/plugin-ext 1.27.0-next.49 → 1.27.0-next.52
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/hosted/browser/worker/debug-stub.d.ts +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +2 -2
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/node/plugin-host-rpc.js +2 -2
- package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
- package/lib/plugin/{node/debug/debug.d.ts → debug/debug-ext.d.ts} +15 -13
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -0
- package/lib/plugin/{node/debug/debug.js → debug/debug-ext.js} +17 -51
- package/lib/plugin/debug/debug-ext.js.map +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +11 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.js +42 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.js.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.d.ts +2 -2
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.js +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.js.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.d.ts +0 -0
- package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.js +0 -0
- package/lib/plugin/debug/plugin-debug-adapter-tracker.js.map +1 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +18 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js +155 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js.map +1 -0
- package/lib/plugin/plugin-context.d.ts +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +1 -1
- package/lib/plugin/plugin-context.js.map +1 -1
- package/package.json +24 -24
- package/src/hosted/browser/worker/debug-stub.ts +1 -1
- package/src/hosted/node/plugin-host-rpc.ts +1 -1
- package/src/plugin/{node/debug/debug.ts → debug/debug-ext.ts} +25 -56
- package/src/plugin/debug/plugin-debug-adapter-creator.ts +50 -0
- package/src/plugin/{node/debug → debug}/plugin-debug-adapter-session.ts +2 -2
- package/src/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.ts +0 -0
- package/src/plugin/node/debug/plugin-node-debug-adapter-creator.ts +167 -0
- package/src/plugin/plugin-context.ts +2 -2
- package/lib/plugin/node/debug/debug.d.ts.map +0 -1
- package/lib/plugin/node/debug/debug.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts +0 -7
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js +0 -57
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +0 -15
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +0 -85
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-tracker.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-tracker.js.map +0 -1
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts +0 -19
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.js +0 -45
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.js.map +0 -1
- package/src/plugin/node/debug/plugin-debug-adapter-executable-resolver.ts +0 -58
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +0 -86
- package/src/plugin/node/debug/plugin-inline-debug-adapter.ts +0 -47
|
@@ -1,86 +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
|
-
|
|
17
|
-
import * as net from 'net';
|
|
18
|
-
import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
|
|
19
|
-
import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
|
|
20
|
-
import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
|
|
21
|
-
import { InlineDebugAdapter } from './plugin-inline-debug-adapter';
|
|
22
|
-
import { ProcessDebugAdapter, SocketDebugAdapter } from '@theia/debug/lib/node/stream-debug-adapter';
|
|
23
|
-
const isElectron = require('is-electron');
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Starts debug adapter process.
|
|
27
|
-
*/
|
|
28
|
-
export function startDebugAdapter(executable: DebugAdapterExecutable): DebugAdapter {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
-
const options: any = { stdio: ['pipe', 'pipe', 2] };
|
|
31
|
-
|
|
32
|
-
if (executable.options) {
|
|
33
|
-
options.cwd = executable.options.cwd;
|
|
34
|
-
|
|
35
|
-
// The additional environment of the executed program or shell. If omitted
|
|
36
|
-
// the parent process' environment is used. If provided it is merged with
|
|
37
|
-
// the parent process' environment.
|
|
38
|
-
options.env = Object.assign({}, process.env);
|
|
39
|
-
Object.assign(options.env, executable.options.env);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let childProcess: ChildProcess;
|
|
43
|
-
const { command, args } = executable;
|
|
44
|
-
if (command === 'node') {
|
|
45
|
-
if (Array.isArray(args) && args.length > 0) {
|
|
46
|
-
const forkOptions: ForkOptions = {
|
|
47
|
-
env: options.env,
|
|
48
|
-
// When running in Electron, fork will automatically add ELECTRON_RUN_AS_NODE=1 to the env,
|
|
49
|
-
// but this will cause issues when debugging Electron apps, so we'll remove it.
|
|
50
|
-
execArgv: isElectron()
|
|
51
|
-
? ['-e', 'delete process.env.ELECTRON_RUN_AS_NODE;require(process.argv[1])']
|
|
52
|
-
: [],
|
|
53
|
-
silent: true
|
|
54
|
-
};
|
|
55
|
-
if (options.cwd) {
|
|
56
|
-
forkOptions.cwd = options.cwd;
|
|
57
|
-
}
|
|
58
|
-
options.stdio.push('ipc');
|
|
59
|
-
forkOptions.stdio = options.stdio;
|
|
60
|
-
childProcess = fork(args[0], args.slice(1), forkOptions);
|
|
61
|
-
} else {
|
|
62
|
-
throw new Error(`It is not possible to launch debug adapter with the command: ${JSON.stringify(executable)}`);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
childProcess = spawn(command, args, options);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return new ProcessDebugAdapter(childProcess);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Connects to a remote debug server.
|
|
73
|
-
*/
|
|
74
|
-
export function connectSocketDebugAdapter(server: DebugAdapterServer): SocketDebugAdapter {
|
|
75
|
-
const socket = net.createConnection(server.port, server.host);
|
|
76
|
-
return new SocketDebugAdapter(socket);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): SocketDebugAdapter {
|
|
80
|
-
const socket = net.createConnection(adapter.path);
|
|
81
|
-
return new SocketDebugAdapter(socket);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): InlineDebugAdapter {
|
|
85
|
-
return new InlineDebugAdapter(adapter.implementation);
|
|
86
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 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
|
-
|
|
17
|
-
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
18
|
-
import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
|
|
19
|
-
import * as theia from '@theia/plugin';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A debug adapter for using the inline implementation from a plugin.
|
|
23
|
-
*/
|
|
24
|
-
export class InlineDebugAdapter implements DebugAdapter {
|
|
25
|
-
private messageReceivedEmitter = new Emitter<string>();
|
|
26
|
-
onMessageReceived: Event<string> = this.messageReceivedEmitter.event;
|
|
27
|
-
onError: Event<Error> = Event.None;
|
|
28
|
-
private closeEmitter = new Emitter<void>();
|
|
29
|
-
onClose: Event<void> = this.closeEmitter.event;
|
|
30
|
-
|
|
31
|
-
constructor(private debugAdapter: theia.DebugAdapter) {
|
|
32
|
-
this.debugAdapter.onDidSendMessage(msg => {
|
|
33
|
-
this.messageReceivedEmitter.fire(JSON.stringify(msg));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async start(): Promise<void> {
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
send(message: string): void {
|
|
41
|
-
this.debugAdapter.handleMessage(JSON.parse(message));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async stop(): Promise<void> {
|
|
45
|
-
this.debugAdapter.dispose();
|
|
46
|
-
}
|
|
47
|
-
}
|