@theia/debug 1.18.0 → 1.19.0

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 (143) hide show
  1. package/lib/browser/console/debug-console-contribution.d.ts +2 -0
  2. package/lib/browser/console/debug-console-contribution.d.ts.map +1 -1
  3. package/lib/browser/console/debug-console-contribution.js +9 -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/debug-configuration-manager.d.ts.map +1 -1
  7. package/lib/browser/debug-configuration-manager.js +8 -7
  8. package/lib/browser/debug-configuration-manager.js.map +1 -1
  9. package/lib/browser/debug-frontend-application-contribution.d.ts +5 -12
  10. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  11. package/lib/browser/debug-frontend-application-contribution.js +131 -105
  12. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  13. package/lib/browser/debug-preferences.d.ts +1 -0
  14. package/lib/browser/debug-preferences.d.ts.map +1 -1
  15. package/lib/browser/debug-preferences.js +22 -6
  16. package/lib/browser/debug-preferences.js.map +1 -1
  17. package/lib/browser/debug-prefix-configuration.d.ts.map +1 -1
  18. package/lib/browser/debug-prefix-configuration.js +3 -3
  19. package/lib/browser/debug-prefix-configuration.js.map +1 -1
  20. package/lib/browser/debug-session-connection.d.ts +1 -1
  21. package/lib/browser/debug-session-connection.d.ts.map +1 -1
  22. package/lib/browser/debug-session-contribution.d.ts +1 -1
  23. package/lib/browser/debug-session-contribution.d.ts.map +1 -1
  24. package/lib/browser/debug-session-contribution.js +1 -1
  25. package/lib/browser/debug-session-contribution.js.map +1 -1
  26. package/lib/browser/preferences/launch-preferences.d.ts.map +1 -1
  27. package/lib/browser/preferences/launch-preferences.js +2 -1
  28. package/lib/browser/preferences/launch-preferences.js.map +1 -1
  29. package/lib/browser/view/debug-breakpoints-source.d.ts +0 -1
  30. package/lib/browser/view/debug-breakpoints-source.d.ts.map +1 -1
  31. package/lib/browser/view/debug-breakpoints-source.js +1 -7
  32. package/lib/browser/view/debug-breakpoints-source.js.map +1 -1
  33. package/lib/browser/view/debug-breakpoints-widget.d.ts.map +1 -1
  34. package/lib/browser/view/debug-breakpoints-widget.js +2 -1
  35. package/lib/browser/view/debug-breakpoints-widget.js.map +1 -1
  36. package/lib/browser/view/debug-configuration-widget.d.ts +1 -1
  37. package/lib/browser/view/debug-configuration-widget.d.ts.map +1 -1
  38. package/lib/browser/view/debug-configuration-widget.js +8 -8
  39. package/lib/browser/view/debug-configuration-widget.js.map +1 -1
  40. package/lib/browser/view/debug-session-widget.d.ts +2 -1
  41. package/lib/browser/view/debug-session-widget.d.ts.map +1 -1
  42. package/lib/browser/view/debug-session-widget.js +12 -6
  43. package/lib/browser/view/debug-session-widget.js.map +1 -1
  44. package/lib/browser/view/debug-stack-frames-source.d.ts +0 -1
  45. package/lib/browser/view/debug-stack-frames-source.d.ts.map +1 -1
  46. package/lib/browser/view/debug-stack-frames-source.js +2 -5
  47. package/lib/browser/view/debug-stack-frames-source.js.map +1 -1
  48. package/lib/browser/view/debug-stack-frames-widget.d.ts.map +1 -1
  49. package/lib/browser/view/debug-stack-frames-widget.js +2 -1
  50. package/lib/browser/view/debug-stack-frames-widget.js.map +1 -1
  51. package/lib/browser/view/debug-threads-source.d.ts +0 -1
  52. package/lib/browser/view/debug-threads-source.d.ts.map +1 -1
  53. package/lib/browser/view/debug-threads-source.js +1 -7
  54. package/lib/browser/view/debug-threads-source.js.map +1 -1
  55. package/lib/browser/view/debug-threads-widget.d.ts.map +1 -1
  56. package/lib/browser/view/debug-threads-widget.js +2 -1
  57. package/lib/browser/view/debug-threads-widget.js.map +1 -1
  58. package/lib/browser/view/debug-toolbar-widget.d.ts.map +1 -1
  59. package/lib/browser/view/debug-toolbar-widget.js +9 -8
  60. package/lib/browser/view/debug-toolbar-widget.js.map +1 -1
  61. package/lib/browser/view/debug-variables-source.d.ts +0 -1
  62. package/lib/browser/view/debug-variables-source.d.ts.map +1 -1
  63. package/lib/browser/view/debug-variables-source.js +2 -5
  64. package/lib/browser/view/debug-variables-source.js.map +1 -1
  65. package/lib/browser/view/debug-variables-widget.d.ts.map +1 -1
  66. package/lib/browser/view/debug-variables-widget.js +2 -1
  67. package/lib/browser/view/debug-variables-widget.js.map +1 -1
  68. package/lib/browser/view/debug-watch-source.d.ts +0 -1
  69. package/lib/browser/view/debug-watch-source.d.ts.map +1 -1
  70. package/lib/browser/view/debug-watch-source.js +2 -5
  71. package/lib/browser/view/debug-watch-source.js.map +1 -1
  72. package/lib/browser/view/debug-watch-widget.d.ts.map +1 -1
  73. package/lib/browser/view/debug-watch-widget.js +2 -1
  74. package/lib/browser/view/debug-watch-widget.js.map +1 -1
  75. package/lib/browser/view/debug-widget.d.ts.map +1 -1
  76. package/lib/browser/view/debug-widget.js +2 -1
  77. package/lib/browser/view/debug-widget.js.map +1 -1
  78. package/lib/node/debug-adapter-contribution-registry.d.ts +1 -1
  79. package/lib/node/debug-adapter-contribution-registry.d.ts.map +1 -1
  80. package/lib/node/debug-adapter-contribution-registry.js +1 -1
  81. package/lib/node/debug-adapter-contribution-registry.js.map +1 -1
  82. package/lib/node/debug-adapter-factory.d.ts +1 -1
  83. package/lib/node/debug-adapter-factory.d.ts.map +1 -1
  84. package/lib/node/debug-adapter-factory.js +8 -10
  85. package/lib/node/debug-adapter-factory.js.map +1 -1
  86. package/lib/node/debug-adapter-session-manager.d.ts +1 -1
  87. package/lib/node/debug-adapter-session-manager.d.ts.map +1 -1
  88. package/lib/node/debug-adapter-session-manager.js +1 -1
  89. package/lib/node/debug-adapter-session-manager.js.map +1 -1
  90. package/lib/node/debug-adapter-session.d.ts +1 -7
  91. package/lib/node/debug-adapter-session.d.ts.map +1 -1
  92. package/lib/node/debug-adapter-session.js +4 -48
  93. package/lib/node/debug-adapter-session.js.map +1 -1
  94. package/lib/node/debug-backend-module.js +1 -1
  95. package/lib/node/debug-backend-module.js.map +1 -1
  96. package/lib/{common → node}/debug-model.d.ts +6 -5
  97. package/lib/node/debug-model.d.ts.map +1 -0
  98. package/lib/{common → node}/debug-model.js +0 -0
  99. package/lib/node/debug-model.js.map +1 -0
  100. package/lib/node/inline-communication-provider.d.ts +33 -0
  101. package/lib/node/inline-communication-provider.d.ts.map +1 -0
  102. package/lib/node/inline-communication-provider.js +43 -0
  103. package/lib/node/inline-communication-provider.js.map +1 -0
  104. package/lib/node/stream-communication-provider.d.ts +38 -0
  105. package/lib/node/stream-communication-provider.d.ts.map +1 -0
  106. package/lib/node/stream-communication-provider.js +88 -0
  107. package/lib/node/stream-communication-provider.js.map +1 -0
  108. package/lib/node/vscode/vscode-debug-adapter-contribution.d.ts +1 -1
  109. package/lib/node/vscode/vscode-debug-adapter-contribution.d.ts.map +1 -1
  110. package/package.json +17 -17
  111. package/src/browser/console/debug-console-contribution.tsx +10 -6
  112. package/src/browser/debug-configuration-manager.ts +10 -8
  113. package/src/browser/debug-frontend-application-contribution.ts +152 -118
  114. package/src/browser/debug-preferences.ts +23 -6
  115. package/src/browser/debug-prefix-configuration.ts +3 -3
  116. package/src/browser/debug-session-connection.ts +1 -1
  117. package/src/browser/debug-session-contribution.ts +1 -1
  118. package/src/browser/preferences/launch-preferences.ts +5 -1
  119. package/src/browser/view/debug-breakpoints-source.tsx +0 -6
  120. package/src/browser/view/debug-breakpoints-widget.ts +2 -1
  121. package/src/browser/view/debug-configuration-widget.tsx +8 -7
  122. package/src/browser/view/debug-session-widget.ts +12 -6
  123. package/src/browser/view/debug-stack-frames-source.tsx +0 -6
  124. package/src/browser/view/debug-stack-frames-widget.ts +2 -1
  125. package/src/browser/view/debug-threads-source.tsx +0 -6
  126. package/src/browser/view/debug-threads-widget.ts +2 -1
  127. package/src/browser/view/debug-toolbar-widget.tsx +13 -8
  128. package/src/browser/view/debug-variables-source.ts +0 -6
  129. package/src/browser/view/debug-variables-widget.ts +2 -1
  130. package/src/browser/view/debug-watch-source.ts +0 -6
  131. package/src/browser/view/debug-watch-widget.ts +2 -1
  132. package/src/browser/view/debug-widget.ts +2 -1
  133. package/src/node/debug-adapter-contribution-registry.ts +1 -1
  134. package/src/node/debug-adapter-factory.ts +10 -11
  135. package/src/node/debug-adapter-session-manager.ts +1 -1
  136. package/src/node/debug-adapter-session.ts +8 -57
  137. package/src/node/debug-backend-module.ts +1 -1
  138. package/src/{common → node}/debug-model.ts +6 -4
  139. package/src/node/inline-communication-provider.ts +44 -0
  140. package/src/node/stream-communication-provider.ts +93 -0
  141. package/src/node/vscode/vscode-debug-adapter-contribution.ts +1 -1
  142. package/lib/common/debug-model.d.ts.map +0 -1
  143. package/lib/common/debug-model.js.map +0 -1
