@theia/debug 1.29.0-next.9 → 1.29.1

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 (127) hide show
  1. package/lib/browser/breakpoint/breakpoint-marker.d.ts +1 -1
  2. package/lib/browser/breakpoint/breakpoint-marker.d.ts.map +1 -1
  3. package/lib/browser/console/debug-console-items.d.ts +1 -1
  4. package/lib/browser/console/debug-console-items.d.ts.map +1 -1
  5. package/lib/browser/console/debug-console-session.d.ts +1 -1
  6. package/lib/browser/console/debug-console-session.d.ts.map +1 -1
  7. package/lib/browser/debug-configuration-manager.d.ts +15 -7
  8. package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
  9. package/lib/browser/debug-configuration-manager.js +81 -31
  10. package/lib/browser/debug-configuration-manager.js.map +1 -1
  11. package/lib/browser/debug-configuration-model.d.ts +3 -0
  12. package/lib/browser/debug-configuration-model.d.ts.map +1 -1
  13. package/lib/browser/debug-configuration-model.js +17 -10
  14. package/lib/browser/debug-configuration-model.js.map +1 -1
  15. package/lib/browser/debug-contribution.d.ts +1 -1
  16. package/lib/browser/debug-contribution.d.ts.map +1 -1
  17. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  18. package/lib/browser/debug-frontend-application-contribution.js +6 -3
  19. package/lib/browser/debug-frontend-application-contribution.js.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-schema-updater.d.ts.map +1 -1
  23. package/lib/browser/debug-schema-updater.js +55 -4
  24. package/lib/browser/debug-schema-updater.js.map +1 -1
  25. package/lib/browser/debug-session-connection.d.ts +1 -1
  26. package/lib/browser/debug-session-connection.d.ts.map +1 -1
  27. package/lib/browser/debug-session-contribution.d.ts +2 -2
  28. package/lib/browser/debug-session-contribution.d.ts.map +1 -1
  29. package/lib/browser/debug-session-contribution.js.map +1 -1
  30. package/lib/browser/debug-session-manager.d.ts +10 -4
  31. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  32. package/lib/browser/debug-session-manager.js +64 -7
  33. package/lib/browser/debug-session-manager.js.map +1 -1
  34. package/lib/browser/debug-session-options.d.ts +36 -6
  35. package/lib/browser/debug-session-options.d.ts.map +1 -1
  36. package/lib/browser/debug-session-options.js +53 -10
  37. package/lib/browser/debug-session-options.js.map +1 -1
  38. package/lib/browser/debug-session.d.ts +4 -4
  39. package/lib/browser/debug-session.d.ts.map +1 -1
  40. package/lib/browser/debug-session.js +7 -0
  41. package/lib/browser/debug-session.js.map +1 -1
  42. package/lib/browser/disassembly-view/disassembly-view-instruction-renderer.d.ts +1 -1
  43. package/lib/browser/disassembly-view/disassembly-view-instruction-renderer.d.ts.map +1 -1
  44. package/lib/browser/disassembly-view/disassembly-view-utilities.d.ts +1 -1
  45. package/lib/browser/disassembly-view/disassembly-view-utilities.d.ts.map +1 -1
  46. package/lib/browser/editor/debug-breakpoint-widget.d.ts +3 -1
  47. package/lib/browser/editor/debug-breakpoint-widget.d.ts.map +1 -1
  48. package/lib/browser/editor/debug-breakpoint-widget.js +5 -4
  49. package/lib/browser/editor/debug-breakpoint-widget.js.map +1 -1
  50. package/lib/browser/editor/debug-editor-model.d.ts +1 -1
  51. package/lib/browser/editor/debug-editor-model.d.ts.map +1 -1
  52. package/lib/browser/editor/debug-exception-widget.d.ts +2 -0
  53. package/lib/browser/editor/debug-exception-widget.d.ts.map +1 -1
  54. package/lib/browser/editor/debug-exception-widget.js +6 -5
  55. package/lib/browser/editor/debug-exception-widget.js.map +1 -1
  56. package/lib/browser/editor/debug-hover-widget.d.ts.map +1 -1
  57. package/lib/browser/editor/debug-hover-widget.js +9 -8
  58. package/lib/browser/editor/debug-hover-widget.js.map +1 -1
  59. package/lib/browser/model/debug-breakpoint.d.ts +1 -1
  60. package/lib/browser/model/debug-breakpoint.d.ts.map +1 -1
  61. package/lib/browser/model/debug-source-breakpoint.d.ts +1 -1
  62. package/lib/browser/model/debug-source-breakpoint.d.ts.map +1 -1
  63. package/lib/browser/model/debug-source.d.ts +1 -1
  64. package/lib/browser/model/debug-source.d.ts.map +1 -1
  65. package/lib/browser/model/debug-stack-frame.d.ts +1 -1
  66. package/lib/browser/model/debug-stack-frame.d.ts.map +1 -1
  67. package/lib/browser/model/debug-thread.d.ts +1 -1
  68. package/lib/browser/model/debug-thread.d.ts.map +1 -1
  69. package/lib/browser/view/debug-configuration-select.d.ts +4 -1
  70. package/lib/browser/view/debug-configuration-select.d.ts.map +1 -1
  71. package/lib/browser/view/debug-configuration-select.js +36 -14
  72. package/lib/browser/view/debug-configuration-select.js.map +1 -1
  73. package/lib/browser/view/debug-configuration-widget.d.ts +3 -2
  74. package/lib/browser/view/debug-configuration-widget.d.ts.map +1 -1
  75. package/lib/browser/view/debug-configuration-widget.js +5 -1
  76. package/lib/browser/view/debug-configuration-widget.js.map +1 -1
  77. package/lib/browser/view/debug-toolbar-widget.d.ts +8 -7
  78. package/lib/browser/view/debug-toolbar-widget.d.ts.map +1 -1
  79. package/lib/browser/view/debug-toolbar-widget.js +5 -1
  80. package/lib/browser/view/debug-toolbar-widget.js.map +1 -1
  81. package/lib/browser/view/debug-watch-expression.d.ts +1 -1
  82. package/lib/browser/view/debug-watch-expression.d.ts.map +1 -1
  83. package/lib/common/debug-compound.d.ts +15 -0
  84. package/lib/common/debug-compound.d.ts.map +1 -0
  85. package/lib/common/debug-compound.js +27 -0
  86. package/lib/common/debug-compound.js.map +1 -0
  87. package/lib/common/debug-configuration.d.ts +2 -2
  88. package/lib/common/debug-configuration.d.ts.map +1 -1
  89. package/lib/common/debug-configuration.js.map +1 -1
  90. package/lib/node/debug-adapter-factory.d.ts.map +1 -1
  91. package/lib/node/debug-adapter-factory.js +1 -2
  92. package/lib/node/debug-adapter-factory.js.map +1 -1
  93. package/package.json +17 -17
  94. package/src/browser/breakpoint/breakpoint-marker.ts +1 -1
  95. package/src/browser/console/debug-console-items.tsx +1 -1
  96. package/src/browser/console/debug-console-session.ts +1 -1
  97. package/src/browser/debug-configuration-manager.ts +92 -40
  98. package/src/browser/debug-configuration-model.ts +19 -10
  99. package/src/browser/debug-contribution.ts +1 -1
  100. package/src/browser/debug-frontend-application-contribution.ts +10 -3
  101. package/src/browser/debug-prefix-configuration.ts +3 -3
  102. package/src/browser/debug-schema-updater.ts +56 -5
  103. package/src/browser/debug-session-connection.ts +1 -1
  104. package/src/browser/debug-session-contribution.ts +2 -2
  105. package/src/browser/debug-session-manager.ts +79 -8
  106. package/src/browser/debug-session-options.ts +72 -15
  107. package/src/browser/debug-session.tsx +9 -3
  108. package/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts +1 -1
  109. package/src/browser/disassembly-view/disassembly-view-utilities.ts +1 -1
  110. package/src/browser/disassembly-view/disassembly-view-widget.ts +1 -1
  111. package/src/browser/editor/debug-breakpoint-widget.tsx +7 -5
  112. package/src/browser/editor/debug-editor-model.ts +1 -1
  113. package/src/browser/editor/debug-exception-widget.tsx +7 -5
  114. package/src/browser/editor/debug-hover-widget.ts +9 -8
  115. package/src/browser/model/debug-breakpoint.tsx +1 -1
  116. package/src/browser/model/debug-source-breakpoint.tsx +1 -1
  117. package/src/browser/model/debug-source.ts +1 -1
  118. package/src/browser/model/debug-stack-frame.tsx +1 -1
  119. package/src/browser/model/debug-thread.tsx +1 -1
  120. package/src/browser/view/debug-configuration-select.tsx +42 -20
  121. package/src/browser/view/debug-configuration-widget.tsx +7 -2
  122. package/src/browser/view/debug-toolbar-widget.tsx +7 -2
  123. package/src/browser/view/debug-watch-expression.tsx +1 -1
  124. package/src/common/debug-adapter-session.ts +1 -1
  125. package/src/common/debug-compound.ts +32 -0
  126. package/src/common/debug-configuration.ts +2 -2
  127. package/src/node/debug-adapter-factory.ts +2 -3
