@theia/debug 1.20.0 → 1.21.0-next.15

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.
Files changed (63) hide show
  1. package/lib/browser/console/debug-console-session.js +2 -2
  2. package/lib/browser/console/debug-console-session.js.map +1 -1
  3. package/lib/browser/debug-frontend-application-contribution.js +4 -4
  4. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  5. package/lib/browser/debug-session-connection.d.ts +22 -17
  6. package/lib/browser/debug-session-connection.d.ts.map +1 -1
  7. package/lib/browser/debug-session-connection.js +86 -65
  8. package/lib/browser/debug-session-connection.js.map +1 -1
  9. package/lib/browser/debug-session-contribution.d.ts.map +1 -1
  10. package/lib/browser/debug-session-contribution.js.map +1 -1
  11. package/lib/browser/debug-session-manager.d.ts +6 -14
  12. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  13. package/lib/browser/debug-session-manager.js +41 -44
  14. package/lib/browser/debug-session-manager.js.map +1 -1
  15. package/lib/browser/debug-session.d.ts +9 -8
  16. package/lib/browser/debug-session.d.ts.map +1 -1
  17. package/lib/browser/debug-session.js +55 -58
  18. package/lib/browser/debug-session.js.map +1 -1
  19. package/lib/browser/view/debug-view-model.js +3 -3
  20. package/lib/browser/view/debug-view-model.js.map +1 -1
  21. package/lib/common/debug-service.d.ts +10 -0
  22. package/lib/common/debug-service.d.ts.map +1 -1
  23. package/lib/node/debug-adapter-factory.d.ts +4 -4
  24. package/lib/node/debug-adapter-factory.d.ts.map +1 -1
  25. package/lib/node/debug-adapter-factory.js +8 -8
  26. package/lib/node/debug-adapter-factory.js.map +1 -1
  27. package/lib/node/debug-adapter-session-manager.d.ts.map +1 -1
  28. package/lib/node/debug-adapter-session-manager.js +0 -1
  29. package/lib/node/debug-adapter-session-manager.js.map +1 -1
  30. package/lib/node/debug-adapter-session.d.ts +7 -7
  31. package/lib/node/debug-adapter-session.d.ts.map +1 -1
  32. package/lib/node/debug-adapter-session.js +25 -24
  33. package/lib/node/debug-adapter-session.js.map +1 -1
  34. package/lib/node/debug-model.d.ts +32 -15
  35. package/lib/node/debug-model.d.ts.map +1 -1
  36. package/lib/node/debug-model.js.map +1 -1
  37. package/lib/node/{inline-communication-provider.d.ts → inline-debug-adapter.d.ts} +6 -5
  38. package/lib/node/inline-debug-adapter.d.ts.map +1 -0
  39. package/lib/node/{inline-communication-provider.js → inline-debug-adapter.js} +8 -6
  40. package/lib/node/inline-debug-adapter.js.map +1 -0
  41. package/lib/node/{stream-communication-provider.d.ts → stream-debug-adapter.d.ts} +17 -3
  42. package/lib/node/stream-debug-adapter.d.ts.map +1 -0
  43. package/lib/node/{stream-communication-provider.js → stream-debug-adapter.js} +38 -13
  44. package/lib/node/stream-debug-adapter.js.map +1 -0
  45. package/package.json +16 -16
  46. package/src/browser/console/debug-console-session.ts +2 -2
  47. package/src/browser/debug-frontend-application-contribution.ts +4 -4
  48. package/src/browser/debug-session-connection.ts +101 -75
  49. package/src/browser/debug-session-contribution.ts +2 -3
  50. package/src/browser/debug-session-manager.ts +45 -47
  51. package/src/browser/debug-session.tsx +54 -57
  52. package/src/browser/view/debug-view-model.ts +3 -3
  53. package/src/common/debug-service.ts +13 -0
  54. package/src/node/debug-adapter-factory.ts +13 -12
  55. package/src/node/debug-adapter-session-manager.ts +0 -1
  56. package/src/node/debug-adapter-session.ts +29 -28
  57. package/src/node/debug-model.ts +33 -15
  58. package/src/node/{inline-communication-provider.ts → inline-debug-adapter.ts} +7 -4
  59. package/src/node/{stream-communication-provider.ts → stream-debug-adapter.ts} +42 -9
  60. package/lib/node/inline-communication-provider.d.ts.map +0 -1
  61. package/lib/node/inline-communication-provider.js.map +0 -1
  62. package/lib/node/stream-communication-provider.d.ts.map +0 -1
  63. package/lib/node/stream-communication-provider.js.map +0 -1
