@theia/debug 1.67.0-next.59 → 1.67.0-next.86

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 (70) hide show
  1. package/lib/browser/console/debug-console-items.d.ts +13 -3
  2. package/lib/browser/console/debug-console-items.d.ts.map +1 -1
  3. package/lib/browser/console/debug-console-items.js +81 -20
  4. package/lib/browser/console/debug-console-items.js.map +1 -1
  5. package/lib/browser/console/debug-console-session.d.ts.map +1 -1
  6. package/lib/browser/console/debug-console-session.js +1 -0
  7. package/lib/browser/console/debug-console-session.js.map +1 -1
  8. package/lib/browser/debug-session-contribution.d.ts.map +1 -1
  9. package/lib/browser/debug-session-contribution.js +1 -1
  10. package/lib/browser/debug-session-contribution.js.map +1 -1
  11. package/lib/browser/debug-session-manager.d.ts +7 -0
  12. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  13. package/lib/browser/debug-session-manager.js +3 -0
  14. package/lib/browser/debug-session-manager.js.map +1 -1
  15. package/lib/browser/debug-session.d.ts +7 -2
  16. package/lib/browser/debug-session.d.ts.map +1 -1
  17. package/lib/browser/debug-session.js +10 -1
  18. package/lib/browser/debug-session.js.map +1 -1
  19. package/lib/browser/editor/debug-hover-source.d.ts +1 -0
  20. package/lib/browser/editor/debug-hover-source.d.ts.map +1 -1
  21. package/lib/browser/editor/debug-hover-source.js +9 -0
  22. package/lib/browser/editor/debug-hover-source.js.map +1 -1
  23. package/lib/browser/editor/debug-inline-value-decorator.js +1 -1
  24. package/lib/browser/editor/debug-inline-value-decorator.js.map +1 -1
  25. package/lib/browser/model/debug-stack-frame.d.ts +2 -2
  26. package/lib/browser/model/debug-stack-frame.d.ts.map +1 -1
  27. package/lib/browser/model/debug-stack-frame.js +13 -5
  28. package/lib/browser/model/debug-stack-frame.js.map +1 -1
  29. package/lib/browser/model/debug-thread.d.ts +2 -2
  30. package/lib/browser/model/debug-thread.d.ts.map +1 -1
  31. package/lib/browser/model/debug-thread.js +13 -9
  32. package/lib/browser/model/debug-thread.js.map +1 -1
  33. package/lib/browser/view/debug-variables-source.d.ts.map +1 -1
  34. package/lib/browser/view/debug-variables-source.js +1 -0
  35. package/lib/browser/view/debug-variables-source.js.map +1 -1
  36. package/lib/browser/view/debug-variables-widget.d.ts +15 -0
  37. package/lib/browser/view/debug-variables-widget.d.ts.map +1 -1
  38. package/lib/browser/view/debug-variables-widget.js +56 -1
  39. package/lib/browser/view/debug-variables-widget.js.map +1 -1
  40. package/lib/browser/view/debug-view-model.d.ts +4 -0
  41. package/lib/browser/view/debug-view-model.d.ts.map +1 -1
  42. package/lib/browser/view/debug-view-model.js +11 -1
  43. package/lib/browser/view/debug-view-model.js.map +1 -1
  44. package/lib/browser/view/debug-watch-expression.d.ts.map +1 -1
  45. package/lib/browser/view/debug-watch-expression.js +4 -5
  46. package/lib/browser/view/debug-watch-expression.js.map +1 -1
  47. package/lib/browser/view/debug-watch-source.d.ts.map +1 -1
  48. package/lib/browser/view/debug-watch-source.js +1 -0
  49. package/lib/browser/view/debug-watch-source.js.map +1 -1
  50. package/lib/common/debug-preferences.d.ts +1 -0
  51. package/lib/common/debug-preferences.d.ts.map +1 -1
  52. package/lib/common/debug-preferences.js +11 -1
  53. package/lib/common/debug-preferences.js.map +1 -1
  54. package/package.json +15 -15
  55. package/src/browser/console/debug-console-items.tsx +90 -21
  56. package/src/browser/console/debug-console-session.ts +1 -0
  57. package/src/browser/debug-session-contribution.ts +3 -1
  58. package/src/browser/debug-session-manager.ts +10 -0
  59. package/src/browser/debug-session.tsx +13 -1
  60. package/src/browser/editor/debug-hover-source.tsx +6 -2
  61. package/src/browser/editor/debug-inline-value-decorator.ts +1 -1
  62. package/src/browser/model/debug-stack-frame.tsx +13 -6
  63. package/src/browser/model/debug-thread.tsx +14 -10
  64. package/src/browser/style/index.css +17 -0
  65. package/src/browser/view/debug-variables-source.ts +1 -0
  66. package/src/browser/view/debug-variables-widget.ts +59 -0
  67. package/src/browser/view/debug-view-model.ts +13 -0
  68. package/src/browser/view/debug-watch-expression.tsx +5 -6
  69. package/src/browser/view/debug-watch-source.ts +1 -0
  70. package/src/common/debug-preferences.ts +12 -1