@@ -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.localize('vscode/debugCommands/startDebug', '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.localize('vscode/debugActionViewItems/noConfigurations', '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.localize('vscode/debugActionViewItems/addConfiguration', '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.localize('vscode/debugCommands/openLaunchJson', 'Open "launch.json"', '"launch.json"')}
89
+ iconClass='settings-gear' />
90
+ <DebugAction run={this.openConsole} label={nls.localize('vscode/repl/debugConsole', '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.localize('vscode/debug.contribution/callStack', '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.localize('vscode/debugCommands/stepOverDebug', 'Step Over')}
63
+ iconClass='debug-step-over' ref={this.setStepRef} />
64
+ <DebugAction enabled={state === DebugState.Stopped} run={this.stepIn} label={nls.localize('vscode/debugCommands/stepIntoDebug', 'Step Into')}
65
+ iconClass='debug-step-into' />
66
+ <DebugAction enabled={state === DebugState.Stopped} run={this.stepOut} label={nls.localize('vscode/debugCommands/stepOutDebug', 'Step Out')}
67
+ iconClass='debug-step-out' />
68
+ <DebugAction enabled={state !== DebugState.Inactive} run={this.restart} label={nls.localize('vscode/debugCommands/restartDebug', '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.localize('vscode/debugCommands/startDebug', '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.localize('vscode/debugCommands/stop', '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.localize('vscode/debugCommands/continueDebug', '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.localize('vscode/debugCommands/pauseDebug', '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.localize('vscode/debug.contribution/variables', 'Variables');
55
56
  this.toDispose.push(this.variables);
56
57
  this.source = this.variables;
57
58
  }
@@ -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.localize('vscode/debug.contribution/watch', '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.localize('vscode/settingsLayout/debug', 'Debug');
42
43
 
43
44
  @inject(DebugViewModel)
44
45
  readonly model: DebugViewModel;
@@ -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
  /**
@@ -37,9 +37,11 @@ import {
37
37
  DebugAdapterSessionFactory,
38
38
  DebugAdapterFactory,
39
39
  DebugAdapterForkExecutable
40
- } from '../common/debug-model';
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 { StreamCommunicationProvider } from './stream-communication-provider';
44
+ import { Disposable } from '@theia/core/lib/common/disposable';
43
45
 
44
46
  /**
45
47
  * [DebugAdapterFactory](#DebugAdapterFactory) implementation based on
@@ -56,11 +58,9 @@ export class LaunchBasedDebugAdapterFactory implements DebugAdapterFactory {
56
58
  const process = this.childProcess(executable);
57
59
 
58
60
  // FIXME: propagate onError + onExit
59
- return {
60
- input: process.inputStream,
61
- output: process.outputStream,
62
- dispose: () => process.kill()
63
- };
61
+ const provider = new StreamCommunicationProvider(process.outputStream, process.inputStream);
62
+ provider.push(Disposable.create(() => process.kill()));
63
+ return provider;
64
64
  }
65
65
 
66
66
  private childProcess(executable: DebugAdapterExecutable): RawProcess {
@@ -84,11 +84,10 @@ export class LaunchBasedDebugAdapterFactory implements DebugAdapterFactory {
84
84
  connect(debugServerPort: number): CommunicationProvider {
85
85
  const socket = net.createConnection(debugServerPort);
86
86
  // FIXME: propagate socket.on('error', ...) + socket.on('close', ...)
87
- return {
88
- input: socket,
89
- output: socket,
90
- dispose: () => socket.end()
91
- };
87
+
88
+ const provider = new StreamCommunicationProvider(socket, socket);
89
+ provider.push(Disposable.create(() => socket.end()));
90
+ return provider;
92
91
  }
93
92
  }
94
93
 
@@ -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
  /**
@@ -23,8 +23,8 @@
23
23
 
24
24
  import {
25
25
  CommunicationProvider,
26
- DebugAdapterSession,
27
- } from '../common/debug-model';
26
+ DebugAdapterSession
27
+ } from './debug-model';
28
28
  import { DebugProtocol } from 'vscode-debugprotocol';
29
29
  import { IWebSocket } from '@theia/core/shared/vscode-ws-jsonrpc';
30
30
  import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposable';
@@ -34,25 +34,23 @@ import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposa
34
34
  */
35
35
  export class DebugAdapterSessionImpl implements DebugAdapterSession {
36
36
 
37
- private static TWO_CRLF = '\r\n\r\n';
38
- private static CONTENT_LENGTH = 'Content-Length';
39
-
40
37
  private readonly toDispose = new DisposableCollection();
41
38
  private channel: IWebSocket | undefined;
42
- private contentLength: number;
43
- private buffer: Buffer;
44
39
 
45
40
  constructor(
46
41
  readonly id: string,
47
42
  protected readonly communicationProvider: CommunicationProvider
48
43
  ) {
49
- this.contentLength = -1;
50
- this.buffer = Buffer.alloc(0);
51
44
  this.toDispose.pushAll([
52
45
  this.communicationProvider,
53
46
  Disposable.create(() => this.write(JSON.stringify({ seq: -1, type: 'request', command: 'disconnect' }))),
54
47
  Disposable.create(() => this.write(JSON.stringify({ seq: -1, type: 'request', command: 'terminate' })))
55
48
  ]);
49
+
50
+ this.communicationProvider.onMessageReceived((message: string) => this.send(message));
51
+ this.communicationProvider.onClose(() => this.onDebugAdapterExit(1, undefined)); // FIXME pass a proper exit code
52
+ this.communicationProvider.onError(error => this.onDebugAdapterError(error));
53
+
56
54
  }
57
55
 
58
56
  async start(channel: IWebSocket): Promise<void> {
@@ -63,10 +61,6 @@ export class DebugAdapterSessionImpl implements DebugAdapterSession {
63
61
  this.channel.onMessage((message: string) => this.write(message));
64
62
  this.channel.onClose(() => this.channel = undefined);
65
63
 
66
- this.communicationProvider.output.on('data', (data: Buffer) => this.handleData(data));
67
- this.communicationProvider.output.on('close', () => this.onDebugAdapterExit(1, undefined)); // FIXME pass a proper exit code
68
- this.communicationProvider.output.on('error', error => this.onDebugAdapterError(error));
69
- this.communicationProvider.input.on('error', error => this.onDebugAdapterError(error));
70
64
  }
71
65
 
72
66
  protected onDebugAdapterExit(exitCode: number, signal: string | undefined): void {
@@ -91,49 +85,6 @@ export class DebugAdapterSessionImpl implements DebugAdapterSession {
91
85
  this.send(JSON.stringify(event));
92
86
  }
93
87
 
94
- protected handleData(data: Buffer): void {
95
- this.buffer = Buffer.concat([this.buffer, data]);
96
-
97
- while (true) {
98
- if (this.contentLength >= 0) {
99
- if (this.buffer.length >= this.contentLength) {
100
- const message = this.buffer.toString('utf8', 0, this.contentLength);
101
- this.buffer = this.buffer.slice(this.contentLength);
102
- this.contentLength = -1;
103
-
104
- if (message.length > 0) {
105
- this.send(message);
106
- }
107
- continue; // there may be more complete messages to process
108
- }
109
- } else {
110
- let idx = this.buffer.indexOf(DebugAdapterSessionImpl.CONTENT_LENGTH);
111
- if (idx > 0) {
112
- // log unrecognized output
113
- const output = this.buffer.slice(0, idx);
114
- console.log(output.toString('utf-8'));
115
-
116
- this.buffer = this.buffer.slice(idx);
117
- }
118
-
119
- idx = this.buffer.indexOf(DebugAdapterSessionImpl.TWO_CRLF);
120
- if (idx !== -1) {
121
- const header = this.buffer.toString('utf8', 0, idx);
122
- const lines = header.split('\r\n');
123
- for (let i = 0; i < lines.length; i++) {
124
- const pair = lines[i].split(/: +/);
125
- if (pair[0] === DebugAdapterSessionImpl.CONTENT_LENGTH) {
126
- this.contentLength = +pair[1];
127
- }
128
- }
129
- this.buffer = this.buffer.slice(idx + DebugAdapterSessionImpl.TWO_CRLF.length);
130
- continue;
131
- }
132
- }
133
- break;
134
- }
135
- }
136
-
137
88
  protected send(message: string): void {
138
89
  if (this.channel) {
139
90
  this.channel.send(message);
@@ -141,7 +92,7 @@ export class DebugAdapterSessionImpl implements DebugAdapterSession {
141
92
  }
142
93
 
143
94
  protected write(message: string): void {
144
- this.communicationProvider.input.write(`Content-Length: ${Buffer.byteLength(message, 'utf8')}\r\n\r\n${message}`, 'utf8');
95
+ this.communicationProvider.send(message);
145
96
  }
146
97
 
147
98
  async stop(): Promise<void> {
@@ -30,7 +30,7 @@ import {
30
30
  DebugAdapterContribution,
31
31
  DebugAdapterSessionFactory,
32
32
  DebugAdapterFactory
33
- } from '../common/debug-model';
33
+ } from './debug-model';
34
34
  import { DebugServiceImpl } from './debug-service-impl';
35
35
  import { DebugAdapterContributionRegistry } from './debug-adapter-contribution-registry';
36
36
  import { DebugAdapterSessionManager } from './debug-adapter-session-manager';
@@ -22,12 +22,12 @@
22
22
  // Some entities copied and modified from https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.d.ts
23
23
  // Some entities copied and modified from https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/debug/common/debug.ts
24
24
 
25
- import * as stream from 'stream';
26
25
  import { WebSocketChannel } from '@theia/core/lib/common/messaging/web-socket-channel';
27
- import { DebugConfiguration } from './debug-configuration';
26
+ import { DebugConfiguration } from '../common/debug-configuration';
28
27
  import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
29
28
  import { Disposable } from '@theia/core/lib/common/disposable';
30
29
  import { MaybePromise } from '@theia/core/lib/common/types';
30
+ import { Event } from '@theia/core/lib/common/event';
31
31
 
32
32
  // FIXME: break down this file to debug adapter and debug adapter contribution (see Theia file naming conventions)
33
33
 
@@ -96,8 +96,10 @@ export type DebugAdapterExecutable = DebugAdapterSpawnExecutable | DebugAdapterF
96
96
  * TODO: the better name is DebugStreamConnection + handling on error and close
97
97
  */
98
98
  export interface CommunicationProvider extends Disposable {
99
- output: stream.Readable;
100
- input: stream.Writable;
99
+ onMessageReceived: Event<string>;
100
+ onError: Event<Error>;
101
+ onClose: Event<void>;
102
+ send(message: string): void;
101
103
  }
102
104
 
103
105
  /**
@@ -0,0 +1,44 @@
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 { CommunicationProvider } from './debug-model';
19
+ import * as theia from '@theia/plugin';
20
+
21
+ /**
22
+ * A communication provider for using the inline implementation of a debug adapter.
23
+ */
24
+ export class InlineCommunicationProvider implements CommunicationProvider {
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
+ send(message: string): void {
38
+ this.debugAdapter.handleMessage(JSON.parse(message));
39
+ }
40
+
41
+ dispose(): void {
42
+ this.debugAdapter.dispose();
43
+ }
44
+ }
@@ -0,0 +1,93 @@
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 { DisposableCollection } from '@theia/core/lib/common/disposable';
18
+ import { Emitter, Event } from '@theia/core/lib/common/event';
19
+ import * as stream from 'stream';
20
+ import { CommunicationProvider } from './debug-model';
21
+
22
+ export class StreamCommunicationProvider extends DisposableCollection implements CommunicationProvider {
23
+ private messageReceivedEmitter = new Emitter<string>();
24
+ onMessageReceived: Event<string> = this.messageReceivedEmitter.event;
25
+ private errorEmitter = new Emitter<Error>();
26
+ onError: Event<Error> = this.errorEmitter.event;
27
+ private closeEmitter = new Emitter<void>();
28
+ onClose: Event<void> = this.closeEmitter.event;
29
+
30
+ // these constants are for the message header, see: https://microsoft.github.io/debug-adapter-protocol/overview#header-part
31
+ private static TWO_CRLF = '\r\n\r\n';
32
+ private static CONTENT_LENGTH = 'Content-Length';
33
+ private contentLength: number = -1;
34
+ private buffer: Buffer = Buffer.alloc(0);
35
+
36
+ constructor(private fromAdapter: stream.Readable, private toAdapter: stream.Writable) {
37
+ super();
38
+
39
+ this.fromAdapter.on('data', (data: Buffer) => this.handleData(data));
40
+ this.fromAdapter.on('close', () => this.closeEmitter.fire()); // FIXME pass a proper exit code
41
+ this.fromAdapter.on('error', error => this.errorEmitter.fire(error));
42
+ this.toAdapter.on('error', error => this.errorEmitter.fire(error));
43
+ };
44
+
45
+ send(message: string): void {
46
+ const msg = `${StreamCommunicationProvider.CONTENT_LENGTH}: ${Buffer.byteLength(message, 'utf8')}${StreamCommunicationProvider.TWO_CRLF}${message}`;
47
+
48
+ this.toAdapter.write(msg, 'utf8');
49
+ }
50
+
51
+ protected handleData(data: Buffer): void {
52
+ this.buffer = Buffer.concat([this.buffer, data]);
53
+
54
+ while (true) {
55
+ if (this.contentLength >= 0) {
56
+ if (this.buffer.length >= this.contentLength) {
57
+ const message = this.buffer.toString('utf8', 0, this.contentLength);
58
+ this.buffer = this.buffer.slice(this.contentLength);
59
+ this.contentLength = -1;
60
+
61
+ if (message.length > 0) {
62
+ this.messageReceivedEmitter.fire(message);
63
+ }
64
+ continue; // there may be more complete messages to process
65
+ }
66
+ } else {
67
+ let idx = this.buffer.indexOf(StreamCommunicationProvider.CONTENT_LENGTH);
68
+ if (idx > 0) {
69
+ // log unrecognized output
70
+ const output = this.buffer.slice(0, idx);
71
+ console.log(output.toString('utf-8'));
72
+
73
+ this.buffer = this.buffer.slice(idx);
74
+ }
75
+
76
+ idx = this.buffer.indexOf(StreamCommunicationProvider.TWO_CRLF);
77
+ if (idx !== -1) {
78
+ const header = this.buffer.toString('utf8', 0, idx);
79
+ const lines = header.split('\r\n');
80
+ for (let i = 0; i < lines.length; i++) {
81
+ const pair = lines[i].split(/: +/);
82
+ if (pair[0] === StreamCommunicationProvider.CONTENT_LENGTH) {
83
+ this.contentLength = +pair[1];
84
+ }
85
+ }
86
+ this.buffer = this.buffer.slice(idx + StreamCommunicationProvider.TWO_CRLF.length);
87
+ continue;
88
+ }
89
+ }
90
+ break;
91
+ }
92
+ }
93
+ }
@@ -16,7 +16,7 @@
16
16
 
17
17
  import * as fs from '@theia/core/shared/fs-extra';
18
18
  import * as path from 'path';
19
- import { DebugAdapterExecutable, DebugAdapterContribution } from '../../common/debug-model';
19
+ import { DebugAdapterExecutable, DebugAdapterContribution } from '../debug-model';
20
20
  import { isWindows, isOSX } from '@theia/core/lib/common/os';
21
21
  import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
22
22
  import { deepClone } from '@theia/core/lib/common/objects';
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug-model.d.ts","sourceRoot":"","sources":["../../src/common/debug-model.ts"],"names":[],"mappings":"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"}