@opensumi/ide-debug 3.7.1-next-1739781685.0 → 3.7.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 (42) hide show
  1. package/lib/browser/debug-progress.service.d.ts.map +1 -1
  2. package/lib/browser/debug-progress.service.js.map +1 -1
  3. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  4. package/lib/browser/debug-session-manager.js +1 -3
  5. package/lib/browser/debug-session-manager.js.map +1 -1
  6. package/lib/browser/debug-session.d.ts.map +1 -1
  7. package/lib/browser/debug-session.js +6 -1
  8. package/lib/browser/debug-session.js.map +1 -1
  9. package/lib/browser/editor/debug-editor-contribution.d.ts.map +1 -1
  10. package/lib/browser/editor/debug-editor-contribution.js +0 -3
  11. package/lib/browser/editor/debug-editor-contribution.js.map +1 -1
  12. package/lib/browser/editor/debug-hover.view.d.ts.map +1 -1
  13. package/lib/browser/editor/debug-hover.view.js +4 -16
  14. package/lib/browser/editor/debug-hover.view.js.map +1 -1
  15. package/lib/browser/editor/debug-model.d.ts.map +1 -1
  16. package/lib/browser/editor/debug-model.js.map +1 -1
  17. package/lib/browser/view/breakpoints/debug-breakpoints.service.d.ts +1 -1
  18. package/lib/browser/view/breakpoints/debug-breakpoints.service.d.ts.map +1 -1
  19. package/lib/browser/view/breakpoints/debug-breakpoints.service.js +15 -15
  20. package/lib/browser/view/breakpoints/debug-breakpoints.service.js.map +1 -1
  21. package/lib/browser/view/configuration/debug-configuration.module.less +0 -2
  22. package/lib/browser/view/console/debug-console-session.d.ts +2 -2
  23. package/lib/browser/view/console/debug-console-session.d.ts.map +1 -1
  24. package/lib/browser/view/console/debug-console-session.js.map +1 -1
  25. package/lib/browser/view/console/debug-console-tree.model.service.d.ts +3 -2
  26. package/lib/browser/view/console/debug-console-tree.model.service.d.ts.map +1 -1
  27. package/lib/browser/view/console/debug-console-tree.model.service.js.map +1 -1
  28. package/lib/common/debug-session.d.ts +7 -35
  29. package/lib/common/debug-session.d.ts.map +1 -1
  30. package/lib/common/debug-session.js.map +1 -1
  31. package/package.json +25 -25
  32. package/src/browser/debug-progress.service.ts +4 -2
  33. package/src/browser/debug-session-manager.ts +1 -3
  34. package/src/browser/debug-session.ts +14 -2
  35. package/src/browser/editor/debug-editor-contribution.ts +0 -6
  36. package/src/browser/editor/debug-hover.view.tsx +3 -15
  37. package/src/browser/editor/debug-model.ts +1 -0
  38. package/src/browser/view/breakpoints/debug-breakpoints.service.ts +2 -2
  39. package/src/browser/view/configuration/debug-configuration.module.less +0 -2
  40. package/src/browser/view/console/debug-console-session.ts +3 -3
  41. package/src/browser/view/console/debug-console-tree.model.service.ts +3 -3
  42. package/src/common/debug-session.ts +12 -64
@@ -9,7 +9,9 @@ import { DisposableCollection, IProgress, IProgressStep, ProgressLocation } from
9
9
  import { DebugProtocol } from '@opensumi/vscode-debugprotocol';
10
10
 
11
11
  import { IDebugProgress } from '../common/debug-progress';
12
- import { DebugState, IDebugSession, IDebugSessionManager } from '../common/debug-session';
12
+ import { DebugState, IDebugSessionManager } from '../common/debug-session';
13
+
14
+ import { DebugSession } from './debug-session';
13
15
 
14
16
  @Injectable()
