@theia/debug 1.18.0 → 1.21.0-next.12

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 (168) hide show
  1. package/lib/browser/console/debug-console-contribution.d.ts +1 -0
  2. package/lib/browser/console/debug-console-contribution.d.ts.map +1 -1
  3. package/lib/browser/console/debug-console-contribution.js +8 -6
  4. package/lib/browser/console/debug-console-contribution.js.map +1 -1
  5. package/lib/browser/console/debug-console-session.d.ts +1 -1
  6. package/lib/browser/console/debug-console-session.js +2 -2
  7. package/lib/browser/console/debug-console-session.js.map +1 -1
  8. package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
  9. package/lib/browser/debug-configuration-manager.js +8 -7
  10. package/lib/browser/debug-configuration-manager.js.map +1 -1
  11. package/lib/browser/debug-frontend-application-contribution.d.ts +5 -12
  12. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  13. package/lib/browser/debug-frontend-application-contribution.js +139 -112
  14. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  15. package/lib/browser/debug-preferences.d.ts +1 -0
  16. package/lib/browser/debug-preferences.d.ts.map +1 -1
  17. package/lib/browser/debug-preferences.js +22 -6
  18. package/lib/browser/debug-preferences.js.map +1 -1
  19. package/lib/browser/debug-prefix-configuration.d.ts.map +1 -1
  20. package/lib/browser/debug-prefix-configuration.js +3 -3
  21. package/lib/browser/debug-prefix-configuration.js.map +1 -1
  22. package/lib/browser/debug-session-connection.d.ts +23 -18
  23. package/lib/browser/debug-session-connection.d.ts.map +1 -1
  24. package/lib/browser/debug-session-connection.js +86 -65
  25. package/lib/browser/debug-session-connection.js.map +1 -1
  26. package/lib/browser/debug-session-contribution.d.ts +1 -1
  27. package/lib/browser/debug-session-contribution.d.ts.map +1 -1
  28. package/lib/browser/debug-session-contribution.js +1 -1
  29. package/lib/browser/debug-session-contribution.js.map +1 -1
  30. package/lib/browser/debug-session-manager.d.ts +6 -14
  31. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  32. package/lib/browser/debug-session-manager.js +41 -44
  33. package/lib/browser/debug-session-manager.js.map +1 -1
  34. package/lib/browser/debug-session.d.ts +9 -8
  35. package/lib/browser/debug-session.d.ts.map +1 -1
  36. package/lib/browser/debug-session.js +55 -58
  37. package/lib/browser/debug-session.js.map +1 -1
  38. package/lib/browser/model/debug-function-breakpoint.d.ts.map +1 -1
  39. package/lib/browser/model/debug-function-breakpoint.js +4 -3
  40. package/lib/browser/model/debug-function-breakpoint.js.map +1 -1
  41. package/lib/browser/preferences/launch-preferences.d.ts.map +1 -1
  42. package/lib/browser/preferences/launch-preferences.js +2 -1
  43. package/lib/browser/preferences/launch-preferences.js.map +1 -1
  44. package/lib/browser/view/debug-breakpoints-source.d.ts +0 -1
  45. package/lib/browser/view/debug-breakpoints-source.d.ts.map +1 -1
  46. package/lib/browser/view/debug-breakpoints-source.js +1 -7
  47. package/lib/browser/view/debug-breakpoints-source.js.map +1 -1
  48. package/lib/browser/view/debug-breakpoints-widget.d.ts.map +1 -1
  49. package/lib/browser/view/debug-breakpoints-widget.js +2 -1
  50. package/lib/browser/view/debug-breakpoints-widget.js.map +1 -1
  51. package/lib/browser/view/debug-configuration-widget.d.ts +1 -1
  52. package/lib/browser/view/debug-configuration-widget.d.ts.map +1 -1
  53. package/lib/browser/view/debug-configuration-widget.js +8 -8
  54. package/lib/browser/view/debug-configuration-widget.js.map +1 -1
  55. package/lib/browser/view/debug-session-widget.d.ts +2 -1
  56. package/lib/browser/view/debug-session-widget.d.ts.map +1 -1
  57. package/lib/browser/view/debug-session-widget.js +12 -6
  58. package/lib/browser/view/debug-session-widget.js.map +1 -1
  59. package/lib/browser/view/debug-stack-frames-source.d.ts +0 -1
  60. package/lib/browser/view/debug-stack-frames-source.d.ts.map +1 -1
  61. package/lib/browser/view/debug-stack-frames-source.js +2 -5
  62. package/lib/browser/view/debug-stack-frames-source.js.map +1 -1
  63. package/lib/browser/view/debug-stack-frames-widget.d.ts.map +1 -1
  64. package/lib/browser/view/debug-stack-frames-widget.js +2 -1
  65. package/lib/browser/view/debug-stack-frames-widget.js.map +1 -1
  66. package/lib/browser/view/debug-threads-source.d.ts +0 -1
  67. package/lib/browser/view/debug-threads-source.d.ts.map +1 -1
  68. package/lib/browser/view/debug-threads-source.js +1 -7
  69. package/lib/browser/view/debug-threads-source.js.map +1 -1
  70. package/lib/browser/view/debug-threads-widget.d.ts.map +1 -1
  71. package/lib/browser/view/debug-threads-widget.js +2 -1
  72. package/lib/browser/view/debug-threads-widget.js.map +1 -1
  73. package/lib/browser/view/debug-toolbar-widget.d.ts.map +1 -1
  74. package/lib/browser/view/debug-toolbar-widget.js +9 -8
  75. package/lib/browser/view/debug-toolbar-widget.js.map +1 -1
  76. package/lib/browser/view/debug-variables-source.d.ts +0 -1
  77. package/lib/browser/view/debug-variables-source.d.ts.map +1 -1
  78. package/lib/browser/view/debug-variables-source.js +2 -5
  79. package/lib/browser/view/debug-variables-source.js.map +1 -1
  80. package/lib/browser/view/debug-variables-widget.d.ts.map +1 -1
  81. package/lib/browser/view/debug-variables-widget.js +2 -1
  82. package/lib/browser/view/debug-variables-widget.js.map +1 -1
  83. package/lib/browser/view/debug-view-model.js +3 -3
  84. package/lib/browser/view/debug-view-model.js.map +1 -1
  85. package/lib/browser/view/debug-watch-source.d.ts +0 -1
  86. package/lib/browser/view/debug-watch-source.d.ts.map +1 -1
  87. package/lib/browser/view/debug-watch-source.js +2 -5
  88. package/lib/browser/view/debug-watch-source.js.map +1 -1
  89. package/lib/browser/view/debug-watch-widget.d.ts.map +1 -1
  90. package/lib/browser/view/debug-watch-widget.js +2 -1
  91. package/lib/browser/view/debug-watch-widget.js.map +1 -1
  92. package/lib/browser/view/debug-widget.d.ts.map +1 -1
  93. package/lib/browser/view/debug-widget.js +2 -1
  94. package/lib/browser/view/debug-widget.js.map +1 -1
  95. package/lib/common/debug-service.d.ts +10 -0
  96. package/lib/common/debug-service.d.ts.map +1 -1
  97. package/lib/node/debug-adapter-contribution-registry.d.ts +1 -1
  98. package/lib/node/debug-adapter-contribution-registry.d.ts.map +1 -1
  99. package/lib/node/debug-adapter-contribution-registry.js +1 -1
  100. package/lib/node/debug-adapter-contribution-registry.js.map +1 -1
  101. package/lib/node/debug-adapter-factory.d.ts +4 -4
  102. package/lib/node/debug-adapter-factory.d.ts.map +1 -1
  103. package/lib/node/debug-adapter-factory.js +10 -12
  104. package/lib/node/debug-adapter-factory.js.map +1 -1
  105. package/lib/node/debug-adapter-session-manager.d.ts +1 -1
  106. package/lib/node/debug-adapter-session-manager.d.ts.map +1 -1
  107. package/lib/node/debug-adapter-session-manager.js +1 -2
  108. package/lib/node/debug-adapter-session-manager.js.map +1 -1
  109. package/lib/node/debug-adapter-session.d.ts +7 -13
  110. package/lib/node/debug-adapter-session.d.ts.map +1 -1
  111. package/lib/node/debug-adapter-session.js +25 -68
  112. package/lib/node/debug-adapter-session.js.map +1 -1
  113. package/lib/node/debug-backend-module.js +1 -1
  114. package/lib/node/debug-backend-module.js.map +1 -1
  115. package/lib/{common → node}/debug-model.d.ts +37 -19
  116. package/lib/node/debug-model.d.ts.map +1 -0
  117. package/lib/{common → node}/debug-model.js +0 -0
  118. package/lib/node/debug-model.js.map +1 -0
  119. package/lib/node/inline-debug-adapter.d.ts +34 -0
  120. package/lib/node/inline-debug-adapter.d.ts.map +1 -0
  121. package/lib/node/inline-debug-adapter.js +45 -0
  122. package/lib/node/inline-debug-adapter.js.map +1 -0
  123. package/lib/node/stream-debug-adapter.d.ts +52 -0
  124. package/lib/node/stream-debug-adapter.d.ts.map +1 -0
  125. package/lib/node/stream-debug-adapter.js +113 -0
  126. package/lib/node/stream-debug-adapter.js.map +1 -0
  127. package/lib/node/vscode/vscode-debug-adapter-contribution.d.ts +1 -1
  128. package/lib/node/vscode/vscode-debug-adapter-contribution.d.ts.map +1 -1
  129. package/package.json +17 -17
  130. package/src/browser/console/debug-console-contribution.tsx +9 -6
  131. package/src/browser/console/debug-console-session.ts +2 -2
  132. package/src/browser/debug-configuration-manager.ts +10 -8
  133. package/src/browser/debug-frontend-application-contribution.ts +160 -125
  134. package/src/browser/debug-preferences.ts +23 -6
  135. package/src/browser/debug-prefix-configuration.ts +4 -4
  136. package/src/browser/debug-session-connection.ts +102 -76
  137. package/src/browser/debug-session-contribution.ts +3 -4
  138. package/src/browser/debug-session-manager.ts +45 -47
  139. package/src/browser/debug-session.tsx +54 -57
  140. package/src/browser/model/debug-function-breakpoint.tsx +4 -3
  141. package/src/browser/preferences/launch-preferences.ts +2 -1
  142. package/src/browser/view/debug-breakpoints-source.tsx +0 -6
  143. package/src/browser/view/debug-breakpoints-widget.ts +2 -1
  144. package/src/browser/view/debug-configuration-widget.tsx +8 -7
  145. package/src/browser/view/debug-session-widget.ts +12 -6
  146. package/src/browser/view/debug-stack-frames-source.tsx +0 -6
  147. package/src/browser/view/debug-stack-frames-widget.ts +2 -1
  148. package/src/browser/view/debug-threads-source.tsx +0 -6
  149. package/src/browser/view/debug-threads-widget.ts +2 -1
  150. package/src/browser/view/debug-toolbar-widget.tsx +13 -8
  151. package/src/browser/view/debug-variables-source.ts +0 -6
  152. package/src/browser/view/debug-variables-widget.ts +2 -1
  153. package/src/browser/view/debug-view-model.ts +3 -3
  154. package/src/browser/view/debug-watch-source.ts +0 -6
  155. package/src/browser/view/debug-watch-widget.ts +2 -1
  156. package/src/browser/view/debug-widget.ts +2 -1
  157. package/src/common/debug-service.ts +13 -0
  158. package/src/node/debug-adapter-contribution-registry.ts +1 -1
  159. package/src/node/debug-adapter-factory.ts +17 -17
  160. package/src/node/debug-adapter-session-manager.ts +1 -2
  161. package/src/node/debug-adapter-session.ts +32 -80
  162. package/src/node/debug-backend-module.ts +1 -1
  163. package/src/{common → node}/debug-model.ts +38 -18
  164. package/src/node/inline-debug-adapter.ts +47 -0
  165. package/src/node/stream-debug-adapter.ts +126 -0
  166. package/src/node/vscode/vscode-debug-adapter-contribution.ts +1 -1
  167. package/lib/common/debug-model.d.ts.map +0 -1
  168. package/lib/common/debug-model.js.map +0 -1
