@opensumi/ide-debug 2.23.4 → 2.23.5-next-1682047670.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/breakpoint/breakpoint-marker.d.ts +2 -0
- package/lib/browser/breakpoint/breakpoint-marker.d.ts.map +1 -1
- package/lib/browser/breakpoint/breakpoint-marker.js +4 -1
- package/lib/browser/breakpoint/breakpoint-marker.js.map +1 -1
- package/lib/browser/debug-contribution.js +2 -2
- package/lib/browser/debug-contribution.js.map +1 -1
- package/lib/browser/model/debug-stack-frame.d.ts +12 -0
- package/lib/browser/model/debug-stack-frame.d.ts.map +1 -1
- package/lib/browser/model/debug-stack-frame.js +27 -1
- package/lib/browser/model/debug-stack-frame.js.map +1 -1
- package/lib/browser/model/debug-thread.d.ts.map +1 -1
- package/lib/browser/model/debug-thread.js +6 -4
- package/lib/browser/model/debug-thread.js.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints-tree.model.d.ts +14 -0
- package/lib/browser/view/breakpoints/debug-breakpoints-tree.model.d.ts.map +1 -0
- package/lib/browser/view/breakpoints/debug-breakpoints-tree.model.js +28 -0
- package/lib/browser/view/breakpoints/debug-breakpoints-tree.model.js.map +1 -0
- package/lib/browser/view/breakpoints/debug-breakpoints.module.less +6 -5
- package/lib/browser/view/breakpoints/debug-breakpoints.service.d.ts +8 -3
- package/lib/browser/view/breakpoints/debug-breakpoints.service.d.ts.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.service.js +79 -33
- package/lib/browser/view/breakpoints/debug-breakpoints.service.js.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.view.d.ts +2 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.view.d.ts.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.view.js +69 -12
- package/lib/browser/view/breakpoints/debug-breakpoints.view.js.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.module.less +10 -4
- package/lib/browser/view/configuration/debug-configuration.view.d.ts +9 -1
- package/lib/browser/view/configuration/debug-configuration.view.d.ts.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.view.js +16 -8
- package/lib/browser/view/configuration/debug-configuration.view.js.map +1 -1
- package/lib/browser/view/configuration/debug-toolbar.view.d.ts +5 -0
- package/lib/browser/view/configuration/debug-toolbar.view.d.ts.map +1 -1
- package/lib/browser/view/configuration/debug-toolbar.view.js +5 -1
- package/lib/browser/view/configuration/debug-toolbar.view.js.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-frame.view.d.ts +1 -0
- package/lib/browser/view/frames/debug-call-stack-frame.view.d.ts.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-frame.view.js +136 -26
- package/lib/browser/view/frames/debug-call-stack-frame.view.js.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-session.view.d.ts.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-session.view.js +17 -10
- package/lib/browser/view/frames/debug-call-stack-session.view.js.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-thread.view.d.ts +1 -0
- package/lib/browser/view/frames/debug-call-stack-thread.view.d.ts.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-thread.view.js +10 -7
- package/lib/browser/view/frames/debug-call-stack-thread.view.js.map +1 -1
- package/lib/browser/view/frames/debug-call-stack.module.less +1 -2
- package/package.json +23 -23
- package/src/browser/breakpoint/breakpoint-marker.ts +3 -1
- package/src/browser/debug-contribution.ts +3 -3
- package/src/browser/model/debug-stack-frame.ts +28 -2
- package/src/browser/model/debug-thread.ts +6 -4
- package/src/browser/view/breakpoints/debug-breakpoints-tree.model.ts +35 -0
- package/src/browser/view/breakpoints/debug-breakpoints.module.less +6 -5
- package/src/browser/view/breakpoints/debug-breakpoints.service.ts +80 -31
- package/src/browser/view/breakpoints/debug-breakpoints.view.tsx +120 -23
- package/src/browser/view/configuration/debug-configuration.module.less +10 -4
- package/src/browser/view/configuration/debug-configuration.view.tsx +36 -20
- package/src/browser/view/configuration/debug-toolbar.view.tsx +10 -5
- package/src/browser/view/frames/debug-call-stack-frame.view.tsx +184 -51
- package/src/browser/view/frames/debug-call-stack-session.view.tsx +29 -15
- package/src/browser/view/frames/debug-call-stack-thread.view.tsx +14 -8
- package/src/browser/view/frames/debug-call-stack.module.less +1 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cls from 'classnames';
|
|
2
2
|
import { observer } from 'mobx-react-lite';
|
|
3
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { RecycleList } from '@opensumi/ide-components';
|
|
6
6
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { IDebugSessionManager } from '../../../common';
|
|
16
16
|
import { DebugSession } from '../../debug-session';
|
|
17
17
|
import { DebugSessionManager } from '../../debug-session-manager';
|
|
18
|
-
import { DebugStackFrame } from '../../model';
|
|
18
|
+
import { DebugStackFrame, ShowMoreDebugStackFrame } from '../../model';
|
|
19
19
|
import { DebugThread } from '../../model/debug-thread';
|
|
20
20
|
|
|
21
21
|
import styles from './debug-call-stack.module.less';
|
|
@@ -27,16 +27,18 @@ export interface DebugStackSessionViewProps {
|
|
|
27
27
|
thread: DebugThread;
|
|
28
28
|
viewState: ViewState;
|
|
29
29
|
indent?: number;
|
|
30
|
+
isBottom?: boolean;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export const DebugStackFramesView = observer((props: DebugStackSessionViewProps) => {
|
|
33
|
-
const { viewState, frames: rawFrames, thread, indent = 0, session } = props;
|
|
34
|
+
const { viewState, frames: rawFrames, thread, indent = 0, session, isBottom } = props;
|
|
34
35
|
const [selected, setSelected] = useState<number | undefined>();
|
|
35
36
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
36
|
-
const [frames, setFrames] = useState<DebugStackFrame[]>([]);
|
|
37
|
+
const [frames, setFrames] = useState<(DebugStackFrame | ShowMoreDebugStackFrame)[]>([]);
|
|
37
38
|
const [framesErrorMessage, setFramesErrorMessage] = useState<string>('');
|
|
38
39
|
const [canLoadMore, setCanLoadMore] = useState<boolean>(false);
|
|
39
40
|
const manager = useInjectable<DebugSessionManager>(IDebugSessionManager);
|
|
41
|
+
const currentFrames = useRef<(DebugStackFrame | ShowMoreDebugStackFrame)[]>([]);
|
|
40
42
|
const debugCallStackService = useInjectable<DebugCallStackService>(DebugCallStackService);
|
|
41
43
|
|
|
42
44
|
const loadMore = useCallback(async () => {
|
|
@@ -57,11 +59,99 @@ export const DebugStackFramesView = observer((props: DebugStackSessionViewProps)
|
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
|
|
62
|
+
const expandFrame = useCallback(
|
|
63
|
+
(frame: ShowMoreDebugStackFrame) => {
|
|
64
|
+
const expanedFrames = currentFrames.current.slice(0);
|
|
65
|
+
let index = -1;
|
|
66
|
+
if (!frame.nextFrame) {
|
|
67
|
+
index = expanedFrames.length;
|
|
68
|
+
} else {
|
|
69
|
+
index = expanedFrames.findIndex((f) => DebugStackFrame.is(f) && f.id === frame.nextFrame?.id);
|
|
70
|
+
}
|
|
71
|
+
if (index > -1) {
|
|
72
|
+
expanedFrames.splice(index - 1, 1, ...frame.frames);
|
|
73
|
+
currentFrames.current = expanedFrames;
|
|
74
|
+
setFrames(expanedFrames);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
[currentFrames.current],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const mergeFrames = useCallback(
|
|
81
|
+
(current: (DebugStackFrame | ShowMoreDebugStackFrame)[], frames: DebugStackFrame[]) => {
|
|
82
|
+
const len = frames.length;
|
|
83
|
+
let offset = -1;
|
|
84
|
+
let lastFrame = current.length > 0 ? current[current.length + offset] : undefined;
|
|
85
|
+
while (lastFrame && !DebugStackFrame.is(lastFrame)) {
|
|
86
|
+
offset -= 1;
|
|
87
|
+
lastFrame = current[current.length + offset];
|
|
88
|
+
}
|
|
89
|
+
// 合并位置调整,方便将进一步加载的含 `frames[i].source?.raw.origin` 进行合并
|
|
90
|
+
const results: (DebugStackFrame | ShowMoreDebugStackFrame)[] = current.slice(0, current.length + offset + 1);
|
|
91
|
+
|
|
92
|
+
const startIndex = lastFrame ? frames.findIndex((frame) => frame.id === lastFrame?.id) + 1 : 0;
|
|
93
|
+
let showMoreFrames: DebugStackFrame[] = [];
|
|
94
|
+
let showMoreOrigin;
|
|
95
|
+
let hasOrigin = false;
|
|
96
|
+
for (let i = startIndex; i < len; i++) {
|
|
97
|
+
if (frames[i].source?.raw.origin) {
|
|
98
|
+
if (hasOrigin) {
|
|
99
|
+
if (showMoreOrigin === frames[i].source?.raw.origin) {
|
|
100
|
+
showMoreFrames.push(frames[i]);
|
|
101
|
+
continue;
|
|
102
|
+
} else {
|
|
103
|
+
if (showMoreFrames.length > 1) {
|
|
104
|
+
results.push(
|
|
105
|
+
new ShowMoreDebugStackFrame(frames[i], showMoreFrames, session, showMoreOrigin, expandFrame),
|
|
106
|
+
);
|
|
107
|
+
offset -= showMoreFrames.length - 1;
|
|
108
|
+
} else {
|
|
109
|
+
results.push(showMoreFrames[0]);
|
|
110
|
+
}
|
|
111
|
+
showMoreFrames = [];
|
|
112
|
+
hasOrigin = false;
|
|
113
|
+
showMoreOrigin = frames[i].source?.raw.origin;
|
|
114
|
+
showMoreFrames.push(frames[i]);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
hasOrigin = true;
|
|
118
|
+
showMoreFrames.push(frames[i]);
|
|
119
|
+
showMoreOrigin = frames[i].source?.raw.origin;
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
if (hasOrigin && showMoreFrames.length > 0) {
|
|
123
|
+
if (showMoreFrames.length > 1) {
|
|
124
|
+
results.push(
|
|
125
|
+
new ShowMoreDebugStackFrame(frames[i], showMoreFrames, session, showMoreOrigin, expandFrame),
|
|
126
|
+
);
|
|
127
|
+
offset -= showMoreFrames.length - 1;
|
|
128
|
+
} else {
|
|
129
|
+
results.push(showMoreFrames[0]);
|
|
130
|
+
}
|
|
131
|
+
showMoreFrames = [];
|
|
132
|
+
hasOrigin = false;
|
|
133
|
+
}
|
|
134
|
+
results.push(frames[i]);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (hasOrigin && showMoreFrames.length > 0) {
|
|
138
|
+
if (showMoreFrames.length > 1) {
|
|
139
|
+
results.push(new ShowMoreDebugStackFrame(undefined, showMoreFrames, session, showMoreOrigin, expandFrame));
|
|
140
|
+
} else {
|
|
141
|
+
results.push(showMoreFrames[0]);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return results;
|
|
145
|
+
},
|
|
146
|
+
[],
|
|
147
|
+
);
|
|
148
|
+
|
|
60
149
|
const updateFrames = useCallback(
|
|
61
150
|
(frames: DebugStackFrame[]) => {
|
|
62
|
-
|
|
151
|
+
currentFrames.current = mergeFrames(currentFrames.current, frames);
|
|
152
|
+
setFrames(currentFrames.current);
|
|
63
153
|
},
|
|
64
|
-
[frames],
|
|
154
|
+
[frames, mergeFrames],
|
|
65
155
|
);
|
|
66
156
|
|
|
67
157
|
const updateSelected = useCallback(
|
|
@@ -118,13 +208,18 @@ export const DebugStackFramesView = observer((props: DebugStackSessionViewProps)
|
|
|
118
208
|
}, [frames]);
|
|
119
209
|
|
|
120
210
|
const template = ({ data }) => {
|
|
121
|
-
const frame: DebugStackFrame = data;
|
|
122
|
-
const isLabel = frame.raw.presentationHint === 'label';
|
|
123
|
-
const isSubtle = frame.raw.presentationHint === 'subtle';
|
|
124
|
-
const
|
|
211
|
+
const frame: DebugStackFrame | ShowMoreDebugStackFrame = data;
|
|
212
|
+
const isLabel = DebugStackFrame.is(frame) && frame.raw.presentationHint === 'label';
|
|
213
|
+
const isSubtle = DebugStackFrame.is(frame) && frame.raw.presentationHint === 'subtle';
|
|
214
|
+
const isDeemphasize = DebugStackFrame.is(frame) && frame.raw?.source?.presentationHint === 'deemphasize';
|
|
215
|
+
const onClickHandler = useCallback(() => {
|
|
125
216
|
if (isLabel || isSubtle) {
|
|
126
217
|
return;
|
|
127
218
|
}
|
|
219
|
+
if (!DebugStackFrame.is(frame)) {
|
|
220
|
+
frame.open();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
128
223
|
manager.updateCurrentSession(frame.session);
|
|
129
224
|
|
|
130
225
|
frame.session.currentThread = frame.thread;
|
|
@@ -135,86 +230,125 @@ export const DebugStackFramesView = observer((props: DebugStackSessionViewProps)
|
|
|
135
230
|
const restartFrame = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
|
136
231
|
event.preventDefault();
|
|
137
232
|
event.stopPropagation();
|
|
138
|
-
|
|
233
|
+
if (!DebugStackFrame.is(frame)) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
139
236
|
if (frame.canRestart) {
|
|
140
237
|
frame.restart();
|
|
141
238
|
}
|
|
142
239
|
};
|
|
143
240
|
|
|
241
|
+
const frameItemStyle = {
|
|
242
|
+
paddingLeft: `${indent}px`,
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
if (DebugStackFrame.is(frame) && isDeemphasize) {
|
|
246
|
+
frameItemStyle['color'] = 'var(--list-deemphasizedForeground)';
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const renderFrame = useCallback((frame) => {
|
|
250
|
+
if (DebugStackFrame.is(frame)) {
|
|
251
|
+
return (
|
|
252
|
+
<>
|
|
253
|
+
<span
|
|
254
|
+
className={cls(styles.debug_stack_frames_item_label, isLabel && styles.label, isSubtle && styles.subtle)}
|
|
255
|
+
>
|
|
256
|
+
{frame.raw && frame.raw.name}
|
|
257
|
+
</span>
|
|
258
|
+
{!isLabel && (
|
|
259
|
+
<span className={styles.debug_stack_frames_item_description}>
|
|
260
|
+
{(frame.raw && frame.raw.source && frame.raw.source.name) || localize('debug.stack.frame.noSource')}
|
|
261
|
+
</span>
|
|
262
|
+
)}
|
|
263
|
+
<>
|
|
264
|
+
{frame.canRestart && (
|
|
265
|
+
<a
|
|
266
|
+
title=''
|
|
267
|
+
onClick={(event) => restartFrame(event)}
|
|
268
|
+
className={cls(styles.debug_restart_frame_icon, getIcon('debug-restart-frame'))}
|
|
269
|
+
></a>
|
|
270
|
+
)}
|
|
271
|
+
{!isLabel && !isDeemphasize && (
|
|
272
|
+
<div className={cls(!isUndefined(frame.raw.line) && styles.debug_stack_frames_item_badge)}>
|
|
273
|
+
{frame.raw && frame.raw.line}
|
|
274
|
+
{!isUndefined(frame.raw.line) && ':'}
|
|
275
|
+
{frame.raw && frame.raw.column}
|
|
276
|
+
</div>
|
|
277
|
+
)}
|
|
278
|
+
</>
|
|
279
|
+
</>
|
|
280
|
+
);
|
|
281
|
+
} else {
|
|
282
|
+
return <span className={styles.debug_stack_frames_load_more}>{frame.name}</span>;
|
|
283
|
+
}
|
|
284
|
+
}, []);
|
|
285
|
+
|
|
144
286
|
return (
|
|
145
287
|
<div
|
|
146
|
-
style={
|
|
288
|
+
style={frameItemStyle}
|
|
147
289
|
className={cls(
|
|
148
290
|
styles.debug_stack_frames_item,
|
|
149
|
-
|
|
150
|
-
|
|
291
|
+
isLabel && styles.is_label,
|
|
292
|
+
DebugStackFrame.is(frame) && selected === frame.raw.id && styles.selected,
|
|
293
|
+
DebugStackFrame.is(frame) &&
|
|
294
|
+
!(frame.raw && frame.raw.source && frame.raw.source.name) &&
|
|
295
|
+
styles.debug_stack_frames_item_hidden,
|
|
151
296
|
)}
|
|
152
|
-
onClick={
|
|
297
|
+
onClick={onClickHandler}
|
|
153
298
|
onContextMenu={(event: React.MouseEvent<HTMLDivElement, MouseEvent>) =>
|
|
154
299
|
debugCallStackService.handleContextMenu(event, data)
|
|
155
300
|
}
|
|
156
301
|
>
|
|
157
|
-
|
|
158
|
-
{frame.raw && frame.raw.name}
|
|
159
|
-
</span>
|
|
160
|
-
<span className={styles.debug_stack_frames_item_description}>
|
|
161
|
-
{(frame.raw && frame.raw.source && frame.raw.source.name) || localize('debug.stack.frame.noSource')}
|
|
162
|
-
</span>
|
|
163
|
-
<>
|
|
164
|
-
<a
|
|
165
|
-
title=''
|
|
166
|
-
onClick={(event) => restartFrame(event)}
|
|
167
|
-
className={cls(styles.debug_restart_frame_icon, getIcon('debug-restart-frame'))}
|
|
168
|
-
></a>
|
|
169
|
-
<div className={cls(!isUndefined(frame.raw.line) && styles.debug_stack_frames_item_badge)}>
|
|
170
|
-
{frame.raw && frame.raw.line}
|
|
171
|
-
{!isUndefined(frame.raw.line) && ':'}
|
|
172
|
-
{frame.raw && frame.raw.column}
|
|
173
|
-
</div>
|
|
174
|
-
</>
|
|
302
|
+
{renderFrame(frame)}
|
|
175
303
|
</div>
|
|
176
304
|
);
|
|
177
305
|
};
|
|
178
306
|
|
|
179
|
-
const renderLoadMoreStackFrames = () => {
|
|
180
|
-
const
|
|
307
|
+
const renderLoadMoreStackFrames = useCallback(() => {
|
|
308
|
+
const onClickHandler = async () => {
|
|
181
309
|
setIsLoading(true);
|
|
182
310
|
await loadMore();
|
|
183
311
|
setIsLoading(false);
|
|
184
312
|
};
|
|
185
313
|
return (
|
|
186
|
-
<div className={styles.debug_stack_frames_item} onClick={
|
|
314
|
+
<div className={styles.debug_stack_frames_item} onClick={onClickHandler}>
|
|
187
315
|
<span className={styles.debug_stack_frames_load_more}>{localize('debug.stack.loadMore')}</span>
|
|
188
316
|
</div>
|
|
189
317
|
);
|
|
190
|
-
};
|
|
318
|
+
}, [isLoading, loadMore]);
|
|
191
319
|
|
|
192
|
-
const renderLoading = (
|
|
193
|
-
|
|
194
|
-
<
|
|
195
|
-
|
|
320
|
+
const renderLoading = useCallback(
|
|
321
|
+
() => (
|
|
322
|
+
<div className={styles.debug_stack_frames_item}>
|
|
323
|
+
<span className={styles.debug_stack_frames_load_more}>{localize('debug.stack.loading')}</span>
|
|
324
|
+
</div>
|
|
325
|
+
),
|
|
326
|
+
[],
|
|
196
327
|
);
|
|
197
328
|
|
|
198
|
-
const renderFramesErrorMessage = (
|
|
199
|
-
|
|
200
|
-
<
|
|
201
|
-
{message}
|
|
202
|
-
|
|
203
|
-
|
|
329
|
+
const renderFramesErrorMessage = useCallback(
|
|
330
|
+
(message: string) => (
|
|
331
|
+
<div className={styles.debug_stack_frames_item}>
|
|
332
|
+
<span className={styles.debug_stack_frames_error_message} title={message}>
|
|
333
|
+
{message}
|
|
334
|
+
</span>
|
|
335
|
+
</div>
|
|
336
|
+
),
|
|
337
|
+
[],
|
|
204
338
|
);
|
|
205
339
|
|
|
206
340
|
if (framesErrorMessage) {
|
|
207
341
|
return <div className={styles.debug_stack_frames}>{renderFramesErrorMessage(framesErrorMessage)}</div>;
|
|
208
342
|
}
|
|
209
343
|
|
|
210
|
-
const footer = () => {
|
|
344
|
+
const footer = useCallback(() => {
|
|
211
345
|
if (isLoading) {
|
|
212
346
|
return renderLoading();
|
|
213
347
|
} else if (canLoadMore) {
|
|
214
348
|
return renderLoadMoreStackFrames();
|
|
215
349
|
}
|
|
216
350
|
return null;
|
|
217
|
-
};
|
|
351
|
+
}, [isLoading, canLoadMore]);
|
|
218
352
|
|
|
219
353
|
return (
|
|
220
354
|
<RecycleList
|
|
@@ -222,8 +356,7 @@ export const DebugStackFramesView = observer((props: DebugStackSessionViewProps)
|
|
|
222
356
|
template={template}
|
|
223
357
|
itemHeight={22}
|
|
224
358
|
width={viewState.width}
|
|
225
|
-
|
|
226
|
-
height={isLoading || canLoadMore ? (frames.length + 1) * 22 : frames.length * 22}
|
|
359
|
+
height={(isLoading || canLoadMore ? (frames.length + 1) * 22 : frames.length * 22) + (isBottom ? 10 : 0)}
|
|
227
360
|
footer={isLoading || canLoadMore ? footer : undefined}
|
|
228
361
|
/>
|
|
229
362
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cls from 'classnames';
|
|
2
|
-
import React, { useCallback, useState, useEffect } from 'react';
|
|
2
|
+
import React, { useCallback, useState, useEffect, useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { ViewState, getIcon, useInjectable, DisposableCollection, localize } from '@opensumi/ide-core-browser';
|
|
5
5
|
|
|
@@ -34,6 +34,7 @@ export const DebugStackSessionView = (props: DebugStackSessionViewProps) => {
|
|
|
34
34
|
const mutipleSession = manager.sessions.length > 1;
|
|
35
35
|
const supportsThreadIdCorrespond = session.supportsThreadIdCorrespond;
|
|
36
36
|
|
|
37
|
+
const disposed = useRef<boolean>(false);
|
|
37
38
|
// 从 manager.sessions 中找出 parentSession id 是当前 session id 的 session
|
|
38
39
|
const findSubSessions = () => {
|
|
39
40
|
const hasParentSessions = manager.sessions.filter((s) => s.parentSession);
|
|
@@ -57,20 +58,30 @@ export const DebugStackSessionView = (props: DebugStackSessionViewProps) => {
|
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
useEffect(() => {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const disposables = new DisposableCollection();
|
|
62
|
+
disposables.push(
|
|
63
|
+
manager.onDidCreateDebugSession(() => {
|
|
64
|
+
if (disposed.current) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const sub = findSubSessions();
|
|
68
|
+
setSubSession(sub);
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
disposables.push(
|
|
73
|
+
manager.onDidDestroyDebugSession(() => {
|
|
74
|
+
if (disposed.current) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const sub = findSubSessions();
|
|
78
|
+
setSubSession(sub);
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
69
81
|
|
|
70
82
|
return () => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
setSubSession([]);
|
|
83
|
+
disposed.current = true;
|
|
84
|
+
disposables.dispose();
|
|
74
85
|
};
|
|
75
86
|
}, []);
|
|
76
87
|
|
|
@@ -153,7 +164,7 @@ export const DebugStackSessionView = (props: DebugStackSessionViewProps) => {
|
|
|
153
164
|
</div>
|
|
154
165
|
) : (
|
|
155
166
|
otherThreads.map(
|
|
156
|
-
(thread) =>
|
|
167
|
+
(thread: DebugThread, index: number) =>
|
|
157
168
|
!session.hasInMultipleThreadPaused(thread.raw.id) && (
|
|
158
169
|
<DebugStackThreadView
|
|
159
170
|
key={thread.id}
|
|
@@ -161,6 +172,7 @@ export const DebugStackSessionView = (props: DebugStackSessionViewProps) => {
|
|
|
161
172
|
viewState={viewState}
|
|
162
173
|
thread={thread}
|
|
163
174
|
session={session}
|
|
175
|
+
isBottom={index === otherThreads.length - 1}
|
|
164
176
|
/>
|
|
165
177
|
),
|
|
166
178
|
)
|
|
@@ -225,25 +237,27 @@ export const DebugStackSessionView = (props: DebugStackSessionViewProps) => {
|
|
|
225
237
|
</div>
|
|
226
238
|
)}
|
|
227
239
|
{supportsThreadIdCorrespond && unfold
|
|
228
|
-
? multipleThreadPaused.map((t) => (
|
|
240
|
+
? multipleThreadPaused.map((t: DebugThread, index: number) => (
|
|
229
241
|
<DebugStackThreadView
|
|
230
242
|
key={t.id}
|
|
231
243
|
indent={mutipleSession ? 16 : 0}
|
|
232
244
|
viewState={viewState}
|
|
233
245
|
thread={t}
|
|
234
246
|
session={session}
|
|
247
|
+
isBottom={index === multipleThreadPaused.length - 1}
|
|
235
248
|
/>
|
|
236
249
|
))
|
|
237
250
|
: null}
|
|
238
251
|
{!supportsThreadIdCorrespond &&
|
|
239
252
|
(!mutipleSession || unfold) &&
|
|
240
|
-
threads.map((thread) => (
|
|
253
|
+
threads.map((thread: DebugThread, index: number) => (
|
|
241
254
|
<DebugStackThreadView
|
|
242
255
|
key={thread.id}
|
|
243
256
|
indent={mutipleSession ? 16 : 0}
|
|
244
257
|
viewState={viewState}
|
|
245
258
|
thread={thread}
|
|
246
259
|
session={session}
|
|
260
|
+
isBottom={index === threads.length - 1}
|
|
247
261
|
/>
|
|
248
262
|
))}
|
|
249
263
|
{subSession.length > 0 &&
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
+
import { Badge } from '@opensumi/ide-components';
|
|
3
4
|
import { ViewState, getIcon, useInjectable, localize, DisposableCollection } from '@opensumi/ide-core-browser';
|
|
4
5
|
|
|
5
6
|
import { IDebugSessionManager } from '../../../common';
|
|
@@ -18,10 +19,11 @@ export interface DebugStackThreadViewProps {
|
|
|
18
19
|
viewState: ViewState;
|
|
19
20
|
thread: DebugThread;
|
|
20
21
|
indent?: number;
|
|
22
|
+
isBottom?: boolean;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export const DebugStackThreadView = (props: DebugStackThreadViewProps) => {
|
|
24
|
-
const { thread, viewState, indent, session } = props;
|
|
26
|
+
const { thread, viewState, indent, session, isBottom } = props;
|
|
25
27
|
const manager = useInjectable<DebugSessionManager>(IDebugSessionManager);
|
|
26
28
|
const debugCallStackService = useInjectable<DebugCallStackService>(DebugCallStackService);
|
|
27
29
|
const [expanded, setExpanded] = useState<boolean>(true);
|
|
@@ -58,6 +60,15 @@ export const DebugStackThreadView = (props: DebugStackThreadViewProps) => {
|
|
|
58
60
|
};
|
|
59
61
|
}, []);
|
|
60
62
|
|
|
63
|
+
const statusDescription =
|
|
64
|
+
thread.stopped && thread.stoppedDetails
|
|
65
|
+
? thread.raw.id === thread.stoppedDetails.threadId
|
|
66
|
+
? `${localize('debug.stack.frame.because')} ${thread.stoppedDetails.reason} ${localize(
|
|
67
|
+
'debug.stack.frame.stopped',
|
|
68
|
+
)}`
|
|
69
|
+
: localize('debug.stack.frame.stopped')
|
|
70
|
+
: localize('debug.stack.frame.running');
|
|
71
|
+
|
|
61
72
|
return (
|
|
62
73
|
<div
|
|
63
74
|
className={styles.debug_stack_item}
|
|
@@ -81,13 +92,7 @@ export const DebugStackThreadView = (props: DebugStackThreadViewProps) => {
|
|
|
81
92
|
<DebugStackOperationView thread={thread} />
|
|
82
93
|
</div>
|
|
83
94
|
<span className={styles.debug_threads_description}>
|
|
84
|
-
{
|
|
85
|
-
? thread.raw.id === thread.stoppedDetails.threadId
|
|
86
|
-
? `${localize('debug.stack.frame.because')} ${thread.stoppedDetails.reason} ${localize(
|
|
87
|
-
'debug.stack.frame.stopped',
|
|
88
|
-
)}`
|
|
89
|
-
: localize('debug.stack.frame.stopped')
|
|
90
|
-
: localize('debug.stack.frame.running')}
|
|
95
|
+
<Badge>{statusDescription.toUpperCase()}</Badge>
|
|
91
96
|
</span>
|
|
92
97
|
</>
|
|
93
98
|
</div>
|
|
@@ -95,6 +100,7 @@ export const DebugStackThreadView = (props: DebugStackThreadViewProps) => {
|
|
|
95
100
|
{(!mutiple || expanded) && thread.frames.length > 0 && (
|
|
96
101
|
<DebugStackFramesView
|
|
97
102
|
indent={mutiple ? (mutipleS ? 24 + 14 : 16 + 14) : 8}
|
|
103
|
+
isBottom={isBottom}
|
|
98
104
|
viewState={viewState}
|
|
99
105
|
thread={thread}
|
|
100
106
|
frames={frames}
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
flex: 1;
|
|
127
127
|
margin-right: 12px;
|
|
128
128
|
&.label {
|
|
129
|
-
text-align:
|
|
129
|
+
text-align: left;
|
|
130
130
|
min-width: fit-content;
|
|
131
131
|
opacity: 0.7;
|
|
132
132
|
}
|
|
@@ -148,7 +148,6 @@
|
|
|
148
148
|
color: var(--badge-foreground);
|
|
149
149
|
font-size: 12px;
|
|
150
150
|
margin-left: 5px;
|
|
151
|
-
display: inline-block;
|
|
152
151
|
}
|
|
153
152
|
.debug_stack_frames_item_hidden {
|
|
154
153
|
opacity: 0.4;
|