@@ -25,6 +25,9 @@ import { SelectableTreeNode, TreeNode, TreeSelection } from '@theia/core/lib/bro
25
25
  import { DebugVariable } from '../console/debug-console-items';
26
26
  import { BreakpointManager } from '../breakpoint/breakpoint-manager';
27
27
  import { DataBreakpoint, DataBreakpointSource, DataBreakpointSourceType } from '../breakpoint/breakpoint-marker';
28
+ import { DebugSessionManager } from '../debug-session-manager';
29
+ import { DebugSession } from '../debug-session';
30
+ import { DebugStackFrame } from '../model/debug-stack-frame';
28
31
 
29
32
  @injectable()
30
33
  export class DebugVariablesWidget extends SourceTreeWidget {
@@ -64,6 +67,12 @@ export class DebugVariablesWidget extends SourceTreeWidget {
64
67
  @inject(BreakpointManager)
65
68
  protected readonly breakpointManager: BreakpointManager;
66
69
 
70
+ @inject(DebugSessionManager)
71
+ protected readonly sessionManager: DebugSessionManager;
72
+
73
+ protected stackFrame: DebugStackFrame | undefined;
74
+ protected readonly statePerSession = new Map<string, DebugVariablesWidgetSessionState>();
75
+
67
76
  @postConstruct()
68
77
  protected override init(): void {
69
78
  super.init();
@@ -71,6 +80,44 @@ export class DebugVariablesWidget extends SourceTreeWidget {
71
80
  this.title.label = nls.localizeByDefault('Variables');
72
81
  this.toDispose.push(this.variables);
73
82
  this.source = this.variables;
83
+ this.toDispose.push(this.sessionManager.onDidFocusStackFrame(stackFrame => this.handleDidFocusStackFrame(stackFrame)));
84
+ this.toDispose.push(this.sessionManager.onDidDestroyDebugSession(session => this.handleDidDestroyDebugSession(session)));
85
+ }
86
+
87
+ protected handleDidFocusStackFrame(stackFrame: DebugStackFrame | undefined): void {
88
+ if (this.stackFrame !== stackFrame) {
89
+ if (this.stackFrame) {
90
+ const sessionState = this.getOrCreateSessionState(this.stackFrame.session);
91
+ sessionState.setStateForStackFrame(this.stackFrame, this.superStoreState());
92
+ }
93
+ if (stackFrame) {
94
+ const sessionState = this.statePerSession.get(stackFrame.session.id);
95
+ if (sessionState) {
96
+ const state = sessionState.getStateForStackFrame(stackFrame);
97
+ if (state) {
98
+ this.superRestoreState(state);
99
+ }
100
+ }
101
+ }
102
+ this.stackFrame = stackFrame;
103
+ }
104
+ }
105
+
106
+ protected getOrCreateSessionState(session: DebugSession): DebugVariablesWidgetSessionState {
107
+ let sessionState = this.statePerSession.get(session.id);
108
+ if (!sessionState) {
109
+ sessionState = this.newSessionState();
110
+ this.statePerSession.set(session.id, sessionState);
111
+ }
112
+ return sessionState;
113
+ }
114
+
115
+ protected newSessionState(): DebugVariablesWidgetSessionState {
116
+ return new DebugVariablesWidgetSessionState();
117
+ }
118
+
119
+ protected handleDidDestroyDebugSession(session: DebugSession): void {
120
+ this.statePerSession.delete(session.id);
74
121
  }
75
122
 
76
123
  protected override handleContextMenuEvent(node: TreeNode | undefined, event: MouseEvent<HTMLElement>): void {
@@ -156,3 +203,15 @@ export class DebugVariablesWidget extends SourceTreeWidget {
156
203
  );
157
204
  }
158
205
  }
206
+
207
+ export class DebugVariablesWidgetSessionState {
208
+ protected readonly statePerStackFrame = new Map<string, object>();
209
+
210
+ setStateForStackFrame(stackFrame: DebugStackFrame, state: object): void {
211
+ this.statePerStackFrame.set(stackFrame.id, state);
212
+ }
213
+
214
+ getStateForStackFrame(stackFrame: DebugStackFrame): object | undefined {
215
+ return this.statePerStackFrame.get(stackFrame.id);
216
+ }
217
+ }
@@ -29,6 +29,7 @@ import { DebugFunctionBreakpoint } from '../model/debug-function-breakpoint';
29
29
  import { DebugInstructionBreakpoint } from '../model/debug-instruction-breakpoint';
30
30
  import { DebugSessionOptionsBase } from '../debug-session-options';
31
31
  import { DebugDataBreakpoint } from '../model/debug-data-breakpoint';
32
+ import { DebugVariable } from '../console/debug-console-items';
32
33
 
33
34
  @injectable()
34
35
  export class DebugViewModel implements Disposable {
@@ -46,6 +47,12 @@ export class DebugViewModel implements Disposable {
46
47
  this.onDidChangeBreakpointsEmitter.fire(uri);
47
48
  }
48
49
 
50
+ protected readonly onDidResolveLazyVariableEmitter = new Emitter<DebugVariable>();
51
+ readonly onDidResolveLazyVariable: Event<DebugVariable> = this.onDidResolveLazyVariableEmitter.event;
52
+ protected fireDidResolveLazyVariable(variable: DebugVariable): void {
53
+ this.onDidResolveLazyVariableEmitter.fire(variable);
54
+ }
55
+
49
56
  protected readonly _watchExpressions = new Map<number, DebugWatchExpression>();
50
57
 
51
58
  protected readonly onDidChangeWatchExpressionsEmitter = new Emitter<void>();
@@ -57,6 +64,7 @@ export class DebugViewModel implements Disposable {
57
64
  protected readonly toDispose = new DisposableCollection(
58
65
  this.onDidChangeEmitter,
59
66
  this.onDidChangeBreakpointsEmitter,
67
+ this.onDidResolveLazyVariableEmitter,
60
68
  this.onDidChangeWatchExpressionsEmitter,
61
69
  );
62
70
 
@@ -97,6 +105,11 @@ export class DebugViewModel implements Disposable {
97
105
  this.fireDidChangeBreakpoints(uri);
98
106
  }
99
107
  }));
108
+ this.toDispose.push(this.manager.onDidResolveLazyVariable(({ session, variable }) => {
109
+ if (session === this.currentSession) {
110
+ this.fireDidResolveLazyVariable(variable);
111
+ }
112
+ }));
100
113
  this.updateWatchExpressions();
101
114
  this.toDispose.push(this.watch.onDidChange(() => this.updateWatchExpressions()));
102
115
  }
