@theia/debug 1.33.0-next.9 → 1.33.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.
@@ -169,7 +169,7 @@
169
169
  }
170
170
 
171
171
  .theia-debug-console-variable {
172
- width: 100%;
172
+ display: flex;
173
173
  white-space: nowrap;
174
174
  overflow: hidden;
175
175
  text-overflow: ellipsis;
@@ -195,6 +195,20 @@
195
195
  color: var(--theia-variable-name-color);
196
196
  }
197
197
 
198
+ .theia-TreeNode:not(:hover) .theia-debug-console-variable .action-label {
199
+ visibility: hidden;
200
+ }
201
+
202
+ .theia-debug-console-variable .action-label {
203
+ /* Vertically center the button in the tree node */
204
+ margin: auto;
205
+ }
206
+
207
+ .theia-debug-console-variable .watch-error {
208
+ font-style: italic;
209
+ color: var(--theia-debugConsole-errorForeground);
210
+ }
211
+
198
212
  /** Editor **/
199
213
 
200
214
  .theia-debug-breakpoint-icon {
@@ -165,11 +165,12 @@ export class DebugViewModel implements Disposable {
165
165
  }
166
166
 
167
167
  async addWatchExpression(expression: string = ''): Promise<DebugWatchExpression | undefined> {
168
- const watchExpression = new DebugWatchExpression({
168
+ const watchExpression: DebugWatchExpression = new DebugWatchExpression({
169
169
  id: Number.MAX_SAFE_INTEGER,
170
170
  expression,
171
171
  session: () => this.currentSession,
172
- onDidChange: () => { /* no-op */ }
172
+ remove: () => this.removeWatchExpression(watchExpression),
173
+ onDidChange: () => { /* no-op */ },
173
174
  });
174
175
  await watchExpression.open();
175
176
  if (!watchExpression.expression) {
@@ -194,10 +195,11 @@ export class DebugViewModel implements Disposable {
194
195
  toRemove.delete(id);
195
196
  if (!this._watchExpressions.has(id)) {
196
197
  added = true;
197
- const watchExpression = new DebugWatchExpression({
198
+ const watchExpression: DebugWatchExpression = new DebugWatchExpression({
198
199
  id,
199
200
  expression,
200
201
  session: () => this.currentSession,
202
+ remove: () => this.removeWatchExpression(watchExpression),
201
203
  onDidChange: () => this.fireDidChangeWatchExpressions()
202
204
  });
203
205
  this._watchExpressions.set(id, watchExpression);
@@ -18,15 +18,19 @@ 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
20
  import { DebugProtocol } from '@vscode/debugprotocol';
21
+ import { codicon, TREE_NODE_SEGMENT_GROW_CLASS } from '@theia/core/lib/browser';
22
+ import { nls } from '@theia/core';
21
23
 
22
24
  export class DebugWatchExpression extends ExpressionItem {
23
25
 
24
26
  readonly id: number;
27
+ protected isError: boolean;
25
28
 
26
29
  constructor(protected readonly options: {
27
30
  id: number,
28
31
  expression: string,
29
32
  session: DebugSessionProvider,
33
+ remove: () => void,
30
34
  onDidChange: () => void
31
35
  }) {
32
36
  super(options.expression, options.session);
@@ -37,17 +41,23 @@ export class DebugWatchExpression extends ExpressionItem {
37
41
  await super.evaluate('watch');
38
42
  }
39
43
 
40
- protected override setResult(body?: DebugProtocol.EvaluateResponse['body']): void {
41
- // overridden to ignore error
42
- super.setResult(body);
44
+ protected override setResult(body?: DebugProtocol.EvaluateResponse['body'], error?: string): void {
45
+ if (!this.options.session()) {
46
+ return;
47
+ }
48
+ super.setResult(body, error);
49
+ this.isError = !!error;
43
50
  this.options.onDidChange();
44
51
  }
45
52
 
46
53
  override render(): React.ReactNode {
47
54
  return <div className='theia-debug-console-variable'>
48
- <span title={this.type || this._expression} className='name'>{this._expression}: </span>
49
- <span title={this._value} ref={this.setValueRef}>{this._value}</span>
50
- </div >;
55
+ <div className={TREE_NODE_SEGMENT_GROW_CLASS}>
56
+ <span title={this.type || this._expression} className='name'>{this._expression}: </span>
57
+ <span title={this._value} ref={this.setValueRef} className={this.isError ? 'watch-error' : ''}>{this._value}</span>
58
+ </div>
59
+ <div className={codicon('close', true)} title={nls.localizeByDefault('Remove Expression')} onClick={this.options.remove} />
60
+ </div>;
51
61
  }
52
62
 
53
63
  async open(): Promise<void> {