@@ -16,25 +16,20 @@
16
16
  ********************************************************************************/
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DebugAdapterSessionImpl = void 0;
19
- const disposable_1 = require("@theia/core/lib/common/disposable");
20
19
  /**
21
20
  * [DebugAdapterSession](#DebugAdapterSession) implementation.
22
21
  */
23
22
  class DebugAdapterSessionImpl {
24
- constructor(id, communicationProvider) {
23
+ constructor(id, debugAdapter) {
25
24
  this.id = id;
26
- this.communicationProvider = communicationProvider;
27
- this.toDispose = new disposable_1.DisposableCollection();
28
- this.toDispose.pushAll([
29
- this.communicationProvider,
30
- disposable_1.Disposable.create(() => this.write(JSON.stringify({ seq: -1, type: 'request', command: 'disconnect' }))),
31
- disposable_1.Disposable.create(() => this.write(JSON.stringify({ seq: -1, type: 'request', command: 'terminate' })))
32
- ]);
33
- this.communicationProvider.onMessageReceived((message) => this.send(message));
34
- this.communicationProvider.onClose(() => this.onDebugAdapterExit(1, undefined)); // FIXME pass a proper exit code
35
- this.communicationProvider.onError(error => this.onDebugAdapterError(error));
25
+ this.debugAdapter = debugAdapter;
26
+ this.isClosed = false;
27
+ this.debugAdapter.onMessageReceived((message) => this.send(message));
28
+ this.debugAdapter.onClose(() => this.onDebugAdapterExit());
29
+ this.debugAdapter.onError(error => this.onDebugAdapterError(error));
36
30
  }
37
31
  async start(channel) {
32
+ console.debug(`starting debug adapter session '${this.id}'`);
38
33
  if (this.channel) {
39
34
  throw new Error('The session has already been started, id: ' + this.id);
40
35
  }
@@ -42,18 +37,16 @@ class DebugAdapterSessionImpl {
42
37
  this.channel.onMessage((message) => this.write(message));
43
38
  this.channel.onClose(() => this.channel = undefined);
44
39
  }
45
- onDebugAdapterExit(exitCode, signal) {
46
- const event = {
47
- type: 'event',
48
- event: 'exited',
49
- seq: -1,
50
- body: {
51
- exitCode
52
- }
53
- };
54
- this.send(JSON.stringify(event));
40
+ onDebugAdapterExit() {
41
+ this.isClosed = true;
42
+ console.debug(`onDebugAdapterExit session: '${this.id}'`);
43
+ if (this.channel) {
44
+ this.channel.close();
45
+ this.channel = undefined;
46
+ }
55
47
  }
56
48
  onDebugAdapterError(error) {
49
+ console.debug(`error in debug adapter session: '${this.id}': ${JSON.stringify(error)}`);
57
50
  const event = {
58
51
  type: 'event',
59
52
  event: 'error',
@@ -68,10 +61,18 @@ class DebugAdapterSessionImpl {
68
61
  }
69
62
  }
70
63
  write(message) {
71
- this.communicationProvider.send(message);
64
+ if (!this.isClosed) {
65
+ this.debugAdapter.send(message);
66
+ }
72
67
  }
73
68
  async stop() {
74
- this.toDispose.dispose();
69
+ var _a;
70
+ console.debug(`stopping debug adapter session: '${this.id}'`);
71
+ if (!this.isClosed) {
72
+ await this.debugAdapter.stop();
73
+ }
74
+ (_a = this.channel) === null || _a === void 0 ? void 0 : _a.close();
75
+ this.channel = undefined;
75
76
  }
76
77
  }
77
78
  exports.DebugAdapterSessionImpl = DebugAdapterSessionImpl;
@@ -1 +1 @@
1
- {"version":3,"file":"debug-adapter-session.js","sourceRoot":"","sources":["../../src/node/debug-adapter-session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAelF,kEAAqF;AAErF;;GAEG;AACH,MAAa,uBAAuB;IAKhC,YACa,EAAU,EACA,qBAA4C;QADtD,OAAE,GAAF,EAAE,CAAQ;QACA,0BAAqB,GAArB,qBAAqB,CAAuB;QALlD,cAAS,GAAG,IAAI,iCAAoB,EAAE,CAAC;QAOpD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YACnB,IAAI,CAAC,qBAAqB;YAC1B,uBAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;YACxG,uBAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAA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Q,EAAE;YAChB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACnC;IACL,CAAC;IAED,KAAK,CAAC,IAAI;;QACN,OAAO,CAAC,KAAK,CAAC,oCAAoC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAE9D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;SAClC;QACD,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,GAAG;QACtB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7B,CAAC;CACJ;AApED,0DAoEC"}
@@ -13,23 +13,24 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { WebSocketChannel } from '@theia/core/lib/common/messaging/web-socket-channel';
17
16
  import { DebugConfiguration } from '../common/debug-configuration';
18
17
  import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
19
- import { Disposable } from '@theia/core/lib/common/disposable';
20
18
  import { MaybePromise } from '@theia/core/lib/common/types';
21
19
  import { Event } from '@theia/core/lib/common/event';
20
+ import { Channel } from '../common/debug-service';
22
21
  /**
23
22
  * DebugAdapterSession symbol for DI.
24
23
  */
25
24
  export declare const DebugAdapterSession: unique symbol;
26
25
  /**
27
- * The debug adapter session.
26
+ * The debug adapter session. The debug adapter session manages the lifecycle of a
27
+ * debug session: the debug session should be discarded if and only if the debug adapter
28
+ * session is stopped.
28
29
  */
29
30
  export interface DebugAdapterSession {
30
31
  id: string;
31
32
  parentSession?: DebugAdapterSession;
32
- start(channel: WebSocketChannel): Promise<void>;
33
+ start(channel: Channel): Promise<void>;
33
34
  stop(): Promise<void>;
34
35
  }
35
36
  /**
@@ -40,7 +41,7 @@ export declare const DebugAdapterSessionFactory: unique symbol;
40
41
  * The [debug session](#DebugSession) factory.
41
42
  */
42
43
  export interface DebugAdapterSessionFactory {
43
- get(sessionId: string, communicationProvider: CommunicationProvider): DebugAdapterSession;
44
+ get(sessionId: string, debugAdapter: DebugAdapter): DebugAdapterSession;
44
45
  }
45
46
  /**
46
47
  * Debug adapter executable for spawning.
@@ -69,18 +70,34 @@ export interface DebugAdapterForkExecutable {
69
70
  */
70
71
  export declare type DebugAdapterExecutable = DebugAdapterSpawnExecutable | DebugAdapterForkExecutable;
71
72
  /**
72
- * Provides some way we can communicate with the running debug adapter. In general there is
73
- * no obligation as of how to launch/initialize local or remote debug adapter
74
- * process/server, it can be done separately and it is not required that this interface covers the
75
- * procedure, however it is also not disallowed.
76
- *
77
- * TODO: the better name is DebugStreamConnection + handling on error and close
73
+ * Implementers stand for the various types of debug adapters the system can talk to.
74
+ * Creation of debug adapters is not covered in this interface, but handling communication
75
+ * and the end of life is.
78
76
  */
79
- export interface CommunicationProvider extends Disposable {
77
+ export interface DebugAdapter {
78
+ /**
79
+ * A DAP protocol message has been received from the debug adapter
80
+ */
80
81
  onMessageReceived: Event<string>;
82
+ /**
83
+ * Send a DAP message to the debug adapter
84
+ * @param message the JSON-encoded DAP message
85
+ */
86
+ send(message: string): void;
87
+ /**
88
+ * An error has occured communicating with the debug adapter. This does not meant the debug adapter
89
+ * has terminated.
90
+ */
81
91
  onError: Event<Error>;
92
+ /**
93
+ * The connection to the debug adapter has been lost. This signals the end of life for this
94
+ * debug adapter instance.
95
+ */
82
96
  onClose: Event<void>;
83
- send(message: string): void;
97
+ /**
98
+ * Terminate the connection to the debug adapter.
99
+ */
100
+ stop(): Promise<void>;
84
101
  }
85
102
  /**
86
103
  * DebugAdapterFactory symbol for DI.
@@ -90,8 +107,8 @@ export declare const DebugAdapterFactory: unique symbol;
90
107
  * Factory to start debug adapter.
91
108
  */
92
109
  export interface DebugAdapterFactory {
93
- start(executable: DebugAdapterExecutable): CommunicationProvider;
94
- connect(debugServerPort: number): CommunicationProvider;
110
+ start(executable: DebugAdapterExecutable): DebugAdapter;
111
+ connect(debugServerPort: number): DebugAdapter;
95
112
  }
96
113
  /**
97
114
  * DebugAdapterContribution symbol for DI.
@@ -1 +1 @@
1
- {"version":3,"file":"debug-model.d.ts","sourceRoot":"","sources":["../../src/node/debug-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAUlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAIrD;;GAEG;AACH,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,GAAG,mBAAmB,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CA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AC;IAExD;;;;;;OAMG;IACH,0BAA0B,CAAC,EAAE,0BAA0B,CAAC;IAExD;;OAEG;IACH,mBAAmB,CAAC,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IAEpD,wBAAwB,CAAC,IAAI,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAEhE;;;;;;OAMG;IACH,6BAA6B,CAAC,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAAC;IAE7G;;;OAGG;IACH,0BAA0B,CAAC,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAE7F;;;;;OAKG;IACH,yBAAyB,CAAC,CAAC,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;IAElI;;;;;OAKG;IACH,iDAAiD,CAAC,CAAC,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;CAC7J"}
@@ -1 +1 @@
1
- {"version":3,"file":"debug-model.js","sourceRoot":"","sources":["../../src/node/debug-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAiBlF,kHAAkH;AAElH;;GAEG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAYjE;;GAEG;AACU,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAqD/E;;GAEG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAUjE;;GAEG;AACU,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"debug-model.js","sourceRoot":"","sources":["../../src/node/debug-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAgBlF,kHAAkH;AAElH;;GAEG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAcjE;;GAEG;AACU,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAsE/E;;GAEG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAUjE;;GAEG;AACU,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
@@ -14,12 +14,12 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import { Event } from '@theia/core/lib/common/event';
17
- import { CommunicationProvider } from './debug-model';
17
+ import { DebugAdapter } from './debug-model';
18
18
  import * as theia from '@theia/plugin';
19
19
  /**
20
- * A communication provider for using the inline implementation of a debug adapter.
20
+ * A debug adapter for using the inline implementation from a plugin.
21
21
  */
22
- export declare class InlineCommunicationProvider implements CommunicationProvider {
22
+ export declare class InlineDebugAdapter implements DebugAdapter {
23
23
  private debugAdapter;
24
24
  private messageReceivedEmitter;
25
25
  onMessageReceived: Event<string>;
@@ -27,7 +27,8 @@ export declare class InlineCommunicationProvider implements CommunicationProvide
27
27
  private closeEmitter;
28
28
  onClose: Event<void>;
29
29
  constructor(debugAdapter: theia.DebugAdapter);
30
+ start(): Promise<void>;
30
31
  send(message: string): void;
31
- dispose(): void;
32
+ stop(): Promise<void>;
32
33
  }
33
- //# sourceMappingURL=inline-communication-provider.d.ts.map
34
+ //# sourceMappingURL=inline-debug-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-debug-adapter.d.ts","sourceRoot":"","sources":["../../src/node/inline-debug-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAW,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IAOvC,OAAO,CAAC,YAAY;IANhC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAqC;IACrE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAc;IACnC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAA2B;gBAE3B,YAAY,EAAE,KAAK,CAAC,YAAY;IAM9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
@@ -15,12 +15,12 @@
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.InlineCommunicationProvider = void 0;
18
+ exports.InlineDebugAdapter = void 0;
19
19
  const event_1 = require("@theia/core/lib/common/event");
20
20
  /**
21
- * A communication provider for using the inline implementation of a debug adapter.
21
+ * A debug adapter for using the inline implementation from a plugin.
22
22
  */
23
- class InlineCommunicationProvider {
23
+ class InlineDebugAdapter {
24
24
  constructor(debugAdapter) {
25
25
  this.debugAdapter = debugAdapter;
26
26
  this.messageReceivedEmitter = new event_1.Emitter();
@@ -32,12 +32,14 @@ class InlineCommunicationProvider {
32
32
  this.messageReceivedEmitter.fire(JSON.stringify(msg));
33
33
  });
34
34
  }
35
+ async start() {
36
+ }
35
37
  send(message) {
36
38
  this.debugAdapter.handleMessage(JSON.parse(message));
37
39
  }
38
- dispose() {
40
+ async stop() {
39
41
  this.debugAdapter.dispose();
40
42
  }
41
43
  }
42
- exports.InlineCommunicationProvider = InlineCommunicationProvider;
43
- //# sourceMappingURL=inline-communication-provider.js.map
44
+ exports.InlineDebugAdapter = InlineDebugAdapter;
45
+ //# sourceMappingURL=inline-debug-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-debug-adapter.js","sourceRoot":"","sources":["../../src/node/inline-debug-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,wDAA8D;AAI9D;;GAEG;AACH,MAAa,kBAAkB;IAO3B,YAAoB,YAAgC;QAAhC,iBAAY,GAAZ,YAAY,CAAoB;QAN5C,2BAAsB,GAAG,IAAI,eAAO,EAAU,CAAC;QACvD,sBAAiB,GAAkB,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC;QACrE,YAAO,GAAiB,aAAK,CAAC,IAAI,CAAC;QAC3B,iBAAY,GAAG,IAAI,eAAO,EAAQ,CAAC;QAC3C,YAAO,GAAgB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAG3C,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;YACrC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,KAAK;IACX,CAAC;IAED,IAAI,CAAC,OAAe;QAChB,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,IAAI;QACN,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACJ;AAvBD,gDAuBC"}
@@ -16,9 +16,11 @@
16
16
  /// <reference types="node" />
17
17
  import { DisposableCollection } from '@theia/core/lib/common/disposable';
18
18
  import { Event } from '@theia/core/lib/common/event';
19
+ import { ChildProcess } from 'child_process';
19
20
  import * as stream from 'stream';
20
- import { CommunicationProvider } from './debug-model';
21
- export declare class StreamCommunicationProvider extends DisposableCollection implements CommunicationProvider {
21
+ import * as net from 'net';
22
+ import { DebugAdapter } from './debug-model';
23
+ declare abstract class StreamDebugAdapter extends DisposableCollection {
22
24
  private fromAdapter;
23
25
  private toAdapter;
24
26
  private messageReceivedEmitter;
@@ -32,7 +34,19 @@ export declare class StreamCommunicationProvider extends DisposableCollection im
32
34
  private contentLength;
33
35
  private buffer;
34
36
  constructor(fromAdapter: stream.Readable, toAdapter: stream.Writable);
37
+ handleClosed(): void;
35
38
  send(message: string): void;
36
39
  protected handleData(data: Buffer): void;
37
40
  }
38
- //# sourceMappingURL=stream-communication-provider.d.ts.map
41
+ export declare class ProcessDebugAdapter extends StreamDebugAdapter implements DebugAdapter {
42
+ protected readonly process: ChildProcess;
43
+ constructor(process: ChildProcess);
44
+ stop(): Promise<void>;
45
+ }
46
+ export declare class SocketDebugAdapter extends StreamDebugAdapter implements DebugAdapter {
47
+ private readonly socket;
48
+ constructor(socket: net.Socket);
49
+ stop(): Promise<void>;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=stream-debug-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-debug-adapter.d.ts","sourceRoot":"","sources":["../../src/node/stream-debug-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAW,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,uBAAe,kBAAmB,SAAQ,oBAAoB;IAc9C,OAAO,CAAC,WAAW;IAAmB,OAAO,CAAC,SAAS;IAbnE,OAAO,CAAC,sBAAsB,CAAyB;IACvD,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAqC;IACrE,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAA2B;IAChD,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAA2B;IAG/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAoB;IACjD,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,MAAM,CAA2B;gBAErB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAU,SAAS,EAAE,MAAM,CAAC,QAAQ;IASpF,YAAY,IAAI,IAAI;IAIpB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CA0C3C;AAED,qBAAa,mBAAoB,SAAQ,kBAAmB,YAAW,YAAY;IAC/E,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;gBAC7B,OAAO,EAAE,YAAY;IAK3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9B;AAED,qBAAa,kBAAmB,SAAQ,kBAAmB,YAAW,YAAY;IAC9E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBACxB,MAAM,EAAE,GAAG,CAAC,MAAM;IAK9B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAKxB"}
@@ -15,10 +15,10 @@
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.StreamCommunicationProvider = void 0;
18
+ exports.SocketDebugAdapter = exports.ProcessDebugAdapter = void 0;
19
19
  const disposable_1 = require("@theia/core/lib/common/disposable");
20
20
  const event_1 = require("@theia/core/lib/common/event");
21
- class StreamCommunicationProvider extends disposable_1.DisposableCollection {
21
+ class StreamDebugAdapter extends disposable_1.DisposableCollection {
22
22
  constructor(fromAdapter, toAdapter) {
23
23
  super();
24
24
  this.fromAdapter = fromAdapter;
@@ -32,13 +32,15 @@ class StreamCommunicationProvider extends disposable_1.DisposableCollection {
32
32
  this.contentLength = -1;
33
33
  this.buffer = Buffer.alloc(0);
34
34
  this.fromAdapter.on('data', (data) => this.handleData(data));
35
- this.fromAdapter.on('close', () => this.closeEmitter.fire()); // FIXME pass a proper exit code
35
+ this.fromAdapter.on('close', () => this.handleClosed()); // FIXME pass a proper exit code
36
36
  this.fromAdapter.on('error', error => this.errorEmitter.fire(error));
37
37
  this.toAdapter.on('error', error => this.errorEmitter.fire(error));
38
38
  }
39
- ;
39
+ handleClosed() {
40
+ this.closeEmitter.fire();
41
+ }
40
42
  send(message) {
41
- const msg = `${StreamCommunicationProvider.CONTENT_LENGTH}: ${Buffer.byteLength(message, 'utf8')}${StreamCommunicationProvider.TWO_CRLF}${message}`;
43
+ const msg = `${StreamDebugAdapter.CONTENT_LENGTH}: ${Buffer.byteLength(message, 'utf8')}${StreamDebugAdapter.TWO_CRLF}${message}`;
42
44
  this.toAdapter.write(msg, 'utf8');
43
45
  }
44
46
  handleData(data) {
@@ -56,24 +58,24 @@ class StreamCommunicationProvider extends disposable_1.DisposableCollection {
56
58
  }
57
59
  }
58
60
  else {
59
- let idx = this.buffer.indexOf(StreamCommunicationProvider.CONTENT_LENGTH);
61
+ let idx = this.buffer.indexOf(StreamDebugAdapter.CONTENT_LENGTH);
60
62
  if (idx > 0) {
61
63
  // log unrecognized output
62
64
  const output = this.buffer.slice(0, idx);
63
65
  console.log(output.toString('utf-8'));
64
66
  this.buffer = this.buffer.slice(idx);
65
67
  }
66
- idx = this.buffer.indexOf(StreamCommunicationProvider.TWO_CRLF);
68
+ idx = this.buffer.indexOf(StreamDebugAdapter.TWO_CRLF);
67
69
  if (idx !== -1) {
68
70
  const header = this.buffer.toString('utf8', 0, idx);
69
71
  const lines = header.split('\r\n');
70
72
  for (let i = 0; i < lines.length; i++) {
71
73
  const pair = lines[i].split(/: +/);
72
- if (pair[0] === StreamCommunicationProvider.CONTENT_LENGTH) {
74
+ if (pair[0] === StreamDebugAdapter.CONTENT_LENGTH) {
73
75
  this.contentLength = +pair[1];
74
76
  }
75
77
  }
76
- this.buffer = this.buffer.slice(idx + StreamCommunicationProvider.TWO_CRLF.length);
78
+ this.buffer = this.buffer.slice(idx + StreamDebugAdapter.TWO_CRLF.length);
77
79
  continue;
78
80
  }
79
81
  }
@@ -81,8 +83,31 @@ class StreamCommunicationProvider extends disposable_1.DisposableCollection {
81
83
  }
82
84
  }
83
85
  }
84
- exports.StreamCommunicationProvider = StreamCommunicationProvider;
85
86
  // these constants are for the message header, see: https://microsoft.github.io/debug-adapter-protocol/overview#header-part
86
- StreamCommunicationProvider.TWO_CRLF = '\r\n\r\n';
87
- StreamCommunicationProvider.CONTENT_LENGTH = 'Content-Length';
88
- //# sourceMappingURL=stream-communication-provider.js.map
87
+ StreamDebugAdapter.TWO_CRLF = '\r\n\r\n';
88
+ StreamDebugAdapter.CONTENT_LENGTH = 'Content-Length';
89
+ class ProcessDebugAdapter extends StreamDebugAdapter {
90
+ constructor(process) {
91
+ super(process.stdout, process.stdin);
92
+ this.process = process;
93
+ }
94
+ async stop() {
95
+ var _a;
96
+ this.process.kill();
97
+ (_a = this.process.stdin) === null || _a === void 0 ? void 0 : _a.end();
98
+ }
99
+ }
100
+ exports.ProcessDebugAdapter = ProcessDebugAdapter;
101
+ class SocketDebugAdapter extends StreamDebugAdapter {
102
+ constructor(socket) {
103
+ super(socket, socket);
104
+ this.socket = socket;
105
+ }
106
+ stop() {
107
+ return new Promise(resolve => {
108
+ this.socket.end(() => resolve());
109
+ });
110
+ }
111
+ }
112
+ exports.SocketDebugAdapter = SocketDebugAdapter;
113
+ //# sourceMappingURL=stream-debug-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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O,EAAE,OAAO,CAAC,KAAM,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI;;QACN,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,MAAA,IAAI,CAAC,OAAO,CAAC,KAAK,0CAAE,GAAG,GAAG;IAC9B,CAAC;CACJ;AAXD,kDAWC;AAED,MAAa,kBAAmB,SAAQ,kBAAkB;IAEtD,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,IAAI;QACA,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAZD,gDAYC"}
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@theia/debug",
3
- "version": "1.20.0",
3
+ "version": "1.21.0-next.15+c4c6cab0372",
4
4
  "description": "Theia - Debug Extension",
5
5
  "dependencies": {
6
- "@theia/console": "1.20.0",
7
- "@theia/core": "1.20.0",
8
- "@theia/editor": "1.20.0",
9
- "@theia/filesystem": "1.20.0",
10
- "@theia/markers": "1.20.0",
11
- "@theia/monaco": "1.20.0",
12
- "@theia/output": "1.20.0",
13
- "@theia/preferences": "1.20.0",
14
- "@theia/process": "1.20.0",
15
- "@theia/task": "1.20.0",
16
- "@theia/terminal": "1.20.0",
17
- "@theia/userstorage": "1.20.0",
18
- "@theia/variable-resolver": "1.20.0",
19
- "@theia/workspace": "1.20.0",
6
+ "@theia/console": "1.21.0-next.15+c4c6cab0372",
7
+ "@theia/core": "1.21.0-next.15+c4c6cab0372",
8
+ "@theia/editor": "1.21.0-next.15+c4c6cab0372",
9
+ "@theia/filesystem": "1.21.0-next.15+c4c6cab0372",
10
+ "@theia/markers": "1.21.0-next.15+c4c6cab0372",
11
+ "@theia/monaco": "1.21.0-next.15+c4c6cab0372",
12
+ "@theia/output": "1.21.0-next.15+c4c6cab0372",
13
+ "@theia/preferences": "1.21.0-next.15+c4c6cab0372",
14
+ "@theia/process": "1.21.0-next.15+c4c6cab0372",
15
+ "@theia/task": "1.21.0-next.15+c4c6cab0372",
16
+ "@theia/terminal": "1.21.0-next.15+c4c6cab0372",
17
+ "@theia/userstorage": "1.21.0-next.15+c4c6cab0372",
18
+ "@theia/variable-resolver": "1.21.0-next.15+c4c6cab0372",
19
+ "@theia/workspace": "1.21.0-next.15+c4c6cab0372",
20
20
  "jsonc-parser": "^2.2.0",
21
21
  "mkdirp": "^0.5.0",
22
22
  "p-debounce": "^2.1.0",
@@ -69,5 +69,5 @@
69
69
  "nyc": {
70
70
  "extends": "../../configs/nyc.json"
71
71
  },
72
- "gitHead": "774a2724c51d4ae026c6d2499bff3a02e3d50ba9"
72
+ "gitHead": "c4c6cab037230fc05e39c7b124a681630c2f6a33"
73
73
  }
@@ -72,13 +72,13 @@ export class DebugConsoleSession extends ConsoleSession {
72
72
  this.completionKinds.set('file', monaco.languages.CompletionItemKind.File);
73
73
  this.completionKinds.set('reference', monaco.languages.CompletionItemKind.Reference);
74
74
  this.completionKinds.set('customcolor', monaco.languages.CompletionItemKind.Color);
75
- monaco.languages.registerCompletionItemProvider({
75
+ this.toDispose.push(monaco.languages.registerCompletionItemProvider({
76
76
  scheme: DebugConsoleSession.uri.scheme,
77
77
  hasAccessToAllModels: true
78
78
  }, {
79
79
  triggerCharacters: ['.'],
80
80
  provideCompletionItems: (model, position) => this.completions(model, position),
81
- });
81
+ }));
82
82
  }
83
83
 
84
84
  getElements(): IterableIterator<ConsoleItem> {
@@ -646,11 +646,11 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
646
646
  execute: (config?: DebugSessionOptions) => this.start(true, config)
647
647
  });
648
648
  registry.registerCommand(DebugCommands.STOP, {
649
- execute: () => this.manager.terminateSessions(),
649
+ execute: () => this.manager.terminateSession(),
650
650
  isEnabled: () => this.manager.state !== DebugState.Inactive
651
651
  });
652
652
  registry.registerCommand(DebugCommands.RESTART, {
653
- execute: () => this.manager.restartSessions(),
653
+ execute: () => this.manager.restartSession(),
654
654
  isEnabled: () => this.manager.state !== DebugState.Inactive
655
655
  });
656
656
 
@@ -722,12 +722,12 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
722
722
  });
723
723
 
724
724
  registry.registerCommand(DebugSessionContextCommands.STOP, {
725
- execute: () => this.selectedSession && this.selectedSession.terminate(),
725
+ execute: () => this.selectedSession && this.manager.terminateSession(this.selectedSession),
726
726
  isEnabled: () => !!this.selectedSession && this.selectedSession.state !== DebugState.Inactive,
727
727
  isVisible: () => !this.selectedThread
728
728
  });
729
729
  registry.registerCommand(DebugSessionContextCommands.RESTART, {
730
- execute: () => this.selectedSession && this.manager.restart(this.selectedSession),
730
+ execute: () => this.selectedSession && this.manager.restartSession(this.selectedSession),
731
731
  isEnabled: () => !!this.selectedSession && this.selectedSession.state !== DebugState.Inactive,
732
732
  isVisible: () => !this.selectedThread
733
733
  });