@@ -14,44 +14,101 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
+ import { Emitter } from '@theia/core';
17
18
  import { DebugConfiguration } from '../common/debug-common';
19
+ import { DebugCompound } from '../common/debug-compound';
20
+
21
+ export class DebugCompoundRoot {
22
+ private stopped = false;
23
+ private stopEmitter = new Emitter<void>();
24
+ onDidSessionStop = this.stopEmitter.event;
25
+
26
+ stopSession(): void {
27
+ if (!this.stopped) { // avoid sending extraneous terminate events
28
+ this.stopped = true;
29
+ this.stopEmitter.fire();
30
+ }
31
+ }
32
+ }
18
33
 
19
34
  export interface DebugSessionOptionsBase {
20
35
  workspaceFolderUri?: string,
21
- providerType?: string // Applicable to dynamic configurations
22
36
  }
23
37
 
24
- export interface DebugSessionOptions extends DebugSessionOptionsBase {
25
- configuration: DebugConfiguration
38
+ export interface DebugConfigurationSessionOptions extends DebugSessionOptionsBase {
39
+ name: string; // derived from the configuration
40
+ configuration: DebugConfiguration;
41
+ compound?: never;
42
+ compoundRoot?: DebugCompoundRoot;
43
+ providerType?: string // Applicable to dynamic configurations
26
44
  }
27
45
 
28
- export interface DebugSessionOptionsData extends DebugSessionOptionsBase, DebugConfiguration {
46
+ export type DynamicDebugConfigurationSessionOptions = DebugConfigurationSessionOptions & { providerType: string };
47
+
48
+ export interface DebugCompoundSessionOptions extends DebugSessionOptionsBase {
49
+ name: string; // derived from the compound
50
+ configuration?: never;
51
+ compound: DebugCompound;
52
+ noDebug?: boolean,
29
53
  }
30
54
 
31
- export interface InternalDebugSessionOptions extends DebugSessionOptions {
32
- id: number
55
+ export type DebugSessionOptions = DebugConfigurationSessionOptions | DebugCompoundSessionOptions;
56
+
57
+ export namespace DebugSessionOptions {
58
+ export function isConfiguration(options?: DebugSessionOptions): options is DebugConfigurationSessionOptions {
59
+ return !!options && 'configuration' in options && !!options.configuration;
60
+ }
61
+
62
+ export function isDynamic(options?: DebugSessionOptions): options is DynamicDebugConfigurationSessionOptions {
63
+ return isConfiguration(options) && 'providerType' in options && !!options.providerType;
64
+ }
65
+
66
+ export function isCompound(options?: DebugSessionOptions): options is DebugCompoundSessionOptions {
67
+ return !!options && 'compound' in options && !!options.compound;
68
+ }
33
69
  }
70
+
71
+ /**
72
+ * Flat and partial version of a debug session options usable to find the options later in the manager.
73
+ * @deprecated Not needed anymore, the recommended way is to serialize/deserialize the options directly using `JSON.stringify` and `JSON.parse`.
74
+ */
75
+ export type DebugSessionOptionsData = DebugSessionOptionsBase & (DebugConfiguration | DebugCompound);
76
+
77
+ export type InternalDebugSessionOptions = DebugSessionOptions & { id: number };
78
+
34
79
  export namespace InternalDebugSessionOptions {
35
80
 
36
81
  const SEPARATOR = '__CONF__';
82
+ const SEPARATOR_CONFIGS = '__COMP__';
37
83
 
38
84
  export function is(options: DebugSessionOptions): options is InternalDebugSessionOptions {
39
85
  return 'id' in options;
40
86
  }
41
87
 
42
- export function toValue(debugSessionOptions: DebugSessionOptions): string {
43
- return debugSessionOptions.configuration.name + SEPARATOR +
44
- debugSessionOptions.configuration.type + SEPARATOR +
45
- debugSessionOptions.configuration.request + SEPARATOR +
46
- debugSessionOptions.workspaceFolderUri + SEPARATOR +
47
- debugSessionOptions.providerType;
88
+ /** @deprecated Please use `JSON.stringify` to serialize the options. */
89
+ export function toValue(options: DebugSessionOptions): string {
90
+ if (DebugSessionOptions.isCompound(options)) {
91
+ return options.compound.name + SEPARATOR +
92
+ options.workspaceFolderUri + SEPARATOR +
93
+ options.compound?.configurations.join(SEPARATOR_CONFIGS);
94
+ }
95
+ return options.configuration.name + SEPARATOR +
96
+ options.configuration.type + SEPARATOR +
97
+ options.configuration.request + SEPARATOR +
98
+ options.workspaceFolderUri + SEPARATOR +
99
+ options.providerType;
48
100
  }
49
101
 
102
+ /** @deprecated Please use `JSON.parse` to restore previously serialized debug session options. */
103
+ // eslint-disable-next-line deprecation/deprecation
50
104
  export function parseValue(value: string): DebugSessionOptionsData {
51
105
  const split = value.split(SEPARATOR);
52
- if (split.length !== 5) {
53
- throw new Error('Unexpected argument, the argument is expected to have been generated by the \'toValue\' function');
106
+ if (split.length === 5) {
107
+ return { name: split[0], type: split[1], request: split[2], workspaceFolderUri: split[3], providerType: split[4] };
108
+ }
109
+ if (split.length === 3) {
110
+ return { name: split[0], workspaceFolderUri: split[1], configurations: split[2].split(SEPARATOR_CONFIGS) };
54
111
  }
55
- return {name: split[0], type: split[1], request: split[2], workspaceFolderUri: split[3], providerType: split[4]};
112
+ throw new Error('Unexpected argument, the argument is expected to have been generated by the \'toValue\' function');
56
113
  }
57
114
  }
@@ -18,7 +18,7 @@
18
18
 
19
19
  import * as React from '@theia/core/shared/react';
20
20
  import { LabelProvider } from '@theia/core/lib/browser';
21
- import { DebugProtocol } from 'vscode-debugprotocol';
21
+ import { DebugProtocol } from '@vscode/debugprotocol';
22
22
  import { Emitter, Event, DisposableCollection, Disposable, MessageClient, MessageType, Mutable, ContributionProvider } from '@theia/core/lib/common';
23
23
  import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
24
24
  import { EditorManager } from '@theia/editor/lib/browser';
@@ -33,7 +33,7 @@ import { DebugSourceBreakpoint } from './model/debug-source-breakpoint';
33
33
  import debounce = require('p-debounce');
34
34
  import URI from '@theia/core/lib/common/uri';
35
35
  import { BreakpointManager } from './breakpoint/breakpoint-manager';
36
- import { DebugSessionOptions, InternalDebugSessionOptions } from './debug-session-options';
36
+ import { DebugConfigurationSessionOptions, InternalDebugSessionOptions } from './debug-session-options';
37
37
  import { DebugConfiguration, DebugConsoleMode } from '../common/debug-common';
38
38
  import { SourceBreakpoint, ExceptionBreakpoint } from './breakpoint/breakpoint-marker';
39
39
  import { TerminalWidgetOptions, TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
@@ -76,7 +76,7 @@ export class DebugSession implements CompositeTreeElement {
76
76
 
77
77
  constructor(
78
78
  readonly id: string,
79
- readonly options: DebugSessionOptions,
79
+ readonly options: DebugConfigurationSessionOptions,
80
80
  readonly parentSession: DebugSession | undefined,
81
81
  protected readonly connection: DebugSessionConnection,
82
82
  protected readonly terminalServer: TerminalService,
@@ -117,6 +117,9 @@ export class DebugSession implements CompositeTreeElement {
117
117
  this.connection.on('capabilities', event => this.updateCapabilities(event.body.capabilities)),
118
118
  this.breakpoints.onDidChangeMarkers(uri => this.updateBreakpoints({ uri, sourceModified: true }))
119
119
  ]);
120
+ if (this.options.compoundRoot) {
121
+ this.toDispose.push(this.options.compoundRoot.onDidSessionStop(() => this.stop(false, () => { })));
122
+ }
120
123
  }
121
124
 
122
125
  get onDispose(): Event<void> {
@@ -352,6 +355,9 @@ export class DebugSession implements CompositeTreeElement {
352
355
  console.error('Error on disconnect', e);
353
356
  }
354
357
  }
358
+ if (!isRestart) {
359
+ this.options.compoundRoot?.stopSession();
360
+ }
355
361
  callback();
356
362
  }
357
363
  }
@@ -29,7 +29,7 @@ import { createStringBuilder } from '@theia/monaco-editor-core/esm/vs/editor/com
29
29
  import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model';
30
30
  import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
31
31
  import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
32
- import { DebugProtocol } from 'vscode-debugprotocol';
32
+ import { DebugProtocol } from '@vscode/debugprotocol';
33
33
  import { DebugSource } from '../model/debug-source';
34
34
  import { DisassembledInstructionEntry, DisassemblyViewRendererReference, InstructionColumnTemplateData } from './disassembly-view-utilities';
35
35
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { IDisposable, IEvent } from '@theia/monaco-editor-core';
18
18
  import { BareFontInfo } from '@theia/monaco-editor-core/esm/vs/editor/common/config/fontInfo';
19
- import { DebugProtocol } from 'vscode-debugprotocol';
19
+ import { DebugProtocol } from '@vscode/debugprotocol';
20
20
 
21
21
  export interface DisassemblyViewRendererReference {
22
22
  onDidChangeStackFrame: IEvent<void>;
@@ -17,7 +17,7 @@
17
17
  import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
18
18
  import { BaseWidget, LabelProvider, Message, OpenerService, Widget } from '@theia/core/lib/browser';
19
19
  import { ArrayUtils } from '@theia/core/lib/common/types';
20
- import { DebugProtocol } from 'vscode-debugprotocol';
20
+ import { DebugProtocol } from '@vscode/debugprotocol';
21
21
  import { InstructionBreakpoint } from '../breakpoint/breakpoint-marker';
22
22
  import { BreakpointManager } from '../breakpoint/breakpoint-manager';
23
23
  import { DebugSessionManager } from '../debug-session-manager';
@@ -15,8 +15,8 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
- import * as ReactDOM from '@theia/core/shared/react-dom';
19
- import { DebugProtocol } from 'vscode-debugprotocol';
18
+ import { createRoot, Root } from '@theia/core/shared/react-dom/client';
19
+ import { DebugProtocol } from '@vscode/debugprotocol';
20
20
  import { injectable, postConstruct, inject } from '@theia/core/shared/inversify';
21
21
  import { Disposable, DisposableCollection, nls } from '@theia/core';
22
22
  import URI from '@theia/core/lib/common/uri';
@@ -55,6 +55,7 @@ export class DebugBreakpointWidget implements Disposable {
55
55
  protected readonly editorProvider: MonacoEditorProvider;
56
56
 
57
57
  protected selectNode: HTMLDivElement;
58
+ protected selectNodeRoot: Root;
58
59
 
59
60
  protected zone: MonacoEditorZoneWidget;
60
61
 
@@ -99,6 +100,8 @@ export class DebugBreakpointWidget implements Disposable {
99
100
  const selectNode = this.selectNode = document.createElement('div');
100
101
  selectNode.classList.add('theia-debug-breakpoint-select');
101
102
  this.zone.containerNode.appendChild(selectNode);
103
+ this.selectNodeRoot = createRoot(this.selectNode);
104
+ this.toDispose.push(Disposable.create(() => this.selectNodeRoot.unmount()));
102
105
 
103
106
  const inputNode = document.createElement('div');
104
107
  inputNode.classList.add('theia-debug-breakpoint-input');
@@ -148,7 +151,6 @@ export class DebugBreakpointWidget implements Disposable {
148
151
  this.zone.layout(heightInLines);
149
152
  this.updatePlaceholder();
150
153
  }));
151
- this.toDispose.push(Disposable.create(() => ReactDOM.unmountComponentAtNode(selectNode)));
152
154
  }
153
155
 
154
156
  dispose(): void {
@@ -213,14 +215,14 @@ export class DebugBreakpointWidget implements Disposable {
213
215
  if (this._input) {
214
216
  this._input.getControl().setValue(this._values[this.context] || '');
215
217
  }
216
- ReactDOM.render(<SelectComponent
218
+ this.selectNodeRoot.render(<SelectComponent
217
219
  defaultValue={this.context} onChange={this.updateInput}
218
220
  options={[
219
221
  { value: 'condition', label: nls.localizeByDefault('Expression') },
220
222
  { value: 'hitCondition', label: nls.localizeByDefault('Hit Count') },
221
223
  { value: 'logMessage', label: nls.localizeByDefault('Log Message') },
222
224
  ]}
223
- />, this.selectNode);
225
+ />);
224
226
  }
225
227
 
226
228
  protected readonly updateInput = (option: SelectOption) => {
@@ -32,7 +32,7 @@ import { DebugEditor } from './debug-editor';
32
32
  import { DebugHoverWidget, createDebugHoverWidgetContainer } from './debug-hover-widget';
33
33
  import { DebugBreakpointWidget } from './debug-breakpoint-widget';
34
34
  import { DebugExceptionWidget } from './debug-exception-widget';
35
- import { DebugProtocol } from 'vscode-debugprotocol';
35
+ import { DebugProtocol } from '@vscode/debugprotocol';
36
36
  import { DebugInlineValueDecorator, INLINE_VALUE_DECORATION_KEY } from './debug-inline-value-decorator';
37
37
 
38
38
  export const DebugEditorModelFactory = Symbol('DebugEditorModelFactory');
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
- import * as ReactDOM from '@theia/core/shared/react-dom';
18
+ import { createRoot, Root } from '@theia/core/shared/react-dom/client';
19
19
  import * as monaco from '@theia/monaco-editor-core';
20
20
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
21
21
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
@@ -54,6 +54,7 @@ export class DebugExceptionWidget implements Disposable {
54
54
  readonly editor: DebugEditor;
55
55
 
56
56
  protected zone: MonacoEditorZoneWidget;
57
+ protected containerNodeRoot: Root;
57
58
 
58
59
  protected readonly toDispose = new DisposableCollection();
59
60
 
@@ -61,7 +62,8 @@ export class DebugExceptionWidget implements Disposable {
61
62
  protected async init(): Promise<void> {
62
63
  this.toDispose.push(this.zone = new DebugExceptionMonacoEditorZoneWidget(this.editor.getControl()));
63
64
  this.zone.containerNode.classList.add('theia-debug-exception-widget');
64
- this.toDispose.push(Disposable.create(() => ReactDOM.unmountComponentAtNode(this.zone.containerNode)));
65
+ this.containerNodeRoot = createRoot(this.zone.containerNode);
66
+ this.toDispose.push(Disposable.create(() => this.containerNodeRoot.unmount()));
65
67
  this.toDispose.push(this.editor.getControl().onDidLayoutChange(() => this.layout()));
66
68
  }
67
69
 
@@ -94,14 +96,14 @@ export class DebugExceptionWidget implements Disposable {
94
96
  const exceptionTitle = info.id ?
95
97
  nls.localizeByDefault('Exception has occurred: {0}', info.id) :
96
98
  nls.localizeByDefault('Exception has occurred.');
97
- ReactDOM.render(<React.Fragment>
98
- <div className='title'>
99
+ this.containerNodeRoot.render(<React.Fragment>
100
+ <div className='title' ref={cb}>
99
101
  {exceptionTitle}
100
102
  <span id="exception-close" className={codicon('close', true)} onClick={() => this.hide()} title={nls.localizeByDefault('Close')}></span>
101
103
  </div>
102
104
  {info.description && <div className='description'>{info.description}</div>}
103
105
  {stackTrace && <div className='stack-trace'>{stackTrace}</div>}
104
- </React.Fragment>, this.zone.containerNode, cb);
106
+ </React.Fragment>);
105
107
  }
106
108
 
107
109
  protected layout(): void {
@@ -250,14 +250,15 @@ export class DebugHoverWidget extends SourceTreeWidget implements monaco.editor.
250
250
  return undefined!;
251
251
  }
252
252
  const position = this.options && this.options.selection.getStartPosition();
253
- const word = position && this.editor.getControl().getModel()!.getWordAtPosition(position);
254
- return position && word ? {
255
- position: new monaco.Position(position.lineNumber, word.startColumn),
256
- preference: [
257
- monaco.editor.ContentWidgetPositionPreference.ABOVE,
258
- monaco.editor.ContentWidgetPositionPreference.BELOW
259
- ]
260
- } : undefined!;
253
+ return position
254
+ ? {
255
+ position: new monaco.Position(position.lineNumber, position.column),
256
+ preference: [
257
+ monaco.editor.ContentWidgetPositionPreference.ABOVE,
258
+ monaco.editor.ContentWidgetPositionPreference.BELOW,
259
+ ],
260
+ }
261
+ : undefined!;
261
262
  }
262
263
 
263
264
  protected override onUpdateRequest(msg: Message): void {
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
- import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
18
+ import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
19
19
  import URI from '@theia/core/lib/common/uri';
20
20
  import { EditorManager } from '@theia/editor/lib/browser';
21
21
  import { LabelProvider, DISABLED_CLASS } from '@theia/core/lib/browser';
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
- import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
18
+ import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
19
19
  import { RecursivePartial } from '@theia/core';
20
20
  import URI from '@theia/core/lib/common/uri';
21
21
  import { Range } from '@theia/editor/lib/browser';
@@ -17,7 +17,7 @@
17
17
  import { LabelProvider } from '@theia/core/lib/browser';
18
18
  import { EditorManager, EditorOpenerOptions, EditorWidget } from '@theia/editor/lib/browser';
19
19
  import URI from '@theia/core/lib/common/uri';
20
- import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
20
+ import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
21
21
  import { DebugSession } from '../debug-session';
22
22
  import { URI as Uri } from '@theia/core/shared/vscode-uri';
23
23
  import { DEBUG_SCHEME, SCHEME_PATTERN } from '../../common/debug-uri-utils';
@@ -23,7 +23,7 @@
23
23
  import * as React from '@theia/core/shared/react';
24
24
  import { WidgetOpenerOptions, DISABLED_CLASS } from '@theia/core/lib/browser';
25
25
  import { EditorWidget, Range, Position } from '@theia/editor/lib/browser';
26
- import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
26
+ import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
27
27
  import { TreeElement } from '@theia/core/lib/browser/source-tree';
28
28
  import { DebugScope } from '../console/debug-console-items';
29
29
  import { DebugSource } from './debug-source';
@@ -16,7 +16,7 @@
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
18
  import { CancellationTokenSource, Emitter, Event } from '@theia/core';
19
- import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol';
19
+ import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
20
20
  import { TreeElement } from '@theia/core/lib/browser/source-tree';
21
21
  import { DebugStackFrame } from './debug-stack-frame';
22
22
  import { DebugSession } from '../debug-session';
@@ -17,7 +17,7 @@
17
17
  import URI from '@theia/core/lib/common/uri';
18
18
  import * as React from '@theia/core/shared/react';
19
19
  import { DebugConfigurationManager } from '../debug-configuration-manager';
20
- import { DebugSessionOptions, InternalDebugSessionOptions } from '../debug-session-options';
20
+ import { DebugSessionOptions } from '../debug-session-options';
21
21
  import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component';
22
22
  import { QuickInputService } from '@theia/core/lib/browser';
23
23
  import { nls } from '@theia/core/lib/common/nls';
@@ -40,6 +40,7 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
40
40
  protected static readonly PICK = '__PICK__';
41
41
  protected static readonly NO_CONFIGURATION = '__NO_CONF__';
42
42
  protected static readonly ADD_CONFIGURATION = '__ADD_CONF__';
43
+ protected static readonly CONFIG_MARKER = '__CONFIG__';
43
44
 
44
45
  private readonly selectRef = React.createRef<SelectComponent>();
45
46
  private manager: DebugConfigurationManager;
@@ -65,7 +66,7 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
65
66
  override render(): React.ReactNode {
66
67
  return <SelectComponent
67
68
  options={this.renderOptions()}
68
- defaultValue={this.currentValue}
69
+ defaultValue={this.state.currentValue}
69
70
  onChange={option => this.setCurrentConfiguration(option)}
70
71
  onFocus={() => this.refreshDebugConfigurations()}
71
72
  onBlur={() => this.refreshDebugConfigurations()}
@@ -75,7 +76,26 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
75
76
 
76
77
  protected get currentValue(): string {
77
78
  const { current } = this.manager;
78
- return current ? InternalDebugSessionOptions.toValue(current) : DebugConfigurationSelect.NO_CONFIGURATION;
79
+ const matchingOption = this.getCurrentOption(current);
80
+ return matchingOption ? matchingOption.value! : current ? JSON.stringify(current) : DebugConfigurationSelect.NO_CONFIGURATION;
81
+ }
82
+
83
+ protected getCurrentOption(current: DebugSessionOptions | undefined): SelectOption | undefined {
84
+ if (!current || !this.selectRef.current) {
85
+ return;
86
+ }
87
+ const matchingOption = this.selectRef.current!.options.find(option =>
88
+ option.userData === DebugConfigurationSelect.CONFIG_MARKER
89
+ && this.matchesOption(JSON.parse(option.value!), current)
90
+ );
91
+ return matchingOption;
92
+ }
93
+
94
+ protected matchesOption(sessionOption: DebugSessionOptions, current: DebugSessionOptions): boolean {
95
+ const matchesNameAndWorkspace = sessionOption.name === current.name && sessionOption.workspaceFolderUri === current.workspaceFolderUri;
96
+ return DebugSessionOptions.isConfiguration(sessionOption) && DebugSessionOptions.isConfiguration(current)
97
+ ? matchesNameAndWorkspace && sessionOption.providerType === current.providerType
98
+ : matchesNameAndWorkspace;
79
99
  }
80
100
 
81
101
  protected readonly setCurrentConfiguration = (option: SelectOption) => {
@@ -88,12 +108,9 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
88
108
  const providerType = this.parsePickValue(value);
89
109
  this.selectDynamicConfigFromQuickPick(providerType);
90
110
  } else {
91
- const { name, type, request, workspaceFolderUri, providerType } = InternalDebugSessionOptions.parseValue(value);
92
- this.manager.current = this.manager.find(
93
- { name, type, request },
94
- workspaceFolderUri,
95
- providerType === 'undefined' ? undefined : providerType
96
- );
111
+ const data = JSON.parse(value) as DebugSessionOptions;
112
+ this.manager.current = data;
113
+ this.refreshDebugConfigurations();
97
114
  }
98
115
  };
99
116
 
@@ -151,13 +168,15 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
151
168
  protected refreshDebugConfigurations = async () => {
152
169
  const configsPerType = await this.manager.provideDynamicDebugConfigurations();
153
170
  const providerTypes = [];
154
- for (const [ type, configurations ] of Object.entries(configsPerType)) {
171
+ for (const [type, configurations] of Object.entries(configsPerType)) {
155
172
  if (configurations.length > 0) {
156
173
  providerTypes.push(type);
157
174
  }
158
175
  }
159
- this.selectRef.current!.value = this.currentValue;
160
- this.setState({ providerTypes, currentValue: this.currentValue });
176
+
177
+ const value = this.currentValue;
178
+ this.selectRef.current!.value = value;
179
+ this.setState({ providerTypes, currentValue: value });
161
180
  };
162
181
 
163
182
  protected renderOptions(): SelectOption[] {
@@ -165,10 +184,11 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
165
184
 
166
185
  // Add non dynamic debug configurations
167
186
  for (const config of this.manager.all) {
168
- const value = InternalDebugSessionOptions.toValue(config);
187
+ const value = JSON.stringify(config);
169
188
  options.push({
170
189
  value,
171
- label: this.toName(config, this.props.isMultiRoot)
190
+ label: this.toName(config, this.props.isMultiRoot),
191
+ userData: DebugConfigurationSelect.CONFIG_MARKER
172
192
  });
173
193
  }
174
194
 
@@ -181,10 +201,11 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
181
201
  });
182
202
  }
183
203
  for (const dynamicOption of recentDynamicOptions) {
184
- const value = InternalDebugSessionOptions.toValue(dynamicOption);
204
+ const value = JSON.stringify(dynamicOption);
185
205
  options.push({
186
206
  value,
187
- label: this.toName(dynamicOption, this.props.isMultiRoot) + ' (' + dynamicOption.providerType + ')'
207
+ label: this.toName(dynamicOption, this.props.isMultiRoot) + ' (' + dynamicOption.providerType + ')',
208
+ userData: DebugConfigurationSelect.CONFIG_MARKER
188
209
  });
189
210
  }
190
211
  }
@@ -225,10 +246,11 @@ export class DebugConfigurationSelect extends React.Component<DebugConfiguration
225
246
  return options;
226
247
  }
227
248
 
228
- protected toName({ configuration, workspaceFolderUri }: DebugSessionOptions, multiRoot: boolean): string {
229
- if (!workspaceFolderUri || !multiRoot) {
230
- return configuration.name;
249
+ protected toName(options: DebugSessionOptions, multiRoot: boolean): string {
250
+ const name = options.configuration?.name ?? options.name;
251
+ if (!options.workspaceFolderUri || !multiRoot) {
252
+ return name;
231
253
  }
232
- return `${configuration.name} (${new URI(workspaceFolderUri).path.base})`;
254
+ return `${name} (${new URI(options.workspaceFolderUri).path.base})`;
233
255
  }
234
256
  }
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { ReactWidget, QuickInputService } from '@theia/core/lib/browser';
18
- import { CommandRegistry, Disposable, MessageService } from '@theia/core/lib/common';
18
+ import { CommandRegistry, Disposable, DisposableCollection, MessageService } from '@theia/core/lib/common';
19
19
  import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
20
20
  import * as React from '@theia/core/shared/react';
21
21
  import { WorkspaceService } from '@theia/workspace/lib/browser';
@@ -55,6 +55,8 @@ export class DebugConfigurationWidget extends ReactWidget {
55
55
  @inject(MessageService)
56
56
  protected readonly messageService: MessageService;
57
57
 
58
+ protected readonly onRender = new DisposableCollection();
59
+
58
60
  @postConstruct()
59
61
  protected init(): void {
60
62
  this.addClass('debug-toolbar');
@@ -80,7 +82,10 @@ export class DebugConfigurationWidget extends ReactWidget {
80
82
  }
81
83
 
82
84
  protected stepRef: DebugAction | undefined;
83
- protected setStepRef = (stepRef: DebugAction | null) => this.stepRef = stepRef || undefined;
85
+ protected setStepRef = (stepRef: DebugAction | null) => {
86
+ this.stepRef = stepRef || undefined;
87
+ this.onRender.dispose();
88
+ };
84
89
 
85
90
  render(): React.ReactNode {
86
91
  return <React.Fragment>
@@ -16,7 +16,7 @@
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
18
  import { inject, postConstruct, injectable } from '@theia/core/shared/inversify';
19
- import { Disposable, MenuPath } from '@theia/core';
19
+ import { Disposable, DisposableCollection, MenuPath } from '@theia/core';
20
20
  import { ReactWidget } from '@theia/core/lib/browser/widgets';
21
21
  import { DebugViewModel } from './debug-view-model';
22
22
  import { DebugState } from '../debug-session';
@@ -31,6 +31,8 @@ export class DebugToolBar extends ReactWidget {
31
31
  @inject(DebugViewModel)
32
32
  protected readonly model: DebugViewModel;
33
33
 
34
+ protected readonly onRender = new DisposableCollection();
35
+
34
36
  @postConstruct()
35
37
  protected init(): void {
36
38
  this.id = 'debug:toolbar:' + this.model.id;
@@ -55,7 +57,10 @@ export class DebugToolBar extends ReactWidget {
55
57
  return true;
56
58
  }
57
59
  protected stepRef: DebugAction | undefined;
58
- protected setStepRef = (stepRef: DebugAction | null) => this.stepRef = stepRef || undefined;
60
+ protected setStepRef = (stepRef: DebugAction | null) => {
61
+ this.stepRef = stepRef || undefined;
62
+ this.onRender.dispose();
63
+ };
59
64
 
60
65
  protected render(): React.ReactNode {
61
66
  const { state } = this.model;
@@ -17,7 +17,7 @@
17
17
  import * as React from '@theia/core/shared/react';
18
18
  import { SingleTextInputDialog } from '@theia/core/lib/browser/dialogs';
19
19
  import { ExpressionItem, DebugSessionProvider } from '../console/debug-console-items';
20
- import { DebugProtocol } from 'vscode-debugprotocol';
20
+ import { DebugProtocol } from '@vscode/debugprotocol';
21
21
 
22
22
  export class DebugWatchExpression extends ExpressionItem {
23
23
 
@@ -25,7 +25,7 @@ import {
25
25
  DebugAdapter,
26
26
  DebugAdapterSession
27
27
  } from './debug-model';
28
- import { DebugProtocol } from 'vscode-debugprotocol';
28
+ import { DebugProtocol } from '@vscode/debugprotocol';
29
29
  import { DebugChannel } from './debug-service';
30
30
 
31
31
  /**
@@ -0,0 +1,32 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 EclipseSource 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 { TaskIdentifier } from '@theia/task/lib/common';
18
+
19
+ export const defaultCompound: DebugCompound = { name: 'Compound', configurations: [] };
20
+
21
+ export interface DebugCompound {
22
+ name: string;
23
+ stopAll?: boolean;
24
+ preLaunchTask?: string | TaskIdentifier;
25
+ configurations: (string | { name: string, folder: string })[];
26
+ }
27
+
28
+ export namespace DebugCompound {
29
+ export function is(arg: unknown): arg is DebugCompound {
30
+ return !!arg && typeof arg === 'object' && 'name' in arg && 'configurations' in arg;
31
+ }
32
+ }