@@ -20,6 +20,7 @@ import { FunctionBreakpoint } from '../breakpoint/breakpoint-marker';
20
20
  import { BreakpointManager } from '../breakpoint/breakpoint-manager';
21
21
  import { DebugBreakpoint, DebugBreakpointOptions, DebugBreakpointDecoration } from './debug-breakpoint';
22
22
  import { SingleTextInputDialog } from '@theia/core/lib/browser/dialogs';
23
+ import { nls } from '@theia/core';
23
24
 
24
25
  export class DebugFunctionBreakpoint extends DebugBreakpoint<FunctionBreakpoint> implements TreeElement {
25
26
 
@@ -63,7 +64,7 @@ export class DebugFunctionBreakpoint extends DebugBreakpoint<FunctionBreakpoint>
63
64
 
64
65
  protected doGetDecoration(): DebugBreakpointDecoration {
65
66
  if (!this.isSupported()) {
66
- return this.getDisabledBreakpointDecoration('Function breakpoints are not supported by this debug type');
67
+ return this.getDisabledBreakpointDecoration(nls.localizeByDefault('Function breakpoints are not supported by this debug type'));
67
68
  }
68
69
  return super.doGetDecoration();
69
70
  }
@@ -71,13 +72,13 @@ export class DebugFunctionBreakpoint extends DebugBreakpoint<FunctionBreakpoint>
71
72
  protected getBreakpointDecoration(message?: string[]): DebugBreakpointDecoration {
72
73
  return {
73
74
  className: 'theia-debug-function',
74
- message: message || ['Function Breakpoint']
75
+ message: message || [nls.localizeByDefault('Function Breakpoint')]
75
76
  };
76
77
  }
77
78
 
78
79
  async open(): Promise<void> {
79
80
  const input = new SingleTextInputDialog({
80
- title: 'Add Function Breakpoint',
81
+ title: nls.localizeByDefault('Add Function Breakpoint'),
81
82
  initialValue: this.name
82
83
  });
83
84
  const newValue = await input.open();
@@ -18,6 +18,7 @@ import { interfaces } from '@theia/core/shared/inversify';
18
18
  import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
19
19
  import { launchSchemaId } from '../debug-schema-updater';
20
20
  import { PreferenceConfiguration } from '@theia/core/lib/browser/preferences/preference-configurations';
21
+ import { nls } from '@theia/core/lib/common/nls';
21
22
 
22
23
  export const launchPreferencesSchema: PreferenceSchema = {
23
24
  type: 'object',
@@ -25,7 +26,7 @@ export const launchPreferencesSchema: PreferenceSchema = {
25
26
  properties: {
26
27
  'launch': {
27
28
  $ref: launchSchemaId,
28
- description: "Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces",
29
+ description: nls.localizeByDefault("Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces."),
29
30
  defaultValue: { configurations: [], compounds: [] }
30
31
  }
31
32
  }
@@ -29,12 +29,6 @@ export class DebugBreakpointsSource extends TreeSource {
29
29
  @inject(BreakpointManager)
30
30
  protected readonly breakpoints: BreakpointManager;
31
31
 
32
- constructor() {
33
- super({
34
- placeholder: 'No breakpoints'
35
- });
36
- }
37
-
38
32
  @postConstruct()
39
33
  protected init(): void {
40
34
  this.fireDidChange();
@@ -21,6 +21,7 @@ import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree';
21
21
  import { DebugBreakpointsSource } from './debug-breakpoints-source';
22
22
  import { BreakpointManager } from '../breakpoint/breakpoint-manager';
23
23
  import { DebugViewModel } from './debug-view-model';
24
+ import { nls } from '@theia/core/lib/common/nls';
24
25
 
25
26
  @injectable()
26
27
  export class DebugBreakpointsWidget extends SourceTreeWidget {
@@ -57,7 +58,7 @@ export class DebugBreakpointsWidget extends SourceTreeWidget {
57
58
  protected init(): void {
58
59
  super.init();
59
60
  this.id = 'debug:breakpoints:' + this.viewModel.id;
60
- this.title.label = 'Breakpoints';
61
+ this.title.label = nls.localizeByDefault('Breakpoints');
61
62
  this.toDispose.push(this.breakpointsSource);
62
63
  this.source = this.breakpointsSource;
63
64
  }
@@ -16,7 +16,7 @@
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
18
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
19
- import { Disposable } from '@theia/core/lib/common';
19
+ import { CommandRegistry, Disposable } from '@theia/core/lib/common';
20
20
  import URI from '@theia/core/lib/common/uri';
21
21
  import { ReactWidget } from '@theia/core/lib/browser';
22
22
  import { WorkspaceService } from '@theia/workspace/lib/browser';
@@ -27,7 +27,7 @@ import { DebugAction } from './debug-action';
27
27
  import { DebugViewModel } from './debug-view-model';
28
28
  import { DebugSessionOptions } from '../debug-session-options';
29
29
  import { DebugCommands } from '../debug-frontend-application-contribution';
30
- import { CommandRegistry } from '@theia/core/lib/common';
30
+ import { nls } from '@theia/core/lib/common/nls';
31
31
 
32
32
  @injectable()
33
33
  export class DebugConfigurationWidget extends ReactWidget {
@@ -79,14 +79,15 @@ export class DebugConfigurationWidget extends ReactWidget {
79
79
  render(): React.ReactNode {
80
80
  const { options } = this;
81
81
  return <React.Fragment>
82
- <DebugAction run={this.start} label='Start Debugging' iconClass='debug-start' ref={this.setStepRef} />
82
+ <DebugAction run={this.start} label={nls.localizeByDefault('Start Debugging')} iconClass='debug-start' ref={this.setStepRef} />
83
83
  <select className='theia-select debug-configuration' value={this.currentValue} onChange={this.setCurrentConfiguration}>
84
- {options.length ? options : <option value='__NO_CONF__'>No Configurations</option>}
84
+ {options.length ? options : <option value='__NO_CONF__'>{nls.localizeByDefault('No Configurations')}</option>}
85
85
  <option disabled>{'Add Configuration...'.replace(/./g, '-')}</option>
86
- <option value='__ADD_CONF__'>Add Configuration...</option>
86
+ <option value='__ADD_CONF__'>{nls.localizeByDefault('Add Configuration...')}</option>
87
87
  </select>
88
- <DebugAction run={this.openConfiguration} label='Open launch.json' iconClass='settings-gear' />
89
- <DebugAction run={this.openConsole} label='Debug Console' iconClass='terminal' />
88
+ <DebugAction run={this.openConfiguration} label={nls.localizeByDefault('Open {0}', '"launch.json"')}
89
+ iconClass='settings-gear' />
90
+ <DebugAction run={this.openConsole} label={nls.localizeByDefault('Debug Console')} iconClass='terminal' />
90
91
  </React.Fragment>;
91
92
  }
92
93
  protected get currentValue(): string {
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { inject, injectable, postConstruct, interfaces, Container } from '@theia/core/shared/inversify';
18
18
  import {
19
- Message, ApplicationShell, Widget, BaseWidget, PanelLayout, StatefulWidget, ViewContainer, codicon
19
+ Message, ApplicationShell, Widget, BaseWidget, PanelLayout, StatefulWidget, ViewContainer, codicon, ViewContainerTitleOptions
20
20
  } from '@theia/core/lib/browser';
21
21
  import { DebugThreadsWidget } from './debug-threads-widget';
22
22
  import { DebugStackFramesWidget } from './debug-stack-frames-widget';
@@ -28,6 +28,11 @@ import { DebugWatchWidget } from './debug-watch-widget';
28
28
 
29
29
  export const DebugSessionWidgetFactory = Symbol('DebugSessionWidgetFactory');
30
30
  export type DebugSessionWidgetFactory = (options: DebugViewOptions) => DebugSessionWidget;
31
+ export const DEBUG_VIEW_CONTAINER_TITLE_OPTIONS: ViewContainerTitleOptions = {
32
+ label: 'debug',
33
+ iconClass: codicon('debug-alt'),
34
+ closeable: true
35
+ };
31
36
 
32
37
  @injectable()
33
38
  export class DebugSessionWidget extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider {
@@ -88,11 +93,12 @@ export class DebugSessionWidget extends BaseWidget implements StatefulWidget, Ap
88
93
  this.viewContainer = this.viewContainerFactory({
89
94
  id: 'debug:view-container:' + this.model.id
90
95
  });
91
- this.viewContainer.addWidget(this.threads, { weight: 30 });
92
- this.viewContainer.addWidget(this.stackFrames, { weight: 20 });
93
- this.viewContainer.addWidget(this.variables, { weight: 10 });
94
- this.viewContainer.addWidget(this.watch, { weight: 10 });
95
- this.viewContainer.addWidget(this.breakpoints, { weight: 10 });
96
+ this.viewContainer.setTitleOptions(DEBUG_VIEW_CONTAINER_TITLE_OPTIONS);
97
+ this.viewContainer.addWidget(this.threads, { weight: 30, disableDraggingToOtherContainers: true });
98
+ this.viewContainer.addWidget(this.stackFrames, { weight: 20, disableDraggingToOtherContainers: true });
99
+ this.viewContainer.addWidget(this.variables, { weight: 10, disableDraggingToOtherContainers: true });
100
+ this.viewContainer.addWidget(this.watch, { weight: 10, disableDraggingToOtherContainers: true });
101
+ this.viewContainer.addWidget(this.breakpoints, { weight: 10, disableDraggingToOtherContainers: true });
96
102
 
97
103
  this.toDispose.pushAll([
98
104
  this.toolbar,
@@ -27,12 +27,6 @@ export class DebugStackFramesSource extends TreeSource {
27
27
  @inject(DebugViewModel)
28
28
  protected readonly model: DebugViewModel;
29
29
 
30
- constructor() {
31
- super({
32
- placeholder: 'Not paused'
33
- });
34
- }
35
-
36
30
  @postConstruct()
37
31
  protected init(): void {
38
32
  this.refresh();
@@ -22,6 +22,7 @@ import { DebugStackFramesSource, LoadMoreStackFrames } from './debug-stack-frame
22
22
  import { DebugStackFrame } from '../model/debug-stack-frame';
23
23
  import { DebugViewModel } from './debug-view-model';
24
24
  import { DebugCallStackItemTypeKey } from '../debug-call-stack-item-type-key';
25
+ import { nls } from '@theia/core/lib/common/nls';
25
26
 
26
27
  @injectable()
27
28
  export class DebugStackFramesWidget extends SourceTreeWidget {
@@ -55,7 +56,7 @@ export class DebugStackFramesWidget extends SourceTreeWidget {
55
56
  protected init(): void {
56
57
  super.init();
57
58
  this.id = 'debug:frames:' + this.viewModel.id;
58
- this.title.label = 'Call Stack';
59
+ this.title.label = nls.localizeByDefault('Call Stack');
59
60
  this.toDispose.push(this.frames);
60
61
  this.source = this.frames;
61
62
 
@@ -24,12 +24,6 @@ export class DebugThreadsSource extends TreeSource {
24
24
  @inject(DebugViewModel)
25
25
  protected readonly model: DebugViewModel;
26
26
 
27
- constructor() {
28
- super({
29
- placeholder: 'Not running'
30
- });
31
- }
32
-
33
27
  @postConstruct()
34
28
  protected init(): void {
35
29
  this.fireDidChange();
@@ -23,6 +23,7 @@ import { DebugSession } from '../debug-session';
23
23
  import { DebugThread } from '../model/debug-thread';
24
24
  import { DebugViewModel } from '../view/debug-view-model';
25
25
  import { DebugCallStackItemTypeKey } from '../debug-call-stack-item-type-key';
26
+ import { nls } from '@theia/core/lib/common/nls';
26
27
 
27
28
  @injectable()
28
29
  export class DebugThreadsWidget extends SourceTreeWidget {
@@ -59,7 +60,7 @@ export class DebugThreadsWidget extends SourceTreeWidget {
59
60
  protected init(): void {
60
61
  super.init();
61
62
  this.id = 'debug:threads:' + this.viewModel.id;
62
- this.title.label = 'Threads';
63
+ this.title.label = nls.localize('theia/debug/threads', 'Threads');
63
64
  this.toDispose.push(this.threads);
64
65
  this.source = this.threads;
65
66
 
@@ -21,6 +21,7 @@ import { ReactWidget } from '@theia/core/lib/browser/widgets';
21
21
  import { DebugViewModel } from './debug-view-model';
22
22
  import { DebugState } from '../debug-session';
23
23
  import { DebugAction } from './debug-action';
24
+ import { nls } from '@theia/core/lib/common/nls';
24
25
 
25
26
  @injectable()
26
27
  export class DebugToolBar extends ReactWidget {
@@ -58,26 +59,30 @@ export class DebugToolBar extends ReactWidget {
58
59
  const { state } = this.model;
59
60
  return <React.Fragment>
60
61
  {this.renderContinue()}
61
- <DebugAction enabled={state === DebugState.Stopped} run={this.stepOver} label='Step Over' iconClass='debug-step-over' ref={this.setStepRef} />
62
- <DebugAction enabled={state === DebugState.Stopped} run={this.stepIn} label='Step Into' iconClass='debug-step-into' />
63
- <DebugAction enabled={state === DebugState.Stopped} run={this.stepOut} label='Step Out' iconClass='debug-step-out' />
64
- <DebugAction enabled={state !== DebugState.Inactive} run={this.restart} label='Restart' iconClass='debug-restart' />
62
+ <DebugAction enabled={state === DebugState.Stopped} run={this.stepOver} label={nls.localizeByDefault('Step Over')}
63
+ iconClass='debug-step-over' ref={this.setStepRef} />
64
+ <DebugAction enabled={state === DebugState.Stopped} run={this.stepIn} label={nls.localizeByDefault('Step Into')}
65
+ iconClass='debug-step-into' />
66
+ <DebugAction enabled={state === DebugState.Stopped} run={this.stepOut} label={nls.localizeByDefault('Step Out')}
67
+ iconClass='debug-step-out' />
68
+ <DebugAction enabled={state !== DebugState.Inactive} run={this.restart} label={nls.localizeByDefault('Restart')}
69
+ iconClass='debug-restart' />
65
70
  {this.renderStart()}
66
71
  </React.Fragment>;
67
72
  }
68
73
  protected renderStart(): React.ReactNode {
69
74
  const { state } = this.model;
70
75
  if (state === DebugState.Inactive && this.model.sessionCount === 1) {
71
- return <DebugAction run={this.start} label='Start' iconClass='debug-start' />;
76
+ return <DebugAction run={this.start} label={nls.localizeByDefault('Start')} iconClass='debug-start' />;
72
77
  }
73
- return <DebugAction enabled={state !== DebugState.Inactive} run={this.stop} label='Stop' iconClass='debug-stop' />;
78
+ return <DebugAction enabled={state !== DebugState.Inactive} run={this.stop} label={nls.localizeByDefault('Stop')} iconClass='debug-stop' />;
74
79
  }
75
80
  protected renderContinue(): React.ReactNode {
76
81
  const { state } = this.model;
77
82
  if (state === DebugState.Stopped) {
78
- return <DebugAction run={this.continue} label='Continue' iconClass='debug-continue' />;
83
+ return <DebugAction run={this.continue} label={nls.localizeByDefault('Continue')} iconClass='debug-continue' />;
79
84
  }
80
- return <DebugAction enabled={state === DebugState.Running} run={this.pause} label='Pause' iconClass='debug-pause' />;
85
+ return <DebugAction enabled={state === DebugState.Running} run={this.pause} label={nls.localizeByDefault('Pause')} iconClass='debug-pause' />;
81
86
  }
82
87
 
83
88
  protected start = () => this.model.start();
@@ -26,12 +26,6 @@ export class DebugVariablesSource extends TreeSource {
26
26
  @inject(DebugViewModel)
27
27
  protected readonly model: DebugViewModel;
28
28
 
29
- constructor() {
30
- super({
31
- placeholder: 'Not paused'
32
- });
33
- }
34
-
35
29
  @postConstruct()
36
30
  protected init(): void {
37
31
  this.refresh();
@@ -19,6 +19,7 @@ import { MenuPath } from '@theia/core/lib/common';
19
19
  import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree';
20
20
  import { DebugVariablesSource } from './debug-variables-source';
21
21
  import { DebugViewModel } from './debug-view-model';
22
+ import { nls } from '@theia/core/lib/common/nls';
22
23
 
23
24
  @injectable()
24
25
  export class DebugVariablesWidget extends SourceTreeWidget {
@@ -51,7 +52,7 @@ export class DebugVariablesWidget extends SourceTreeWidget {
51
52
  protected init(): void {
52
53
  super.init();
53
54
  this.id = 'debug:variables:' + this.viewModel.id;
54
- this.title.label = 'Variables';
55
+ this.title.label = nls.localizeByDefault('Variables');
55
56
  this.toDispose.push(this.variables);
56
57
  this.source = this.variables;
57
58
  }
@@ -181,8 +181,8 @@ export class DebugViewModel implements Disposable {
181
181
  if (!session) {
182
182
  return;
183
183
  }
184
- const newSession = await this.manager.restart(session);
185
- if (newSession !== session) {
184
+ const newSession = await this.manager.restartSession(session);
185
+ if (newSession && newSession !== session) {
186
186
  this._sessions.delete(session);
187
187
  this._sessions.add(newSession);
188
188
  }
@@ -190,7 +190,7 @@ export class DebugViewModel implements Disposable {
190
190
  }
191
191
 
192
192
  async terminate(): Promise<void> {
193
- this.manager.terminateSessions();
193
+ this.manager.terminateSession();
194
194
  }
195
195
 
196
196
  get watchExpressions(): IterableIterator<DebugWatchExpression> {
@@ -26,12 +26,6 @@ export class DebugWatchSource extends TreeSource {
26
26
  @inject(DebugViewModel)
27
27
  protected readonly model: DebugViewModel;
28
28
 
29
- constructor() {
30
- super({
31
- placeholder: 'No expressions'
32
- });
33
- }
34
-
35
29
  @postConstruct()
36
30
  protected init(): void {
37
31
  this.refresh();
@@ -19,6 +19,7 @@ import { MenuPath } from '@theia/core/lib/common';
19
19
  import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree';
20
20
  import { DebugWatchSource } from './debug-watch-source';
21
21
  import { DebugViewModel } from './debug-view-model';
22
+ import { nls } from '@theia/core/lib/common/nls';
22
23
 
23
24
  @injectable()
24
25
  export class DebugWatchWidget extends SourceTreeWidget {
@@ -51,7 +52,7 @@ export class DebugWatchWidget extends SourceTreeWidget {
51
52
  protected init(): void {
52
53
  super.init();
53
54
  this.id = 'debug:watch:' + this.viewModel.id;
54
- this.title.label = 'Watch';
55
+ this.title.label = nls.localizeByDefault('Watch');
55
56
  this.toDispose.push(this.variables);
56
57
  this.source = this.variables;
57
58
  }
@@ -23,6 +23,7 @@ import { DebugConfigurationWidget } from './debug-configuration-widget';
23
23
  import { DebugViewModel } from './debug-view-model';
24
24
  import { DebugSessionManager } from '../debug-session-manager';
25
25
  import { ProgressBarFactory } from '@theia/core/lib/browser/progress-bar-factory';
26
+ import { nls } from '@theia/core/lib/common/nls';
26
27
 
27
28
  @injectable()
28
29
  export class DebugWidget extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider {
@@ -38,7 +39,7 @@ export class DebugWidget extends BaseWidget implements StatefulWidget, Applicati
38
39
  }
39
40
 
40
41
  static ID = 'debug';
41
- static LABEL = 'Debug';
42
+ static LABEL = nls.localizeByDefault('Debug');
42
43
 
43
44
  @inject(DebugViewModel)
44
45
  readonly model: DebugViewModel;
@@ -116,3 +116,16 @@ export namespace DebugError {
116
116
  data: { type }
117
117
  }));
118
118
  }
119
+
120
+ /**
121
+ * A closeable channel to send messages over with error/close handling
122
+ */
123
+ export interface Channel {
124
+ send(content: string): void;
125
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
126
+ onMessage(cb: (data: any) => void): void;
127
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
+ onError(cb: (reason: any) => void): void;
129
+ onClose(cb: (code: number, reason: string) => void): void;
130
+ close(): void;
131
+ }
@@ -19,7 +19,7 @@ import { ContributionProvider } from '@theia/core';
19
19
  import { DebugConfiguration } from '../common/debug-configuration';
20
20
  import { DebuggerDescription, DebugError } from '../common/debug-service';
21
21
 
22
- import { DebugAdapterContribution, DebugAdapterExecutable, DebugAdapterSessionFactory } from '../common/debug-model';
22
+ import { DebugAdapterContribution, DebugAdapterExecutable, DebugAdapterSessionFactory } from './debug-model';
23
23
  import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
24
24
 
25
25
  /**
@@ -32,14 +32,15 @@ import {
32
32
  } from '@theia/process/lib/node';
33
33
  import {
34
34
  DebugAdapterExecutable,
35
- CommunicationProvider,
36
35
  DebugAdapterSession,
37
36
  DebugAdapterSessionFactory,
38
37
  DebugAdapterFactory,
39
- DebugAdapterForkExecutable
40
- } from '../common/debug-model';
38
+ DebugAdapterForkExecutable,
39
+ DebugAdapter
40
+ } from './debug-model';
41
41
  import { DebugAdapterSessionImpl } from './debug-adapter-session';
42
42
  import { environment } from '@theia/core/shared/@theia/application-package';
43
+ import { ProcessDebugAdapter, SocketDebugAdapter } from './stream-debug-adapter';
43
44
 
44
45
  /**
45
46
  * [DebugAdapterFactory](#DebugAdapterFactory) implementation based on
@@ -52,15 +53,16 @@ export class LaunchBasedDebugAdapterFactory implements DebugAdapterFactory {
52
53
  @inject(ProcessManager)
53
54
  protected readonly processManager: ProcessManager;
54
55
 
55
- start(executable: DebugAdapterExecutable): CommunicationProvider {
56
+ start(executable: DebugAdapterExecutable): DebugAdapter {
56
57
  const process = this.childProcess(executable);
57
58
 
59
+ if (!process.process) {
60
+ throw new Error(`Could not start debug adapter process: ${JSON.stringify(executable)}`);
61
+ }
62
+
58
63
  // FIXME: propagate onError + onExit
59
- return {
60
- input: process.inputStream,
61
- output: process.outputStream,
62
- dispose: () => process.kill()
63
- };
64
+ const provider = new ProcessDebugAdapter(process.process);
65
+ return provider;
64
66
  }
65
67
 
66
68
  private childProcess(executable: DebugAdapterExecutable): RawProcess {
@@ -81,14 +83,12 @@ export class LaunchBasedDebugAdapterFactory implements DebugAdapterFactory {
81
83
  return this.processFactory(processOptions);
82
84
  }
83
85
 
84
- connect(debugServerPort: number): CommunicationProvider {
86
+ connect(debugServerPort: number): DebugAdapter {
85
87
  const socket = net.createConnection(debugServerPort);
86
88
  // FIXME: propagate socket.on('error', ...) + socket.on('close', ...)
87
- return {
88
- input: socket,
89
- output: socket,
90
- dispose: () => socket.end()
91
- };
89
+
90
+ const provider = new SocketDebugAdapter(socket);
91
+ return provider;
92
92
  }
93
93
  }
94
94
 
@@ -98,10 +98,10 @@ export class LaunchBasedDebugAdapterFactory implements DebugAdapterFactory {
98
98
  @injectable()
99
99
  export class DebugAdapterSessionFactoryImpl implements DebugAdapterSessionFactory {
100
100
 
101
- get(sessionId: string, communicationProvider: CommunicationProvider): DebugAdapterSession {
101
+ get(sessionId: string, debugAdapter: DebugAdapter): DebugAdapterSession {
102
102
  return new DebugAdapterSessionImpl(
103
103
  sessionId,
104
- communicationProvider
104
+ debugAdapter
105
105
  );
106
106
  }
107
107
  }
@@ -20,7 +20,7 @@ import { MessagingService } from '@theia/core/lib/node/messaging/messaging-servi
20
20
 
21
21
  import { DebugAdapterPath } from '../common/debug-service';
22
22
  import { DebugConfiguration } from '../common/debug-configuration';
23
- import { DebugAdapterSession, DebugAdapterSessionFactory, DebugAdapterFactory } from '../common/debug-model';
23
+ import { DebugAdapterSession, DebugAdapterSessionFactory, DebugAdapterFactory } from './debug-model';
24
24
  import { DebugAdapterContributionRegistry } from './debug-adapter-contribution-registry';
25
25
 
26
26
  /**
@@ -43,7 +43,6 @@ export class DebugAdapterSessionManager implements MessagingService.Contribution
43
43
  channel.close();
44
44
  return;
45
45
  }
46
- channel.onClose(() => session.stop());
47
46
  session.start(channel);
48
47
  });
49
48
  }