@opensumi/ide-debug 2.21.3 → 2.21.4-rc-1668395886.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-contribution.d.ts +2 -147
- package/lib/browser/debug-contribution.d.ts.map +1 -1
- package/lib/browser/debug-contribution.js +48 -197
- package/lib/browser/debug-contribution.js.map +1 -1
- package/lib/browser/debug-session-manager.d.ts +2 -3
- package/lib/browser/debug-session-manager.d.ts.map +1 -1
- package/lib/browser/debug-session-manager.js +2 -3
- package/lib/browser/debug-session-manager.js.map +1 -1
- package/lib/browser/debug-session.d.ts +3 -4
- package/lib/browser/debug-session.d.ts.map +1 -1
- package/lib/browser/debug-session.js.map +1 -1
- package/lib/browser/editor/debug-editor-contribution.d.ts +2 -2
- package/lib/browser/editor/debug-editor-contribution.d.ts.map +1 -1
- package/lib/browser/editor/debug-editor-contribution.js +2 -3
- package/lib/browser/editor/debug-editor-contribution.js.map +1 -1
- package/lib/browser/editor/debug-model-manager.d.ts +2 -9
- package/lib/browser/editor/debug-model-manager.d.ts.map +1 -1
- package/lib/browser/editor/debug-model-manager.js +8 -15
- package/lib/browser/editor/debug-model-manager.js.map +1 -1
- package/lib/browser/index.d.ts +0 -14
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +6 -15
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/model/debug-source.d.ts +3 -3
- package/lib/browser/model/debug-source.d.ts.map +1 -1
- package/lib/browser/model/debug-source.js.map +1 -1
- package/lib/browser/model/debug-watch.d.ts.map +1 -1
- package/lib/browser/model/debug-watch.js +1 -2
- package/lib/browser/model/debug-watch.js.map +1 -1
- package/lib/browser/view/console/debug-console-session.d.ts +2 -1
- 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.contribution.d.ts.map +1 -1
- package/lib/browser/view/console/debug-console.contribution.js +21 -23
- package/lib/browser/view/console/debug-console.contribution.js.map +1 -1
- package/lib/browser/view/console/debug-console.module.less +1 -1
- package/lib/browser/view/console/debug-console.view.js +2 -2
- package/lib/browser/view/console/debug-console.view.js.map +1 -1
- package/lib/browser/view/frames/debug-call-stack.contribution.js +5 -5
- package/lib/browser/view/frames/debug-call-stack.contribution.js.map +1 -1
- package/lib/browser/view/variables/debug-variables.contribution.d.ts.map +1 -1
- package/lib/browser/view/variables/debug-variables.contribution.js +12 -13
- package/lib/browser/view/variables/debug-variables.contribution.js.map +1 -1
- package/lib/browser/view/variables/debug-variables.module.less +1 -1
- package/lib/browser/view/variables/debug-variables.view.js +1 -1
- package/lib/browser/view/variables/debug-variables.view.js.map +1 -1
- package/lib/browser/view/watch/debug-watch.contribution.d.ts.map +1 -1
- package/lib/browser/view/watch/debug-watch.contribution.js +21 -19
- package/lib/browser/view/watch/debug-watch.contribution.js.map +1 -1
- package/lib/browser/view/watch/debug-watch.module.less +1 -1
- package/lib/browser/view/watch/debug-watch.view.js +1 -1
- package/lib/browser/view/watch/debug-watch.view.js.map +1 -1
- package/lib/common/commands.d.ts +46 -0
- package/lib/common/commands.d.ts.map +1 -0
- package/lib/common/commands.js +149 -0
- package/lib/common/commands.js.map +1 -0
- package/lib/common/debug-console.d.ts +18 -0
- package/lib/common/debug-console.d.ts.map +1 -0
- package/lib/common/debug-console.js +5 -0
- package/lib/common/debug-console.js.map +1 -0
- package/lib/common/debug-model.d.ts +17 -2
- package/lib/common/debug-model.d.ts.map +1 -1
- package/lib/common/debug-model.js +9 -1
- package/lib/common/debug-model.js.map +1 -1
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +2 -0
- package/lib/common/index.js.map +1 -1
- package/package.json +25 -24
- package/src/browser/assets/breakpoint-conditional-disabled.svg +4 -0
- package/src/browser/assets/breakpoint-conditional-unverified.svg +4 -0
- package/src/browser/assets/breakpoint-conditional.svg +4 -0
- package/src/browser/assets/breakpoint-disabled.svg +4 -0
- package/src/browser/assets/breakpoint-hint.svg +4 -0
- package/src/browser/assets/breakpoint-log-disabled.svg +4 -0
- package/src/browser/assets/breakpoint-log-unverified.svg +4 -0
- package/src/browser/assets/breakpoint-log.svg +4 -0
- package/src/browser/assets/breakpoint-unsupported.svg +4 -0
- package/src/browser/assets/breakpoint-unverified.svg +4 -0
- package/src/browser/assets/breakpoint.svg +4 -0
- package/src/browser/assets/breakpoints-activate-inverse.svg +4 -0
- package/src/browser/assets/breakpoints-activate.svg +4 -0
- package/src/browser/assets/configure-inverse.svg +4 -0
- package/src/browser/assets/configure.svg +4 -0
- package/src/browser/assets/continue-inverse.svg +4 -0
- package/src/browser/assets/current-and-breakpoint.svg +4 -0
- package/src/browser/assets/current-arrow.svg +4 -0
- package/src/browser/assets/remove-all-inverse.svg +4 -0
- package/src/browser/assets/remove-all.svg +4 -0
- package/src/browser/assets/repl-inverse.svg +4 -0
- package/src/browser/assets/repl.svg +4 -0
- package/src/browser/assets/restart-inverse.svg +4 -0
- package/src/browser/assets/stackframe-and-breakpoint.svg +4 -0
- package/src/browser/assets/stackframe-arrow.svg +4 -0
- package/src/browser/assets/start-inverse.svg +4 -0
- package/src/browser/breakpoint/breakpoint-decoration.ts +57 -0
- package/src/browser/breakpoint/breakpoint-manager.ts +348 -0
- package/src/browser/breakpoint/breakpoint-marker.ts +70 -0
- package/src/browser/breakpoint/index.ts +3 -0
- package/src/browser/components/debug-action/index.module.less +73 -0
- package/src/browser/components/debug-action/index.tsx +40 -0
- package/src/browser/components/debug-exception-widget.less +42 -0
- package/src/browser/components/floating-click-widget/index.module.less +5 -0
- package/src/browser/components/floating-click-widget/index.tsx +21 -0
- package/src/browser/components/index.ts +1 -0
- package/src/browser/contextkeys/debug-call-stack-item-type-key.ts +4 -0
- package/src/browser/contextkeys/debug-contextkey.service.ts +54 -0
- package/src/browser/contextkeys/index.ts +1 -0
- package/src/browser/debug-ansi-handle.ts +521 -0
- package/src/browser/debug-configuration-manager.ts +513 -0
- package/src/browser/debug-configuration-model.ts +66 -0
- package/src/browser/debug-contribution.ts +751 -0
- package/src/browser/debug-exception-widget.tsx +89 -0
- package/src/browser/debug-link-detector.ts +234 -0
- package/src/browser/debug-memory.ts +220 -0
- package/src/browser/debug-preferences.ts +70 -0
- package/src/browser/debug-progress.service.ts +122 -0
- package/src/browser/debug-schema-updater.ts +67 -0
- package/src/browser/debug-service.ts +42 -0
- package/src/browser/debug-session-connection.ts +333 -0
- package/src/browser/debug-session-contribution.ts +57 -0
- package/src/browser/debug-session-manager.ts +622 -0
- package/src/browser/debug-session.ts +1178 -0
- package/src/browser/debug-style.less +124 -0
- package/src/browser/debugUtils.ts +110 -0
- package/src/browser/editor/debug-breakpoint-widget.ts +99 -0
- package/src/browser/editor/debug-breakpoint-zone-widget.tsx +262 -0
- package/src/browser/editor/debug-breakpoint.module.less +29 -0
- package/src/browser/editor/debug-editor-contribution.ts +589 -0
- package/src/browser/editor/debug-expression-provider.ts +101 -0
- package/src/browser/editor/debug-hover-model.ts +38 -0
- package/src/browser/editor/debug-hover-source.ts +107 -0
- package/src/browser/editor/debug-hover-tree.model.service.ts +332 -0
- package/src/browser/editor/debug-hover-widget.tsx +200 -0
- package/src/browser/editor/debug-hover.module.less +29 -0
- package/src/browser/editor/debug-hover.view.tsx +147 -0
- package/src/browser/editor/debug-model-manager.ts +219 -0
- package/src/browser/editor/debug-model.ts +853 -0
- package/src/browser/editor/debug-run-to-cursor.service.ts +180 -0
- package/src/browser/editor/debug-styles.ts +66 -0
- package/src/browser/editor/evaluatable-expression.ts +47 -0
- package/src/browser/editor/index.ts +6 -0
- package/src/browser/index.ts +127 -0
- package/src/browser/markers/index.ts +2 -0
- package/src/browser/markers/marker-manager.ts +201 -0
- package/src/browser/markers/marker.ts +20 -0
- package/src/browser/model/debug-source.ts +144 -0
- package/src/browser/model/debug-stack-frame.ts +111 -0
- package/src/browser/model/debug-thread.ts +186 -0
- package/src/browser/model/debug-watch.ts +129 -0
- package/src/browser/model/index.ts +4 -0
- package/src/browser/preferences/launch-folder-preference-provider.ts +23 -0
- package/src/browser/preferences/launch-preferences-contribution.ts +9 -0
- package/src/browser/preferences/launch-preferences.ts +16 -0
- package/src/browser/tree/debug-console-tree-node.define.tsx +76 -0
- package/src/browser/tree/debug-tree-node.define.ts +768 -0
- package/src/browser/tree/index.ts +2 -0
- package/src/browser/view/breakpoints/debug-breakpoints.module.less +72 -0
- package/src/browser/view/breakpoints/debug-breakpoints.service.ts +216 -0
- package/src/browser/view/breakpoints/debug-breakpoints.view.tsx +174 -0
- package/src/browser/view/configuration/debug-configuration.module.less +110 -0
- package/src/browser/view/configuration/debug-configuration.service.ts +170 -0
- package/src/browser/view/configuration/debug-configuration.view.tsx +253 -0
- package/src/browser/view/configuration/debug-toolbar.service.ts +167 -0
- package/src/browser/view/configuration/debug-toolbar.view.tsx +335 -0
- package/src/browser/view/console/debug-console-filter.model.ts +49 -0
- package/src/browser/view/console/debug-console-filter.service.ts +81 -0
- package/src/browser/view/console/debug-console-filter.view.tsx +78 -0
- package/src/browser/view/console/debug-console-model.ts +48 -0
- package/src/browser/view/console/debug-console-session.ts +165 -0
- package/src/browser/view/console/debug-console-toolbar.view.tsx +28 -0
- package/src/browser/view/console/debug-console-tree.model.service.ts +550 -0
- package/src/browser/view/console/debug-console.contribution.ts +179 -0
- package/src/browser/view/console/debug-console.module.less +369 -0
- package/src/browser/view/console/debug-console.service.ts +433 -0
- package/src/browser/view/console/debug-console.view.tsx +500 -0
- package/src/browser/view/debug-view-model.ts +182 -0
- package/src/browser/view/frames/debug-call-stack-frame.view.tsx +224 -0
- package/src/browser/view/frames/debug-call-stack-session.view.tsx +237 -0
- package/src/browser/view/frames/debug-call-stack-thread.view.tsx +93 -0
- package/src/browser/view/frames/debug-call-stack.contribution.ts +88 -0
- package/src/browser/view/frames/debug-call-stack.module.less +193 -0
- package/src/browser/view/frames/debug-call-stack.operation.tsx +97 -0
- package/src/browser/view/frames/debug-call-stack.service.ts +105 -0
- package/src/browser/view/frames/debug-call-stack.view.tsx +43 -0
- package/src/browser/view/variables/debug-variables-model.ts +38 -0
- package/src/browser/view/variables/debug-variables-tree.model.service.ts +467 -0
- package/src/browser/view/variables/debug-variables.contribution.ts +243 -0
- package/src/browser/view/variables/debug-variables.module.less +148 -0
- package/src/browser/view/variables/debug-variables.view.tsx +303 -0
- package/src/browser/view/watch/debug-watch-model.ts +38 -0
- package/src/browser/view/watch/debug-watch-tree.model.service.ts +567 -0
- package/src/browser/view/watch/debug-watch.contribution.ts +170 -0
- package/src/browser/view/watch/debug-watch.module.less +188 -0
- package/src/browser/view/watch/debug-watch.view.tsx +337 -0
- package/src/common/commands.ts +146 -0
- package/src/common/constants.ts +81 -0
- package/src/common/debug-breakpoint.ts +43 -0
- package/src/common/debug-configuration.ts +68 -0
- package/src/common/debug-console.ts +20 -0
- package/src/common/debug-editor.ts +4 -0
- package/src/common/debug-hover.ts +31 -0
- package/src/common/debug-model.ts +272 -0
- package/src/common/debug-progress.ts +8 -0
- package/src/common/debug-schema-updater.ts +1 -0
- package/src/common/debug-service.ts +176 -0
- package/src/common/debug-session-options.ts +19 -0
- package/src/common/debug-session.ts +200 -0
- package/src/common/evaluatable-expression.ts +43 -0
- package/src/common/index.ts +16 -0
- package/src/common/inline-values.ts +77 -0
- package/src/common/terminal.ts +163 -0
- package/src/common/types.ts +86 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Injectable, Autowired } from '@opensumi/di';
|
|
2
|
+
import { URI } from '@opensumi/ide-core-common';
|
|
3
|
+
import { WorkbenchEditorService } from '@opensumi/ide-editor';
|
|
4
|
+
import { Position } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/position';
|
|
5
|
+
|
|
6
|
+
import { IDebugBreakpoint } from '../../common';
|
|
7
|
+
|
|
8
|
+
import { IDebugSessionManager, DebugState } from './../../common/debug-session';
|
|
9
|
+
import { DebugBreakpoint } from './../breakpoint/breakpoint-marker';
|
|
10
|
+
import { DebugSessionManager } from './../debug-session-manager';
|
|
11
|
+
import { DebugBreakpointsService } from './../view/breakpoints/debug-breakpoints.service';
|
|
12
|
+
|
|
13
|
+
@Injectable()
|
|
14
|
+
export class DebugRunToCursorService {
|
|
15
|
+
@Autowired(IDebugSessionManager)
|
|
16
|
+
protected readonly sessionManager: DebugSessionManager;
|
|
17
|
+
|
|
18
|
+
@Autowired(WorkbenchEditorService)
|
|
19
|
+
protected readonly workbenchEditorService: WorkbenchEditorService;
|
|
20
|
+
|
|
21
|
+
@Autowired(DebugBreakpointsService)
|
|
22
|
+
protected readonly debugBreakpointsService: DebugBreakpointsService;
|
|
23
|
+
|
|
24
|
+
constructor() {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param uri
|
|
28
|
+
* @param isForce 为 true 表示强制运行到光标处,不管中间有没有启用的断点,它就是要畅通无阻
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
public async run(uri: URI, isForce = false): Promise<void> {
|
|
32
|
+
const currentSession = this.sessionManager.currentSession;
|
|
33
|
+
if (!currentSession) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (currentSession.state !== DebugState.Stopped) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const currentEditor = this.workbenchEditorService.currentEditor;
|
|
42
|
+
|
|
43
|
+
if (!currentEditor) {
|
|
44
|
+
return;
|
|
45
|
+
} else if (!currentEditor.monacoEditor) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { monacoEditor } = currentEditor;
|
|
50
|
+
|
|
51
|
+
const position = monacoEditor.getPosition();
|
|
52
|
+
if (!(monacoEditor.hasModel() && position)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const sessionModel = currentSession.getModel();
|
|
57
|
+
if (!sessionModel) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const bpExists = !!sessionModel.getBreakpoints(uri, { column: position.column, lineNumber: position.lineNumber })
|
|
62
|
+
.length;
|
|
63
|
+
|
|
64
|
+
let breakpointToRemove: IDebugBreakpoint | undefined;
|
|
65
|
+
let threadToContinue = currentSession.currentThread;
|
|
66
|
+
let enabledBreakpoints: IDebugBreakpoint[] = [];
|
|
67
|
+
|
|
68
|
+
if (!bpExists) {
|
|
69
|
+
if (isForce) {
|
|
70
|
+
enabledBreakpoints = sessionModel
|
|
71
|
+
.getBreakpoints()
|
|
72
|
+
.filter((bk) => bk.enabled)
|
|
73
|
+
.filter((bk) => bk.raw.column !== position.column && bk.raw.line !== position.lineNumber);
|
|
74
|
+
// 先将所有断点禁用,并收集起来,continue 之后再恢复状态
|
|
75
|
+
enabledBreakpoints.forEach((bk) => {
|
|
76
|
+
this.debugBreakpointsService.toggleBreakpointEnable(bk);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const addResult = await this.addBreakpoints(uri, position);
|
|
81
|
+
if (!addResult) {
|
|
82
|
+
this.recoverStatus(enabledBreakpoints);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (addResult.thread) {
|
|
87
|
+
threadToContinue = addResult.thread;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (addResult.breakpoint) {
|
|
91
|
+
breakpointToRemove = addResult.breakpoint;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!threadToContinue) {
|
|
96
|
+
this.recoverStatus(enabledBreakpoints);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const oneTimeListener = threadToContinue.session.onDidChangeState(() => {
|
|
101
|
+
const state = currentSession.state;
|
|
102
|
+
if (state === DebugState.Stopped || state === DebugState.Inactive) {
|
|
103
|
+
if (breakpointToRemove) {
|
|
104
|
+
currentSession.delBreakpoint(breakpointToRemove);
|
|
105
|
+
}
|
|
106
|
+
oneTimeListener.dispose();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
await threadToContinue.continue();
|
|
111
|
+
this.recoverStatus(enabledBreakpoints);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private async addBreakpoints(uri: URI, position: Position) {
|
|
115
|
+
const currentSession = this.sessionManager.currentSession;
|
|
116
|
+
|
|
117
|
+
if (!currentSession) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let column = 1;
|
|
122
|
+
const currentFrame = currentSession.currentFrame;
|
|
123
|
+
if (currentFrame && currentFrame.range().startLineNumber === position.lineNumber) {
|
|
124
|
+
// https://github.com/microsoft/vscode/issues/102199
|
|
125
|
+
column = position.column || 1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const bp = DebugBreakpoint.create(uri, { line: position.lineNumber, column });
|
|
129
|
+
|
|
130
|
+
await currentSession.addBreakpoint(bp, true);
|
|
131
|
+
if (!bp) {
|
|
132
|
+
return { breakpoint: undefined, thread: currentSession.currentThread };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Look at paused threads for sessions that verified this bp. Prefer, in order:
|
|
136
|
+
const enum Score {
|
|
137
|
+
/** The focused thread */
|
|
138
|
+
Focused,
|
|
139
|
+
/** Any other stopped thread of a session that verified the bp */
|
|
140
|
+
Verified,
|
|
141
|
+
/** Any thread that verified and paused in the same file */
|
|
142
|
+
VerifiedAndPausedInFile,
|
|
143
|
+
/** The focused thread if it verified the breakpoint */
|
|
144
|
+
VerifiedAndFocused,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let bestThread = currentSession.currentThread;
|
|
148
|
+
let bestScore = Score.Focused;
|
|
149
|
+
|
|
150
|
+
const threads = currentSession.threads.filter((t) => t.stopped);
|
|
151
|
+
if (bestScore < Score.VerifiedAndFocused) {
|
|
152
|
+
if (currentSession.currentThread && threads.includes(currentSession.currentThread)) {
|
|
153
|
+
bestThread = currentSession.currentThread;
|
|
154
|
+
bestScore = Score.VerifiedAndFocused;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (bestScore < Score.VerifiedAndPausedInFile) {
|
|
159
|
+
const pausedInThisFile = threads.find((t) => t.topFrame);
|
|
160
|
+
|
|
161
|
+
if (pausedInThisFile) {
|
|
162
|
+
bestThread = pausedInThisFile;
|
|
163
|
+
bestScore = Score.VerifiedAndPausedInFile;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (bestScore < Score.Verified) {
|
|
168
|
+
bestThread = threads[0];
|
|
169
|
+
bestScore = Score.VerifiedAndPausedInFile;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return { thread: bestThread, breakpoint: bp };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private recoverStatus(bks: IDebugBreakpoint[]): void {
|
|
176
|
+
bks.forEach((bk) => {
|
|
177
|
+
this.debugBreakpointsService.toggleBreakpointEnable(bk);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
2
|
+
|
|
3
|
+
export const STICKINESS = monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
|
|
4
|
+
|
|
5
|
+
export const BREAK_PONINT_HOVER_MARGIN: monaco.editor.IModelDecorationOptions = {
|
|
6
|
+
description: 'debug-hover',
|
|
7
|
+
glyphMarginClassName: 'sumi-debug-hover',
|
|
8
|
+
linesDecorationsClassName: 'sumi-debug-hover',
|
|
9
|
+
isWholeLine: true,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const TOP_STACK_FRAME_MARGIN: monaco.editor.IModelDecorationOptions = {
|
|
13
|
+
description: 'debug-top-stack-frame',
|
|
14
|
+
glyphMarginClassName: 'sumi-debug-top-stack-frame',
|
|
15
|
+
stickiness: STICKINESS,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const FOCUSED_STACK_FRAME_MARGIN: monaco.editor.IModelDecorationOptions = {
|
|
19
|
+
description: 'debug-focused-stack-frame',
|
|
20
|
+
glyphMarginClassName: 'sumi-debug-focused-stack-frame',
|
|
21
|
+
stickiness: STICKINESS,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const TOP_STACK_FRAME_DECORATION: monaco.editor.IModelDecorationOptions = {
|
|
25
|
+
description: 'debug-top-stack-frame-line',
|
|
26
|
+
isWholeLine: true,
|
|
27
|
+
className: 'sumi-debug-top-stack-frame-line',
|
|
28
|
+
stickiness: STICKINESS,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const TOP_STACK_FRAME_EXCEPTION_DECORATION: monaco.editor.IModelDecorationOptions = {
|
|
32
|
+
description: 'debug-top-stack-frame-exception-line',
|
|
33
|
+
isWholeLine: true,
|
|
34
|
+
className: 'sumi-debug-top-stack-frame-exception-line',
|
|
35
|
+
stickiness: STICKINESS,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const FOCUSED_STACK_FRAME_DECORATION: monaco.editor.IModelDecorationOptions = {
|
|
39
|
+
description: 'debug-focused-stack-frame-line',
|
|
40
|
+
isWholeLine: true,
|
|
41
|
+
className: 'sumi-debug-focused-stack-frame-line',
|
|
42
|
+
stickiness: STICKINESS,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const TOP_STACK_FRAME_INLINE_DECORATION: monaco.editor.IModelDecorationOptions = {
|
|
46
|
+
description: 'debug-top-stack-frame-column',
|
|
47
|
+
beforeContentClassName: 'sumi-debug-top-stack-frame-column',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const BREAKPOINT_HINT_DECORATION: monaco.editor.IModelDecorationOptions = {
|
|
51
|
+
description: 'debug-breakpoint-hint',
|
|
52
|
+
glyphMarginClassName: 'sumi-debug-breakpoint-hint',
|
|
53
|
+
stickiness: STICKINESS,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const BREAKPOINT_DECORATION: monaco.editor.IModelDecorationOptions = {
|
|
57
|
+
description: 'debug-breakpoint',
|
|
58
|
+
glyphMarginClassName: 'sumi-debug-breakpoint',
|
|
59
|
+
stickiness: STICKINESS,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const BREAKPOINT_DECORATION_DISABLED: monaco.editor.IModelDecorationOptions = {
|
|
63
|
+
description: 'debug-breakpoint-disabled',
|
|
64
|
+
glyphMarginClassName: 'sumi-debug-breakpoint-disabled',
|
|
65
|
+
stickiness: STICKINESS,
|
|
66
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Injectable } from '@opensumi/di';
|
|
2
|
+
import { IDisposable } from '@opensumi/ide-core-common';
|
|
3
|
+
import { LanguageFeatureRegistry } from '@opensumi/monaco-editor-core/esm/vs/editor/common/languageFeatureRegistry';
|
|
4
|
+
import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model';
|
|
5
|
+
|
|
6
|
+
import { EvaluatableExpressionProvider } from '../../common/evaluatable-expression';
|
|
7
|
+
|
|
8
|
+
interface SerializedDocumentFilter {
|
|
9
|
+
$serialized: true;
|
|
10
|
+
language?: string;
|
|
11
|
+
scheme?: string;
|
|
12
|
+
// 类型不兼容
|
|
13
|
+
pattern?: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const EvaluatableExpressionRegistry = new LanguageFeatureRegistry<EvaluatableExpressionProvider>();
|
|
17
|
+
|
|
18
|
+
export interface IEvaluatableExpressionService {
|
|
19
|
+
registerEvaluatableExpressionProvider(
|
|
20
|
+
selector: SerializedDocumentFilter[],
|
|
21
|
+
provider: EvaluatableExpressionProvider,
|
|
22
|
+
): IDisposable;
|
|
23
|
+
|
|
24
|
+
getSupportedEvaluatableExpressionProvider(model: ITextModel): EvaluatableExpressionProvider[];
|
|
25
|
+
|
|
26
|
+
hasEvaluatableExpressProvider(model: ITextModel): boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const IEvaluatableExpressionService = Symbol('IEvaluatableExpressionService');
|
|
30
|
+
|
|
31
|
+
@Injectable()
|
|
32
|
+
export class EvaluatableExpressionServiceImpl implements IEvaluatableExpressionService {
|
|
33
|
+
getSupportedEvaluatableExpressionProvider(model: ITextModel): EvaluatableExpressionProvider[] {
|
|
34
|
+
return EvaluatableExpressionRegistry.ordered(model);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
registerEvaluatableExpressionProvider(
|
|
38
|
+
selector: SerializedDocumentFilter[],
|
|
39
|
+
provider: EvaluatableExpressionProvider,
|
|
40
|
+
): IDisposable {
|
|
41
|
+
return EvaluatableExpressionRegistry.register(selector, provider);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
hasEvaluatableExpressProvider(model: ITextModel): boolean {
|
|
45
|
+
return EvaluatableExpressionRegistry.has(model);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Injectable, Injector, Provider } from '@opensumi/di';
|
|
2
|
+
import { BrowserModule, IContextKeyService } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { FolderPreferenceProvider } from '@opensumi/ide-preferences/lib/browser/folder-preference-provider';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
DebugEditor,
|
|
7
|
+
DebugModelFactory,
|
|
8
|
+
IDebugConsoleModelService,
|
|
9
|
+
IDebugModelManager,
|
|
10
|
+
IDebugProgress,
|
|
11
|
+
IDebugServer,
|
|
12
|
+
IDebugService,
|
|
13
|
+
IDebugSessionManager,
|
|
14
|
+
} from '../common';
|
|
15
|
+
|
|
16
|
+
import { BreakpointManager } from './breakpoint';
|
|
17
|
+
import { DebugCallStackItemTypeKey } from './contextkeys';
|
|
18
|
+
import { DebugConfigurationManager } from './debug-configuration-manager';
|
|
19
|
+
import { DebugContribution } from './debug-contribution';
|
|
20
|
+
import { injectDebugPreferences } from './debug-preferences';
|
|
21
|
+
import { DebugProgressService } from './debug-progress.service';
|
|
22
|
+
import { DebugService } from './debug-service';
|
|
23
|
+
import {
|
|
24
|
+
DebugSessionContribution,
|
|
25
|
+
DebugSessionContributionRegistry,
|
|
26
|
+
DebugSessionContributionRegistryImpl,
|
|
27
|
+
} from './debug-session-contribution';
|
|
28
|
+
import { DebugSessionManager } from './debug-session-manager';
|
|
29
|
+
import { DebugExpressionProvider, DebugModel, DebugModelManager } from './editor';
|
|
30
|
+
import { DebugHoverSource } from './editor/debug-hover-source';
|
|
31
|
+
import { EvaluatableExpressionServiceImpl, IEvaluatableExpressionService } from './editor/evaluatable-expression';
|
|
32
|
+
import { LaunchFolderPreferenceProvider } from './preferences/launch-folder-preference-provider';
|
|
33
|
+
import { LaunchPreferencesContribution } from './preferences/launch-preferences-contribution';
|
|
34
|
+
import { DebugToolbarOverlayWidget } from './view/configuration/debug-toolbar.view';
|
|
35
|
+
import { DebugConsoleModelService } from './view/console/debug-console-tree.model.service';
|
|
36
|
+
import { DebugConsoleContribution } from './view/console/debug-console.contribution';
|
|
37
|
+
import { DebugCallStackContribution } from './view/frames/debug-call-stack.contribution';
|
|
38
|
+
import { VariablesPanelContribution } from './view/variables/debug-variables.contribution';
|
|
39
|
+
import { WatchPanelContribution } from './view/watch/debug-watch.contribution';
|
|
40
|
+
|
|
41
|
+
import './debug-style.less';
|
|
42
|
+
|
|
43
|
+
@Injectable()
|
|
44
|
+
export class DebugModule extends BrowserModule {
|
|
45
|
+
providers: Provider[] = [
|
|
46
|
+
{
|
|
47
|
+
token: DebugHoverSource,
|
|
48
|
+
useClass: DebugHoverSource,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
token: DebugExpressionProvider,
|
|
52
|
+
useClass: DebugExpressionProvider,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
token: IDebugModelManager,
|
|
56
|
+
useClass: DebugModelManager,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
token: IDebugSessionManager,
|
|
60
|
+
useClass: DebugSessionManager,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
token: BreakpointManager,
|
|
64
|
+
useClass: BreakpointManager,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
token: DebugConfigurationManager,
|
|
68
|
+
useClass: DebugConfigurationManager,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
token: IEvaluatableExpressionService,
|
|
72
|
+
useClass: EvaluatableExpressionServiceImpl,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
token: FolderPreferenceProvider,
|
|
76
|
+
useClass: LaunchFolderPreferenceProvider,
|
|
77
|
+
dropdownForTag: true,
|
|
78
|
+
tag: 'launch',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
token: DebugModelFactory,
|
|
82
|
+
useFactory: (injector: Injector) => (editor: DebugEditor) => DebugModel.createModel(injector, editor),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
token: DebugSessionContributionRegistry,
|
|
86
|
+
useClass: DebugSessionContributionRegistryImpl,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
token: IDebugService,
|
|
90
|
+
useClass: DebugService,
|
|
91
|
+
},
|
|
92
|
+
// 这里原本的实现意图就是Debug作为单独模块执行时使用Node作为调试进程的启动及连接逻辑
|
|
93
|
+
// 在当前调试依赖插件进程的前提下,没必要引入这块冗余代码带来混淆
|
|
94
|
+
// packages/extension/src/browser/index.ts#L30
|
|
95
|
+
{
|
|
96
|
+
token: IDebugServer,
|
|
97
|
+
useValue: {},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
token: IDebugProgress,
|
|
101
|
+
useClass: DebugProgressService,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
token: IDebugConsoleModelService,
|
|
105
|
+
useClass: DebugConsoleModelService,
|
|
106
|
+
},
|
|
107
|
+
// contributions
|
|
108
|
+
LaunchPreferencesContribution,
|
|
109
|
+
DebugContribution,
|
|
110
|
+
DebugConsoleContribution,
|
|
111
|
+
VariablesPanelContribution,
|
|
112
|
+
DebugCallStackContribution,
|
|
113
|
+
WatchPanelContribution,
|
|
114
|
+
// contextkeys
|
|
115
|
+
{
|
|
116
|
+
token: DebugCallStackItemTypeKey,
|
|
117
|
+
useFactory: (injector: Injector) => injector.get(IContextKeyService).createKey('callStackItemType'),
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
contributionProvider = DebugSessionContribution;
|
|
122
|
+
|
|
123
|
+
preferences = injectDebugPreferences;
|
|
124
|
+
|
|
125
|
+
isOverlay = true;
|
|
126
|
+
component = DebugToolbarOverlayWidget;
|
|
127
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/** ******************************************************************************
|
|
2
|
+
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
// Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/markers/src/browser/marker-manager.ts
|
|
17
|
+
|
|
18
|
+
import { Injectable, Autowired } from '@opensumi/di';
|
|
19
|
+
import { Event, Emitter, URI } from '@opensumi/ide-core-browser';
|
|
20
|
+
import { FileChangeEvent, FileChangeType } from '@opensumi/ide-file-service';
|
|
21
|
+
import { IFileServiceClient } from '@opensumi/ide-file-service';
|
|
22
|
+
|
|
23
|
+
import { Marker } from './marker';
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* findMarkers方法的参数
|
|
27
|
+
*/
|
|
28
|
+
export interface SearchFilter<D> {
|
|
29
|
+
uri?: URI;
|
|
30
|
+
owner?: string;
|
|
31
|
+
dataFilter?: (data: D) => boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class MarkerCollection<T> {
|
|
35
|
+
protected readonly owner2Markers = new Map<string, Readonly<Marker<T>>[]>();
|
|
36
|
+
|
|
37
|
+
constructor(public readonly uri: URI, public readonly kind: string) {}
|
|
38
|
+
|
|
39
|
+
get empty(): boolean {
|
|
40
|
+
return !this.owner2Markers.size;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getOwners(): string[] {
|
|
44
|
+
return Array.from(this.owner2Markers.keys());
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getMarkers(owner: string): Readonly<Marker<T>>[] {
|
|
48
|
+
return this.owner2Markers.get(owner) || [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setMarkers(owner: string, markerData: T[]): Marker<T>[] {
|
|
52
|
+
const before = this.owner2Markers.get(owner);
|
|
53
|
+
if (markerData.length > 0) {
|
|
54
|
+
this.owner2Markers.set(
|
|
55
|
+
owner,
|
|
56
|
+
markerData.map((data) => this.createMarker(owner, data)),
|
|
57
|
+
);
|
|
58
|
+
} else {
|
|
59
|
+
this.owner2Markers.delete(owner);
|
|
60
|
+
}
|
|
61
|
+
return before || [];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected createMarker(owner: string, data: T): Readonly<Marker<T>> {
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
uri: this.uri.toString(),
|
|
67
|
+
kind: this.kind,
|
|
68
|
+
owner,
|
|
69
|
+
data,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
findMarkers(filter: SearchFilter<T>): Marker<T>[] {
|
|
74
|
+
if (filter.owner) {
|
|
75
|
+
if (this.owner2Markers.has(filter.owner)) {
|
|
76
|
+
return this.filterMarkers(filter, this.owner2Markers.get(filter.owner));
|
|
77
|
+
}
|
|
78
|
+
return [];
|
|
79
|
+
} else {
|
|
80
|
+
const result: Marker<T>[] = [];
|
|
81
|
+
for (const markers of this.owner2Markers.values()) {
|
|
82
|
+
result.push(...this.filterMarkers(filter, markers));
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
protected filterMarkers(filter: SearchFilter<T>, toFilter?: Marker<T>[]) {
|
|
89
|
+
if (!toFilter) {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
if (filter.dataFilter) {
|
|
93
|
+
return toFilter.filter((d) => filter.dataFilter!(d.data));
|
|
94
|
+
} else {
|
|
95
|
+
return toFilter;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Uri2MarkerEntry {
|
|
101
|
+
uri: string;
|
|
102
|
+
markers: Owner2MarkerEntry[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface Owner2MarkerEntry {
|
|
106
|
+
owner: string;
|
|
107
|
+
markerData: object[];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@Injectable()
|
|
111
|
+
export abstract class MarkerManager<D extends object> {
|
|
112
|
+
public abstract getKind(): string;
|
|
113
|
+
|
|
114
|
+
protected readonly uri2MarkerCollection = new Map<string, MarkerCollection<D>>();
|
|
115
|
+
protected readonly onDidChangeMarkersEmitter = new Emitter<URI>();
|
|
116
|
+
|
|
117
|
+
@Autowired(IFileServiceClient) protected fileService: IFileServiceClient;
|
|
118
|
+
|
|
119
|
+
constructor() {
|
|
120
|
+
this.init();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
protected init(): void {
|
|
124
|
+
this.fileService.onFilesChanged((event) => {
|
|
125
|
+
const relevantEvent = event.filter(({ type }) => type === FileChangeType.DELETED);
|
|
126
|
+
if (relevantEvent.length) {
|
|
127
|
+
this.cleanMarkers(relevantEvent);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
protected cleanMarkers(event: FileChangeEvent): void {
|
|
133
|
+
for (const uriString of this.uri2MarkerCollection.keys()) {
|
|
134
|
+
const uri = new URI(uriString);
|
|
135
|
+
if (FileChangeEvent.isDeleted(event, uri)) {
|
|
136
|
+
this.cleanAllMarkers(uri);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get onDidChangeMarkers(): Event<URI> {
|
|
142
|
+
return this.onDidChangeMarkersEmitter.event;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
protected fireOnDidChangeMarkers(uri: URI): void {
|
|
146
|
+
this.onDidChangeMarkersEmitter.fire(uri);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
* 替换遮罩元素属性
|
|
151
|
+
*/
|
|
152
|
+
setMarkers(uri: URI, owner: string, data: D[]): Marker<D>[] {
|
|
153
|
+
const uriString = uri.toString();
|
|
154
|
+
const collection = this.uri2MarkerCollection.get(uriString) || new MarkerCollection<D>(uri, this.getKind());
|
|
155
|
+
const oldMarkers = collection.setMarkers(owner, data);
|
|
156
|
+
if (collection.empty) {
|
|
157
|
+
this.uri2MarkerCollection.delete(uri.toString());
|
|
158
|
+
} else {
|
|
159
|
+
this.uri2MarkerCollection.set(uriString, collection);
|
|
160
|
+
}
|
|
161
|
+
this.fireOnDidChangeMarkers(uri);
|
|
162
|
+
return oldMarkers;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/*
|
|
166
|
+
* 根据filter函数返回所有断点
|
|
167
|
+
*/
|
|
168
|
+
findMarkers(filter: SearchFilter<D> = {}): Marker<D>[] {
|
|
169
|
+
if (filter.uri) {
|
|
170
|
+
const collection = this.uri2MarkerCollection.get(filter.uri.toString());
|
|
171
|
+
return collection ? collection.findMarkers(filter) : [];
|
|
172
|
+
}
|
|
173
|
+
const result: Marker<D>[] = [];
|
|
174
|
+
for (const uri of this.getUris()) {
|
|
175
|
+
result.push(...this.uri2MarkerCollection.get(uri)!.findMarkers(filter));
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
getUris(): IterableIterator<string> {
|
|
181
|
+
return this.uri2MarkerCollection.keys();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
cleanAllMarkers(uri?: URI): void {
|
|
185
|
+
if (uri) {
|
|
186
|
+
this.doCleanAllMarkers(uri);
|
|
187
|
+
} else {
|
|
188
|
+
for (const uriString of this.getUris()) {
|
|
189
|
+
this.doCleanAllMarkers(new URI(uriString));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
protected doCleanAllMarkers(uri: URI): void {
|
|
194
|
+
const uriString = uri.toString();
|
|
195
|
+
const collection = this.uri2MarkerCollection.get(uriString);
|
|
196
|
+
if (collection !== undefined) {
|
|
197
|
+
this.uri2MarkerCollection.delete(uriString);
|
|
198
|
+
this.fireOnDidChangeMarkers(uri);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|