15
17
  export class DebugProgressService implements IDebugProgress {
@@ -40,7 +42,7 @@ export class DebugProgressService implements IDebugProgress {
40
42
 
41
43
  public run(sessionsManager: IDebugSessionManager): void {
42
44
  let progressListener: DisposableCollection | undefined;
43
- const listenOnProgress = (session: IDebugSession | undefined) => {
45
+ const listenOnProgress = (session: DebugSession | undefined) => {
44
46
  progressListener = new DisposableCollection();
45
47
 
46
48
  if (session) {
@@ -431,9 +431,6 @@ export class DebugSessionManager implements IDebugSessionManager {
431
431
  const session = sessionFactory.get(sessionId, options);
432
432
  this._sessions.set(sessionId, session);
433
433
  this._extraMap.set(sessionId, extra);
434
- if (!options.lifecycleManagedByParent) {
435
- this.updateCurrentSession(session);
436
- }
437
434
 
438
435
  this.debugTypeKey.set(session.configuration.type);
439
436
  this.onDidCreateDebugSessionEmitter.fire(session);
@@ -468,6 +465,7 @@ export class DebugSessionManager implements IDebugSessionManager {
468
465
  this.onDidReceiveDebugSessionCustomEventEmitter.fire({ event, body, session }),
469
466
  );
470
467
 
468
+ this.updateCurrentSession(session);
471
469
  return session;
472
470
  }
473
471
 
@@ -215,7 +215,6 @@ export class DebugSession implements IDebugSession {
215
215
  }
216
216
 
217
217
  this.onStateChange();
218
- this.sessionManager.currentSession = this as IDebugSession;
219
218
  this._onDidStop.fire(event);
220
219
  }),
221
220
  this.on('thread', (event: DebugProtocol.ThreadEvent) => {
@@ -289,7 +288,7 @@ export class DebugSession implements IDebugSession {
289
288
  }
290
289
 
291
290
  getMemory(memoryReference: string): IMemoryRegion {
292
- return new MemoryRegion(memoryReference, this as IDebugSession);
291
+ return new MemoryRegion(memoryReference, this);
293
292
  }
294
293
 
295
294
  get configuration(): DebugConfiguration {
@@ -1092,14 +1091,21 @@ export class DebugSession implements IDebugSession {
1092
1091
  return this.connection.onDidCustomEvent;
1093
1092
  }
1094
1093
 
1094
+ // REPL
1095
+
1095
1096
  hasSeparateRepl(): boolean {
1096
1097
  return !this.parentSession || this.options.repl !== 'mergeWithParent';
1097
1098
  }
1098
1099
 
1100
+ // REPL end
1101
+
1102
+ // report service
1099
1103
  reportTime(name: string, defaults?: any): (msg: string | undefined, extra?: any) => number {
1100
1104
  return this.sessionManager.reportTime(name, defaults);
1101
1105
  }
1102
1106
 
1107
+ // Cancellation
1108
+
1103
1109
  private getNewCancellationToken(threadId: number, token?: CancellationToken): CancellationToken {
1104
1110
  const tokenSource = new CancellationTokenSource(token);
1105
1111
  const tokens = this.cancellationMap.get(threadId) || [];
@@ -1126,6 +1132,8 @@ export class DebugSession implements IDebugSession {
1126
1132
  }
1127
1133
  }
1128
1134
 
1135
+ // Cancellation end
1136
+
1129
1137
  public getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined {
1130
1138
  const data = this.breakpointManager.getBreakpoints().find((bp) => bp.id === breakpointId);
1131
1139
  if (data) {
@@ -1155,6 +1163,8 @@ export class DebugSession implements IDebugSession {
1155
1163
  return this.modelManager.model;
1156
1164
  }
1157
1165
 
1166
+ // memory
1167
+
1158
1168
  public async readMemory(
1159
1169
  memoryReference: string,
1160
1170
  offset: number,
@@ -1177,4 +1187,6 @@ export class DebugSession implements IDebugSession {
1177
1187
  }
1178
1188
  return Promise.resolve(undefined);
1179
1189
  }
1190
+
1191
+ // memory end
1180
1192
  }
@@ -275,12 +275,6 @@ export class DebugEditorContribution implements IEditorFeatureContribution {
275
275
  }),
276
276
  );
277
277
 
278
- this.disposer.addDispose(
279
- this.debugSessionManager.onDidDestroyDebugSession(() => {
280
- this.closeExceptionWidget();
281
- }),
282
- );
283
-
284
278
  this.disposer.addDispose(this.editorDisposer);
285
279
 
286
280
  this.toggleExceptionWidget();
@@ -3,7 +3,6 @@ import React from 'react';
3
3
 
4
4
  import { INodeRendererWrapProps, IRecycleTreeHandle, RecycleTree, TreeNodeEvent } from '@opensumi/ide-components';
5
5
  import { useInjectable } from '@opensumi/ide-core-browser';
6
- import { LayoutViewSizeConfig } from '@opensumi/ide-core-browser/lib/layout/constants';
7
6
  import { IDisposable } from '@opensumi/ide-core-common';
8
7
 
9
8
  import {
@@ -20,11 +19,8 @@ import styles from './debug-hover.module.less';
20
19
 
21
20
  export const DebugHoverView = () => {
22
21
  const debugHoverTreeModelService: DebugHoverTreeModelService = useInjectable(DebugHoverTreeModelService);
23
- const layoutViewSize = useInjectable<LayoutViewSizeConfig>(LayoutViewSizeConfig);
24
22
 
25
23
  const DEFAULT_LAYOUT_HEIGHT = 250;
26
- const DEFAULT_MAX_HEIGHT = 420;
27
- const DEFAULT_HOVER_WEIGET_MARGIN_BOTTOM = 4;
28
24
  const [model, setModel] = React.useState<{ treeModel?: DebugHoverModel; variable?: DebugVariable }>({});
29
25
  const [treeLayoutHeight, setTreeLayoutHeight] = React.useState<number>(DEFAULT_LAYOUT_HEIGHT);
30
26
  const wrapperRef = React.useRef<HTMLDivElement | null>(null);
@@ -48,17 +44,9 @@ export const DebugHoverView = () => {
48
44
  setTreeLayoutHeight(DEFAULT_LAYOUT_HEIGHT);
49
45
 
50
46
  if (model.treeModel) {
51
- disposable = model.treeModel.root.watcher.on(TreeNodeEvent.DidChangeExpansionState, () => {
52
- const treeHeight = Math.max(DEFAULT_LAYOUT_HEIGHT, (model.treeModel?.root.branchSize || 0) * 22);
53
- const rect = wrapperRef.current?.getBoundingClientRect();
54
- if (rect) {
55
- const top = rect.top;
56
- const maxHeight =
57
- window.innerHeight - top - layoutViewSize.statusBarHeight - DEFAULT_HOVER_WEIGET_MARGIN_BOTTOM;
58
- setTreeLayoutHeight(Math.min(maxHeight, treeHeight, DEFAULT_MAX_HEIGHT));
59
- } else {
60
- setTreeLayoutHeight(Math.min(DEFAULT_MAX_HEIGHT, treeHeight));
61
- }
47
+ disposable = model.treeModel.root.watcher.on(TreeNodeEvent.DidChangeExpansionState, (data) => {
48
+ const treeHeight = Math.max(DEFAULT_LAYOUT_HEIGHT, ~~model.treeModel?.root.branchSize! * 22);
49
+ setTreeLayoutHeight(Math.min(500, treeHeight));
62
50
  });
63
51
  }
64
52
  return () => {
@@ -7,6 +7,7 @@ import {
7
7
  IReporterService,
8
8
  PreferenceService,
9
9
  addClassName,
10
+ createClassNameTokens,
10
11
  } from '@opensumi/ide-core-browser';
11
12
  import {
12
13
  AbstractMenuService,
@@ -143,7 +143,7 @@ export class DebugBreakpointsService extends WithEventBus {
143
143
  this.roots = roots.map((file) => new URI(file.uri));
144
144
  }
145
145
 
146
- toggleBreakpointEnable = (data: IDebugBreakpoint | DebugExceptionBreakpoint) => {
146
+ toggleBreakpointEnable(data: IDebugBreakpoint | DebugExceptionBreakpoint) {
147
147
  if (isDebugBreakpoint(data)) {
148
148
  const real = this.breakpoints.getBreakpoint(URI.parse(data.uri), {
149
149
  lineNumber: data.raw.line,
@@ -157,7 +157,7 @@ export class DebugBreakpointsService extends WithEventBus {
157
157
  if (isDebugExceptionBreakpoint(data)) {
158
158
  this.breakpoints.updateExceptionBreakpoints(data.filter, !data.default);
159
159
  }
160
- };
160
+ }
161
161
 
162
162
  extractNodes(item: DebugExceptionBreakpoint | IDebugBreakpoint): BreakpointItem | undefined {
163
163
  if (isDebugBreakpoint(item)) {
@@ -96,8 +96,6 @@
96
96
  justify-content: center;
97
97
  z-index: 10;
98
98
  user-select: none;
99
- top: 0;
100
- left: 0;
101
99
 
102
100
  .debug_action_bar {
103
101
  height: 100%;
@@ -5,7 +5,7 @@ import { DisposableCollection, Emitter, Event, ILogger, MessageType, localize }
5
5
  import { IThemeService } from '@opensumi/ide-theme';
6
6
  import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol';
7
7
 
8
- import { IDebugConsoleSession, IDebugSession } from '../../../common';
8
+ import { IDebugConsoleSession } from '../../../common';
9
9
  import { handleANSIOutput } from '../../debug-ansi-handle';
10
10
  import { LinkDetector } from '../../debug-link-detector';
11
11
  import { DebugSession } from '../../debug-session';
@@ -59,8 +59,8 @@ export class DebugConsoleSession implements IDebugConsoleSession {
59
59
  this.toDispose.push(this.session.on('output', (event) => this.logOutput(this.session, event)));
60
60
  }
61
61
 
62
- addChildSession(child: IDebugSession): void {
63
- this.toDispose.push(child.on('output', (event) => this.logOutput(child as DebugSession, event)));
62
+ addChildSession(child: DebugSession): void {
63
+ this.toDispose.push(child.on('output', (event) => this.logOutput(child, event)));
64
64
  }
65
65
 
66
66
  get onDidChange(): Event<void> {
@@ -21,7 +21,7 @@ import {
21
21
  } from '@opensumi/ide-core-browser';
22
22
  import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';
23
23
 
24
- import { IDebugConsoleModelService, IDebugSession, IDebugSessionManager } from '../../../common';
24
+ import { IDebugConsoleModelService, IDebugSessionManager } from '../../../common';
25
25
  import { LinkDetector } from '../../debug-link-detector';
26
26
  import { DebugSession } from '../../debug-session';
27
27
  import { DidChangeActiveDebugSession } from '../../debug-session-manager';
@@ -248,7 +248,7 @@ export class DebugConsoleModelService implements IDebugConsoleModelService {
248
248
  );
249
249
  }
250
250
 
251
- async initTreeModel(session?: IDebugSession, force?: boolean) {
251
+ async initTreeModel(session?: DebugSession, force?: boolean) {
252
252
  if (!session) {
253
253
  this._activeDebugSessionModel = undefined;
254
254
  this.onDidUpdateTreeModelEmitter.fire(this._activeDebugSessionModel);
@@ -535,7 +535,7 @@ export class DebugConsoleModelService implements IDebugConsoleModelService {
535
535
  const textNode = new AnsiConsoleNode(value, parent, this.linkDetector);
536
536
  this.dispatchWatchEvent(parent, parent.path, { type: WatchEvent.Added, node: textNode, id: parent.id });
537
537
  const expressionNode = new DebugConsoleNode(
538
- { session: this.manager.currentSession as DebugSession },
538
+ { session: this.manager.currentSession },
539
539
  value,
540
540
  parent as ExpressionContainer,
541
541
  );
@@ -32,7 +32,6 @@ export const IDebugSession = Symbol('DebugSession');
32
32
 
33
33
  export const IDebugSessionManager = Symbol('DebugSessionManager');
34
34
  export interface IDebugSessionManager {
35
- currentSession: IDebugSession | undefined;
36
35
  fireWillStartDebugSession(): Promise<void>;
37
36
  resolveConfiguration(options: Readonly<DebugSessionOptions>): Promise<IDebugSessionDTO | undefined>;
38
37
  resolveDebugConfiguration(
@@ -50,85 +49,34 @@ export interface IDebugSessionManager {
50
49
  }
51
50
 
52
51
  export interface IDebugSession extends IDisposable {
53
- // 状态管理
54
- /** 当前调试会话的状态 */
55
52
  state: DebugState;
56
-
57
- /** 父调试会话(如果有) */
58
53
  parentSession: IDebugSession | undefined;
59
-
60
- /** 唯一标识符 */
61
54
  id: string;
62
-
63
- /** 调试适配器的能力 */
64
55
  capabilities: DebugProtocol.Capabilities;
65
-
66
- /** 是否压缩输出 */
67
- compact: boolean;
68
-
69
- // 事件处理
70
- /** 内存无效化事件 */
71
56
  onDidInvalidateMemory: Event<DebugProtocol.MemoryEvent>;
72
-
73
- /** 状态变化事件 */
74
- onDidChangeState: Event<DebugState>;
75
-
76
- /** 进度开始事件 */
77
- onDidProgressStart: Event<DebugProtocol.ProgressStartEvent>;
78
-
79
- /** 进度更新事件 */
80
- onDidProgressUpdate: Event<DebugProtocol.ProgressUpdateEvent>;
81
-
82
- /** 进度结束事件 */
83
- onDidProgressEnd: Event<DebugProtocol.ProgressEndEvent>;
84
-
85
- /** 调试适配器退出事件 */
86
- onDidExitAdapter: Event<void>;
87
-
88
- // 操作方法
89
- /** 取消当前操作 */
90
- cancel(reason?: string): Promise<DebugProtocol.CancelResponse | undefined>;
91
-
92
- /** 发送请求到调试适配器 */
93
- sendRequest<K extends keyof DebugRequestTypes>(
94
- command: K,
95
- args: DebugRequestTypes[K][0],
96
- token?: CancellationToken | undefined,
97
- ): Promise<DebugRequestTypes[K][1]>;
98
-
99
- /** 获取调试协议中的断点 */
100
- getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined;
101
-
102
- /** 判断是否具有独立的 REPL */
103
- hasSeparateRepl(): boolean;
104
-
105
- /** 监听特定类型的事件 */
106
- on<K extends keyof DebugEventTypes>(kind: K, listener: (e: DebugEventTypes[K]) => any): IDisposable;
107
-
108
- /** 断开连接 */
109
- disconnect(restart?: boolean | undefined): Promise<void>;
110
-
111
- /** 终止调试会话 */
112
- terminate(restart?: boolean | undefined): Promise<void>;
113
-
114
- /** 重启调试会话 */
115
- restart(args: DebugProtocol.RestartArguments): Promise<boolean>;
116
-
117
- // 内存操作
118
- /** 读取内存 */
119
57
  readMemory(
120
58
  memoryReference: string,
121
59
  offset: number,
122
60
  count: number,
123
61
  ): Promise<DebugProtocol.ReadMemoryResponse | undefined>;
124
-
125
- /** 写入内存 */
126
62
  writeMemory(
127
63
  memoryReference: string,
128
64
  offset: number,
129
65
  data: string,
130
66
  allowPartial?: boolean | undefined,
131
67
  ): Promise<DebugProtocol.WriteMemoryResponse | undefined>;
68
+ hasSeparateRepl: () => boolean;
69
+ getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined;
70
+ compact: boolean;
71
+ on: <K extends keyof DebugEventTypes>(kind: K, listener: (e: DebugEventTypes[K]) => any) => IDisposable;
72
+ sendRequest<K extends keyof DebugRequestTypes>(
73
+ command: K,
74
+ args: DebugRequestTypes[K][0],
75
+ token?: CancellationToken | undefined,
76
+ ): Promise<DebugRequestTypes[K][1]>;
77
+ restart(args: DebugProtocol.RestartArguments): Promise<boolean>;
78
+ disconnect(restart?: boolean | undefined): Promise<void>;
79
+ terminate(restart?: boolean | undefined): Promise<void>;
132
80
  }
133
81
 
134
82
  /**