@@ -23,7 +23,7 @@ import { nls } from '@theia/core';
23
23
 
24
24
  export class DebugWatchExpression extends ExpressionItem {
25
25
 
26
- readonly id: number;
26
+ override readonly id: number;
27
27
  protected isError: boolean;
28
28
  protected isNotAvailable: boolean;
29
29
 
@@ -34,12 +34,12 @@ export class DebugWatchExpression extends ExpressionItem {
34
34
  remove: () => void,
35
35
  onDidChange: () => void
36
36
  }) {
37
- super(options.expression, options.session);
38
- this.id = options.id;
37
+ super(options.expression, options.session, options.id);
39
38
  }
40
39
 
41
40
  override async evaluate(): Promise<void> {
42
41
  await super.evaluate('watch');
42
+ this.options.onDidChange();
43
43
  }
44
44
 
45
45
  protected override setResult(body?: DebugProtocol.EvaluateResponse['body'], error?: string): void {
@@ -56,14 +56,13 @@ export class DebugWatchExpression extends ExpressionItem {
56
56
  super.setResult(body, error);
57
57
  this.isError = !!error;
58
58
  }
59
- this.options.onDidChange();
60
59
  }
61
60
 
62
61
  override render(): React.ReactNode {
63
62
  const valueClass = this.valueClass();
64
63
  return <div className='theia-debug-console-variable theia-debug-watch-expression'>
65
64
  <div className={TREE_NODE_SEGMENT_GROW_CLASS}>
66
- <span title={this.type || this._expression} className='name'>{this._expression}: </span>
65
+ <span title={this.type || this._expression} className='name'>{this._expression}:</span>
67
66
  <span title={this._value} ref={this.setValueRef} className={valueClass}>{this._value}</span>
68
67
  </div>
69
68
  <div className={codicon('close', true)} title={nls.localizeByDefault('Remove Expression')} onClick={this.options.remove} />
@@ -77,7 +76,7 @@ export class DebugWatchExpression extends ExpressionItem {
77
76
  if (this.isNotAvailable) {
78
77
  return 'watch-not-available';
79
78
  }
80
- return '';
79
+ return 'value';
81
80
  }
82
81
 
83
82
  async open(): Promise<void> {
@@ -30,6 +30,7 @@ export class DebugWatchSource extends TreeSource {
30
30
  protected init(): void {
31
31
  this.refresh();
32
32
  this.toDispose.push(this.model.onDidChangeWatchExpressions(() => this.refresh()));
33
+ this.toDispose.push(this.model.onDidResolveLazyVariable(() => this.refresh()));
33
34
  }
34
35
 
35
36
  protected readonly refresh = debounce(() => this.fireDidChange(), 100);
@@ -64,7 +64,17 @@ export const debugPreferencesSchema: PreferenceSchema = {
64
64
  description: nls.localizeByDefault('Show Source Code in Disassembly View.'),
65
65
  type: 'boolean',
66
66
  default: true,
67
- }
67
+ },
68
+ 'debug.autoExpandLazyVariables': {
69
+ type: 'string',
70
+ enum: ['on', 'off'],
71
+ default: 'off',
72
+ enumDescriptions: [
73
+ nls.localizeByDefault('Always automatically expand lazy variables.'),
74
+ nls.localizeByDefault('Never automatically expand lazy variables.')
75
+ ],
76
+ description: nls.localizeByDefault('Controls whether variables that are lazily resolved, such as getters, are automatically resolved and expanded by the debugger.')
77
+ },
68
78
  }
69
79
  };
70
80
 
@@ -76,6 +86,7 @@ export class DebugConfiguration {
76
86
  'debug.showInStatusBar': 'never' | 'always' | 'onFirstSessionStart';
77
87
  'debug.confirmOnExit': 'never' | 'always';
78
88
  'debug.disassemblyView.showSourceCode': boolean;
89
+ 'debug.autoExpandLazyVariables': 'on' | 'off';
79
90
  }
80
91
 
81
92
  export const DebugPreferenceContribution = Symbol('DebugPreferenceContribution');