@opensumi/ide-debug 3.7.1 → 3.7.2-next-1739859371.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.
- package/lib/browser/debug-progress.service.d.ts.map +1 -1
- package/lib/browser/debug-progress.service.js.map +1 -1
- package/lib/browser/debug-session-manager.d.ts.map +1 -1
- package/lib/browser/debug-session-manager.js +3 -1
- package/lib/browser/debug-session-manager.js.map +1 -1
- package/lib/browser/debug-session.d.ts.map +1 -1
- package/lib/browser/debug-session.js +1 -6
- package/lib/browser/debug-session.js.map +1 -1
- package/lib/browser/editor/debug-editor-contribution.d.ts.map +1 -1
- package/lib/browser/editor/debug-editor-contribution.js +3 -0
- package/lib/browser/editor/debug-editor-contribution.js.map +1 -1
- package/lib/browser/editor/debug-hover.view.d.ts.map +1 -1
- package/lib/browser/editor/debug-hover.view.js +16 -4
- package/lib/browser/editor/debug-hover.view.js.map +1 -1
- package/lib/browser/editor/debug-model.d.ts.map +1 -1
- package/lib/browser/editor/debug-model.js.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.service.d.ts +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.service.d.ts.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.service.js +15 -15
- package/lib/browser/view/breakpoints/debug-breakpoints.service.js.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.module.less +2 -0
- package/lib/browser/view/console/debug-console-session.d.ts +2 -2
- package/lib/browser/view/console/debug-console-session.d.ts.map +1 -1
- package/lib/browser/view/console/debug-console-session.js.map +1 -1
- package/lib/browser/view/console/debug-console-tree.model.service.d.ts +2 -3
- package/lib/browser/view/console/debug-console-tree.model.service.d.ts.map +1 -1
- package/lib/browser/view/console/debug-console-tree.model.service.js.map +1 -1
- package/lib/common/debug-session.d.ts +35 -7
- package/lib/common/debug-session.d.ts.map +1 -1
- package/lib/common/debug-session.js.map +1 -1
- package/package.json +25 -25
- package/src/browser/debug-progress.service.ts +2 -4
- package/src/browser/debug-session-manager.ts +3 -1
- package/src/browser/debug-session.ts +2 -14
- package/src/browser/editor/debug-editor-contribution.ts +6 -0
- package/src/browser/editor/debug-hover.view.tsx +15 -3
- package/src/browser/editor/debug-model.ts +0 -1
- package/src/browser/view/breakpoints/debug-breakpoints.service.ts +2 -2
- package/src/browser/view/configuration/debug-configuration.module.less +2 -0
- package/src/browser/view/console/debug-console-session.ts +3 -3
- package/src/browser/view/console/debug-console-tree.model.service.ts +3 -3
- package/src/common/debug-session.ts +64 -12
|
@@ -9,9 +9,7 @@ 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, IDebugSessionManager } from '../common/debug-session';
|
|
13
|
-
|
|
14
|
-
import { DebugSession } from './debug-session';
|
|
12
|
+
import { DebugState, IDebugSession, IDebugSessionManager } from '../common/debug-session';
|
|
15
13
|
|
|
16
14
|
@Injectable()
|
|
17
15
|
export class DebugProgressService implements IDebugProgress {
|
|
@@ -42,7 +40,7 @@ export class DebugProgressService implements IDebugProgress {
|
|
|
42
40
|
|
|
43
41
|
public run(sessionsManager: IDebugSessionManager): void {
|
|
44
42
|
let progressListener: DisposableCollection | undefined;
|
|
45
|
-
const listenOnProgress = (session:
|
|
43
|
+
const listenOnProgress = (session: IDebugSession | undefined) => {
|
|
46
44
|
progressListener = new DisposableCollection();
|
|
47
45
|
|
|
48
46
|
if (session) {
|
|
@@ -431,6 +431,9 @@ 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
|
+
}
|
|
434
437
|
|
|
435
438
|
this.debugTypeKey.set(session.configuration.type);
|
|
436
439
|
this.onDidCreateDebugSessionEmitter.fire(session);
|
|
@@ -465,7 +468,6 @@ export class DebugSessionManager implements IDebugSessionManager {
|
|
|
465
468
|
this.onDidReceiveDebugSessionCustomEventEmitter.fire({ event, body, session }),
|
|
466
469
|
);
|
|
467
470
|
|
|
468
|
-
this.updateCurrentSession(session);
|
|
469
471
|
return session;
|
|
470
472
|
}
|
|
471
473
|
|
|
@@ -215,6 +215,7 @@ export class DebugSession implements IDebugSession {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
this.onStateChange();
|
|
218
|
+
this.sessionManager.currentSession = this as IDebugSession;
|
|
218
219
|
this._onDidStop.fire(event);
|
|
219
220
|
}),
|
|
220
221
|
this.on('thread', (event: DebugProtocol.ThreadEvent) => {
|
|
@@ -288,7 +289,7 @@ export class DebugSession implements IDebugSession {
|
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
getMemory(memoryReference: string): IMemoryRegion {
|
|
291
|
-
return new MemoryRegion(memoryReference, this);
|
|
292
|
+
return new MemoryRegion(memoryReference, this as IDebugSession);
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
get configuration(): DebugConfiguration {
|
|
@@ -1091,21 +1092,14 @@ export class DebugSession implements IDebugSession {
|
|
|
1091
1092
|
return this.connection.onDidCustomEvent;
|
|
1092
1093
|
}
|
|
1093
1094
|
|
|
1094
|
-
// REPL
|
|
1095
|
-
|
|
1096
1095
|
hasSeparateRepl(): boolean {
|
|
1097
1096
|
return !this.parentSession || this.options.repl !== 'mergeWithParent';
|
|
1098
1097
|
}
|
|
1099
1098
|
|
|
1100
|
-
// REPL end
|
|
1101
|
-
|
|
1102
|
-
// report service
|
|
1103
1099
|
reportTime(name: string, defaults?: any): (msg: string | undefined, extra?: any) => number {
|
|
1104
1100
|
return this.sessionManager.reportTime(name, defaults);
|
|
1105
1101
|
}
|
|
1106
1102
|
|
|
1107
|
-
// Cancellation
|
|
1108
|
-
|
|
1109
1103
|
private getNewCancellationToken(threadId: number, token?: CancellationToken): CancellationToken {
|
|
1110
1104
|
const tokenSource = new CancellationTokenSource(token);
|
|
1111
1105
|
const tokens = this.cancellationMap.get(threadId) || [];
|
|
@@ -1132,8 +1126,6 @@ export class DebugSession implements IDebugSession {
|
|
|
1132
1126
|
}
|
|
1133
1127
|
}
|
|
1134
1128
|
|
|
1135
|
-
// Cancellation end
|
|
1136
|
-
|
|
1137
1129
|
public getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined {
|
|
1138
1130
|
const data = this.breakpointManager.getBreakpoints().find((bp) => bp.id === breakpointId);
|
|
1139
1131
|
if (data) {
|
|
@@ -1163,8 +1155,6 @@ export class DebugSession implements IDebugSession {
|
|
|
1163
1155
|
return this.modelManager.model;
|
|
1164
1156
|
}
|
|
1165
1157
|
|
|
1166
|
-
// memory
|
|
1167
|
-
|
|
1168
1158
|
public async readMemory(
|
|
1169
1159
|
memoryReference: string,
|
|
1170
1160
|
offset: number,
|
|
@@ -1187,6 +1177,4 @@ export class DebugSession implements IDebugSession {
|
|
|
1187
1177
|
}
|
|
1188
1178
|
return Promise.resolve(undefined);
|
|
1189
1179
|
}
|
|
1190
|
-
|
|
1191
|
-
// memory end
|
|
1192
1180
|
}
|
|
@@ -275,6 +275,12 @@ 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
|
+
|
|
278
284
|
this.disposer.addDispose(this.editorDisposer);
|
|
279
285
|
|
|
280
286
|
this.toggleExceptionWidget();
|
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
import { IDisposable } from '@opensumi/ide-core-common';
|
|
7
8
|
|
|
8
9
|
import {
|
|
@@ -19,8 +20,11 @@ import styles from './debug-hover.module.less';
|
|
|
19
20
|
|
|
20
21
|
export const DebugHoverView = () => {
|
|
21
22
|
const debugHoverTreeModelService: DebugHoverTreeModelService = useInjectable(DebugHoverTreeModelService);
|
|
23
|
+
const layoutViewSize = useInjectable<LayoutViewSizeConfig>(LayoutViewSizeConfig);
|
|
22
24
|
|
|
23
25
|
const DEFAULT_LAYOUT_HEIGHT = 250;
|
|
26
|
+
const DEFAULT_MAX_HEIGHT = 420;
|
|
27
|
+
const DEFAULT_HOVER_WEIGET_MARGIN_BOTTOM = 4;
|
|
24
28
|
const [model, setModel] = React.useState<{ treeModel?: DebugHoverModel; variable?: DebugVariable }>({});
|
|
25
29
|
const [treeLayoutHeight, setTreeLayoutHeight] = React.useState<number>(DEFAULT_LAYOUT_HEIGHT);
|
|
26
30
|
const wrapperRef = React.useRef<HTMLDivElement | null>(null);
|
|
@@ -44,9 +48,17 @@ export const DebugHoverView = () => {
|
|
|
44
48
|
setTreeLayoutHeight(DEFAULT_LAYOUT_HEIGHT);
|
|
45
49
|
|
|
46
50
|
if (model.treeModel) {
|
|
47
|
-
disposable = model.treeModel.root.watcher.on(TreeNodeEvent.DidChangeExpansionState, (
|
|
48
|
-
const treeHeight = Math.max(DEFAULT_LAYOUT_HEIGHT,
|
|
49
|
-
|
|
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
|
+
}
|
|
50
62
|
});
|
|
51
63
|
}
|
|
52
64
|
return () => {
|
|
@@ -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)) {
|
|
@@ -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 } from '../../../common';
|
|
8
|
+
import { IDebugConsoleSession, IDebugSession } 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:
|
|
63
|
-
this.toDispose.push(child.on('output', (event) => this.logOutput(child, event)));
|
|
62
|
+
addChildSession(child: IDebugSession): void {
|
|
63
|
+
this.toDispose.push(child.on('output', (event) => this.logOutput(child as DebugSession, 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, IDebugSessionManager } from '../../../common';
|
|
24
|
+
import { IDebugConsoleModelService, IDebugSession, 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?:
|
|
251
|
+
async initTreeModel(session?: IDebugSession, 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 },
|
|
538
|
+
{ session: this.manager.currentSession as DebugSession },
|
|
539
539
|
value,
|
|
540
540
|
parent as ExpressionContainer,
|
|
541
541
|
);
|
|
@@ -32,6 +32,7 @@ export const IDebugSession = Symbol('DebugSession');
|
|
|
32
32
|
|
|
33
33
|
export const IDebugSessionManager = Symbol('DebugSessionManager');
|
|
34
34
|
export interface IDebugSessionManager {
|
|
35
|
+
currentSession: IDebugSession | undefined;
|
|
35
36
|
fireWillStartDebugSession(): Promise<void>;
|
|
36
37
|
resolveConfiguration(options: Readonly<DebugSessionOptions>): Promise<IDebugSessionDTO | undefined>;
|
|
37
38
|
resolveDebugConfiguration(
|
|
@@ -49,34 +50,85 @@ export interface IDebugSessionManager {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export interface IDebugSession extends IDisposable {
|
|
53
|
+
// 状态管理
|
|
54
|
+
/** 当前调试会话的状态 */
|
|
52
55
|
state: DebugState;
|
|
56
|
+
|
|
57
|
+
/** 父调试会话(如果有) */
|
|
53
58
|
parentSession: IDebugSession | undefined;
|
|
59
|
+
|
|
60
|
+
/** 唯一标识符 */
|
|
54
61
|
id: string;
|
|
62
|
+
|
|
63
|
+
/** 调试适配器的能力 */
|
|
55
64
|
capabilities: DebugProtocol.Capabilities;
|
|
65
|
+
|
|
66
|
+
/** 是否压缩输出 */
|
|
67
|
+
compact: boolean;
|
|
68
|
+
|
|
69
|
+
// 事件处理
|
|
70
|
+
/** 内存无效化事件 */
|
|
56
71
|
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
|
+
/** 读取内存 */
|
|
57
119
|
readMemory(
|
|
58
120
|
memoryReference: string,
|
|
59
121
|
offset: number,
|
|
60
122
|
count: number,
|
|
61
123
|
): Promise<DebugProtocol.ReadMemoryResponse | undefined>;
|
|
124
|
+
|
|
125
|
+
/** 写入内存 */
|
|
62
126
|
writeMemory(
|
|
63
127
|
memoryReference: string,
|
|
64
128
|
offset: number,
|
|
65
129
|
data: string,
|
|
66
130
|
allowPartial?: boolean | undefined,
|
|
67
131
|
): 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>;
|
|
80
132
|
}
|
|
81
133
|
|
|
82
134
|
/**
|