@opensumi/ide-debug 2.21.6 → 2.21.7-next-1670485458.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-session.d.ts.map +1 -1
- package/lib/browser/debug-session.js +5 -1
- package/lib/browser/debug-session.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +2 -9
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/preferences/launch-folder-preference-provider.d.ts +2 -2
- package/lib/browser/preferences/launch-folder-preference-provider.d.ts.map +1 -1
- package/lib/browser/preferences/launch-folder-preference-provider.js +2 -2
- package/lib/browser/preferences/launch-folder-preference-provider.js.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.module.less +5 -5
- package/lib/browser/view/configuration/debug-configuration.view.d.ts.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.view.js +1 -1
- package/lib/browser/view/configuration/debug-configuration.view.js.map +1 -1
- package/lib/browser/view/configuration/debug-toolbar.view.js +2 -2
- package/lib/browser/view/configuration/debug-toolbar.view.js.map +1 -1
- package/lib/browser/view/console/debug-console.module.less +2 -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-session.view.d.ts.map +1 -1
- package/lib/browser/view/frames/debug-call-stack-session.view.js +16 -13
- package/lib/browser/view/frames/debug-call-stack-session.view.js.map +1 -1
- package/lib/browser/view/variables/debug-variables.module.less +2 -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.module.less +2 -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/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 +904 -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 +1182 -0
- package/src/browser/debug-style.less +128 -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 +31 -0
- package/src/browser/editor/debug-editor-contribution.ts +590 -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 +220 -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 +121 -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 +130 -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 +217 -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 +252 -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 +164 -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 +181 -0
- package/src/browser/view/console/debug-console.module.less +373 -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 +244 -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 +244 -0
- package/src/browser/view/variables/debug-variables.module.less +149 -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 +167 -0
- package/src/browser/view/watch/debug-watch.module.less +189 -0
- package/src/browser/view/watch/debug-watch.view.tsx +337 -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-editor.ts +4 -0
- package/src/common/debug-hover.ts +31 -0
- package/src/common/debug-model.ts +247 -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 +14 -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,200 @@
|
|
|
1
|
+
import { CancellationToken, Event, IDisposable } from '@opensumi/ide-core-common';
|
|
2
|
+
import { DebugProtocol } from '@opensumi/vscode-debugprotocol';
|
|
3
|
+
|
|
4
|
+
import { DebugConfiguration } from './debug-configuration';
|
|
5
|
+
import { DebugSessionOptions, IDebugSessionDTO } from './debug-session-options';
|
|
6
|
+
|
|
7
|
+
export interface IDebugExceptionInfo {
|
|
8
|
+
readonly id?: string;
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
readonly breakMode: string | null;
|
|
11
|
+
readonly details?: DebugProtocol.ExceptionDetails;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum DebugState {
|
|
15
|
+
Inactive,
|
|
16
|
+
Initializing,
|
|
17
|
+
Running,
|
|
18
|
+
Stopped,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type IDebugSessionReplMode = 'separate' | 'mergeWithParent';
|
|
22
|
+
|
|
23
|
+
export interface IDebugSessionOptions {
|
|
24
|
+
noDebug?: boolean;
|
|
25
|
+
parentSession?: IDebugSession;
|
|
26
|
+
lifecycleManagedByParent?: boolean;
|
|
27
|
+
repl?: IDebugSessionReplMode;
|
|
28
|
+
compact?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const IDebugSession = Symbol('DebugSession');
|
|
32
|
+
|
|
33
|
+
export const IDebugSessionManager = Symbol('DebugSessionManager');
|
|
34
|
+
export interface IDebugSessionManager {
|
|
35
|
+
fireWillStartDebugSession(): Promise<void>;
|
|
36
|
+
resolveConfiguration(options: Readonly<DebugSessionOptions>): Promise<IDebugSessionDTO | undefined>;
|
|
37
|
+
resolveDebugConfiguration(
|
|
38
|
+
configuration: DebugConfiguration,
|
|
39
|
+
workspaceFolderUri: string | undefined,
|
|
40
|
+
): Promise<DebugConfiguration | undefined | null>;
|
|
41
|
+
fireWillResolveDebugConfiguration(debugType: string): Promise<void>;
|
|
42
|
+
report(name: string, msg: string | undefined, extra?: any): void;
|
|
43
|
+
reportTime(name: string, defaults?: any): (msg: string | undefined, extra?: any) => number;
|
|
44
|
+
reportAction(sessionId: string, threadId: number | string | undefined, action: string): void;
|
|
45
|
+
getExtra(sessionId: string | undefined, threadId: number | string | undefined): DebugThreadExtra | undefined;
|
|
46
|
+
setExtra(sessionId: string, threadId: string, extra?: DebugThreadExtra);
|
|
47
|
+
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IDebugSession extends IDisposable {
|
|
52
|
+
state: DebugState;
|
|
53
|
+
parentSession: IDebugSession | undefined;
|
|
54
|
+
id: string;
|
|
55
|
+
capabilities: DebugProtocol.Capabilities;
|
|
56
|
+
onDidInvalidateMemory: Event<DebugProtocol.MemoryEvent>;
|
|
57
|
+
readMemory(
|
|
58
|
+
memoryReference: string,
|
|
59
|
+
offset: number,
|
|
60
|
+
count: number,
|
|
61
|
+
): Promise<DebugProtocol.ReadMemoryResponse | undefined>;
|
|
62
|
+
writeMemory(
|
|
63
|
+
memoryReference: string,
|
|
64
|
+
offset: number,
|
|
65
|
+
data: string,
|
|
66
|
+
allowPartial?: boolean | undefined,
|
|
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(): Promise<boolean>;
|
|
78
|
+
disconnect(restart?: boolean | undefined): Promise<void>;
|
|
79
|
+
terminate(restart?: boolean | undefined): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 埋点专用的额外数据
|
|
84
|
+
*/
|
|
85
|
+
export interface DebugBaseExtra {
|
|
86
|
+
/**
|
|
87
|
+
* adapterID 区分语言
|
|
88
|
+
*/
|
|
89
|
+
adapterID: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* request 区分 attach 或 launch
|
|
93
|
+
*/
|
|
94
|
+
request: 'attach' | 'launch';
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 跟 sessionId 一一对应,先于 sessionId 生成,可以跟踪初始化时的事件
|
|
98
|
+
*/
|
|
99
|
+
traceId: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 是否为远程调试
|
|
103
|
+
* 0: 非远程
|
|
104
|
+
* 1: 远程
|
|
105
|
+
*/
|
|
106
|
+
remote: 0 | 1;
|
|
107
|
+
}
|
|
108
|
+
export interface DebugSessionExtra extends DebugBaseExtra {
|
|
109
|
+
threads: Map<string, DebugThreadExtra>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface DebugThreadExtra extends DebugBaseExtra {
|
|
113
|
+
threadId?: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 当前的用户操作
|
|
117
|
+
*/
|
|
118
|
+
action?: string;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 文件所在的路径和行号
|
|
122
|
+
*/
|
|
123
|
+
filePath?: string;
|
|
124
|
+
fileLineNumber?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let DEBUG_SESSION_SEQUENCE_ID = 1;
|
|
128
|
+
|
|
129
|
+
export function getSequenceId() {
|
|
130
|
+
// 获取递增的请求 ID
|
|
131
|
+
return DEBUG_SESSION_SEQUENCE_ID++;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface DebugExitEvent {
|
|
135
|
+
code?: number;
|
|
136
|
+
reason?: string | Error;
|
|
137
|
+
}
|
|
138
|
+
export interface DebugRequestTypes {
|
|
139
|
+
attach: [DebugProtocol.AttachRequestArguments, DebugProtocol.AttachResponse];
|
|
140
|
+
breakpointLocations: [DebugProtocol.BreakpointLocationsArguments, DebugProtocol.BreakpointLocationsResponse];
|
|
141
|
+
completions: [DebugProtocol.CompletionsArguments, DebugProtocol.CompletionsResponse];
|
|
142
|
+
configurationDone: [DebugProtocol.ConfigurationDoneArguments, DebugProtocol.ConfigurationDoneResponse];
|
|
143
|
+
continue: [DebugProtocol.ContinueArguments, DebugProtocol.ContinueResponse];
|
|
144
|
+
disconnect: [DebugProtocol.DisconnectArguments, DebugProtocol.DisconnectResponse];
|
|
145
|
+
evaluate: [DebugProtocol.EvaluateArguments, DebugProtocol.EvaluateResponse];
|
|
146
|
+
exceptionInfo: [DebugProtocol.ExceptionInfoArguments, DebugProtocol.ExceptionInfoResponse];
|
|
147
|
+
goto: [DebugProtocol.GotoArguments, DebugProtocol.GotoResponse];
|
|
148
|
+
gotoTargets: [DebugProtocol.GotoTargetsArguments, DebugProtocol.GotoTargetsResponse];
|
|
149
|
+
initialize: [DebugProtocol.InitializeRequestArguments, DebugProtocol.InitializeResponse];
|
|
150
|
+
launch: [DebugProtocol.LaunchRequestArguments, DebugProtocol.LaunchResponse];
|
|
151
|
+
loadedSources: [DebugProtocol.LoadedSourcesArguments, DebugProtocol.LoadedSourcesResponse];
|
|
152
|
+
modules: [DebugProtocol.ModulesArguments, DebugProtocol.ModulesResponse];
|
|
153
|
+
next: [DebugProtocol.NextArguments, DebugProtocol.NextResponse];
|
|
154
|
+
pause: [DebugProtocol.PauseArguments, DebugProtocol.PauseResponse];
|
|
155
|
+
restart: [DebugProtocol.RestartArguments, DebugProtocol.RestartResponse];
|
|
156
|
+
restartFrame: [DebugProtocol.RestartFrameArguments, DebugProtocol.RestartFrameResponse];
|
|
157
|
+
reverseContinue: [DebugProtocol.ReverseContinueArguments, DebugProtocol.ReverseContinueResponse];
|
|
158
|
+
scopes: [DebugProtocol.ScopesArguments, DebugProtocol.ScopesResponse];
|
|
159
|
+
setBreakpoints: [DebugProtocol.SetBreakpointsArguments, DebugProtocol.SetBreakpointsResponse];
|
|
160
|
+
setExceptionBreakpoints: [
|
|
161
|
+
DebugProtocol.SetExceptionBreakpointsArguments,
|
|
162
|
+
DebugProtocol.SetExceptionBreakpointsResponse,
|
|
163
|
+
];
|
|
164
|
+
setExpression: [DebugProtocol.SetExpressionArguments, DebugProtocol.SetExpressionResponse];
|
|
165
|
+
setFunctionBreakpoints: [DebugProtocol.SetFunctionBreakpointsArguments, DebugProtocol.SetFunctionBreakpointsResponse];
|
|
166
|
+
setVariable: [DebugProtocol.SetVariableArguments, DebugProtocol.SetVariableResponse];
|
|
167
|
+
source: [DebugProtocol.SourceArguments, DebugProtocol.SourceResponse];
|
|
168
|
+
stackTrace: [DebugProtocol.StackTraceArguments, DebugProtocol.StackTraceResponse];
|
|
169
|
+
stepBack: [DebugProtocol.StepBackArguments, DebugProtocol.StepBackResponse];
|
|
170
|
+
stepIn: [DebugProtocol.StepInArguments, DebugProtocol.StepInResponse];
|
|
171
|
+
stepInTargets: [DebugProtocol.StepInTargetsArguments, DebugProtocol.StepInTargetsResponse];
|
|
172
|
+
stepOut: [DebugProtocol.StepOutArguments, DebugProtocol.StepOutResponse];
|
|
173
|
+
terminate: [DebugProtocol.TerminateArguments, DebugProtocol.TerminateResponse];
|
|
174
|
+
terminateThreads: [DebugProtocol.TerminateThreadsArguments, DebugProtocol.TerminateThreadsResponse];
|
|
175
|
+
threads: [DebugProtocol.ThreadsArguments | null, DebugProtocol.ThreadsResponse];
|
|
176
|
+
variables: [DebugProtocol.VariablesArguments, DebugProtocol.VariablesResponse];
|
|
177
|
+
cancel: [DebugProtocol.CancelArguments, DebugProtocol.CancelResponse];
|
|
178
|
+
readMemory: [DebugProtocol.ReadMemoryArguments, DebugProtocol.ReadMemoryResponse];
|
|
179
|
+
writeMemory: [DebugProtocol.WriteMemoryArguments, DebugProtocol.WriteMemoryResponse];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface DebugEventTypes {
|
|
183
|
+
breakpoint: DebugProtocol.BreakpointEvent;
|
|
184
|
+
capabilities: DebugProtocol.CapabilitiesEvent;
|
|
185
|
+
continued: DebugProtocol.ContinuedEvent;
|
|
186
|
+
exited: DebugExitEvent;
|
|
187
|
+
initialized: DebugProtocol.InitializedEvent;
|
|
188
|
+
loadedSource: DebugProtocol.LoadedSourceEvent;
|
|
189
|
+
module: DebugProtocol.ModuleEvent;
|
|
190
|
+
output: DebugProtocol.OutputEvent;
|
|
191
|
+
process: DebugProtocol.ProcessEvent;
|
|
192
|
+
stopped: DebugProtocol.StoppedEvent;
|
|
193
|
+
terminated: DebugProtocol.TerminatedEvent;
|
|
194
|
+
thread: DebugProtocol.ThreadEvent;
|
|
195
|
+
progressStart: DebugProtocol.ProgressStartEvent;
|
|
196
|
+
progressUpdate: DebugProtocol.ProgressUpdateEvent;
|
|
197
|
+
progressEnd: DebugProtocol.ProgressEndEvent;
|
|
198
|
+
memory: DebugProtocol.MemoryEvent;
|
|
199
|
+
invalidated: DebugProtocol.InvalidatedEvent;
|
|
200
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CancellationToken } from '@opensumi/ide-core-common';
|
|
2
|
+
import { IRange, Position } from '@opensumi/ide-core-common/lib/types';
|
|
3
|
+
import type { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An evaluatable expression represents additional information for an expression in a document. Evaluatable expressions are
|
|
7
|
+
* evaluated by a debugger or runtime and their result is rendered in a tooltip-like widget.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface IEvaluatableExpression {
|
|
11
|
+
/**
|
|
12
|
+
* The range to which this expression applies.
|
|
13
|
+
*/
|
|
14
|
+
range: IRange;
|
|
15
|
+
/**
|
|
16
|
+
* This expression overrides the expression extracted from the range.
|
|
17
|
+
*/
|
|
18
|
+
expression?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The evaluatable expression provider interface defines the contract between extensions and
|
|
23
|
+
* the debug hover. In this contract the provider returns an evaluatable expression for a given position
|
|
24
|
+
* in a document and VS Code evaluates this expression in the active debug session and shows the result in a debug hover.
|
|
25
|
+
*/
|
|
26
|
+
export interface EvaluatableExpressionProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Provide an evaluatable expression for the given document and position.
|
|
29
|
+
* VS Code will evaluate this expression in the active debug session and will show the result in the debug hover.
|
|
30
|
+
* The expression can be implicitly specified by the range in the underlying document or by explicitly returning an expression.
|
|
31
|
+
*
|
|
32
|
+
* @param document The document for which the debug hover is about to appear.
|
|
33
|
+
* @param position The line and character position in the document where the debug hover is about to appear.
|
|
34
|
+
* @param token A cancellation token.
|
|
35
|
+
* @return An EvaluatableExpression or a thenable that resolves to such. The lack of a result can be
|
|
36
|
+
* signaled by returning `undefined` or `null`.
|
|
37
|
+
*/
|
|
38
|
+
provideEvaluatableExpression(
|
|
39
|
+
document: ITextModel,
|
|
40
|
+
position: Position,
|
|
41
|
+
token: CancellationToken,
|
|
42
|
+
): PromiseLike<IEvaluatableExpression | undefined>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './debug-configuration';
|
|
2
|
+
export * from './debug-service';
|
|
3
|
+
export * from './debug-hover';
|
|
4
|
+
export * from './debug-breakpoint';
|
|
5
|
+
export * from './debug-model';
|
|
6
|
+
export * from './debug-session';
|
|
7
|
+
export * from './debug-session-options';
|
|
8
|
+
export * from './debug-editor';
|
|
9
|
+
export * from './debug-progress';
|
|
10
|
+
export * from './debug-schema-updater';
|
|
11
|
+
export * from './inline-values';
|
|
12
|
+
export * from './types';
|
|
13
|
+
export * from './constants';
|
|
14
|
+
export * from './terminal';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { IRange, CancellationToken, Event } from '@opensumi/ide-core-common';
|
|
2
|
+
import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range';
|
|
3
|
+
import { ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model';
|
|
4
|
+
|
|
5
|
+
// Inline Values
|
|
6
|
+
/**
|
|
7
|
+
* A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface InlineValueContext {
|
|
11
|
+
frameId: number;
|
|
12
|
+
stoppedLocation: Range;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Provide inline value as text.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export interface InlineValueText {
|
|
20
|
+
type: 'text';
|
|
21
|
+
range: IRange;
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provide inline value through a variable lookup.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export interface InlineValueVariableLookup {
|
|
30
|
+
type: 'variable';
|
|
31
|
+
range: IRange;
|
|
32
|
+
variableName?: string;
|
|
33
|
+
caseSensitiveLookup: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Provide inline value through an expression evaluation.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export interface InlineValueExpression {
|
|
41
|
+
type: 'expression';
|
|
42
|
+
range: IRange;
|
|
43
|
+
expression?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Inline value information can be provided by different means:
|
|
48
|
+
* - directly as a text value (class InlineValueText).
|
|
49
|
+
* - as a name to use for a variable lookup (class InlineValueVariableLookup)
|
|
50
|
+
* - as an evaluatable expression (class InlineValueEvaluatableExpression)
|
|
51
|
+
* The InlineValue types combines all inline value types into one type.
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueExpression;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The inline values provider interface defines the contract between extensions and
|
|
58
|
+
* the debugger's inline values feature.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export interface InlineValuesProvider {
|
|
62
|
+
/**
|
|
63
|
+
*/
|
|
64
|
+
onDidChangeInlineValues?: Event<void> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Provide the "inline values" for the given range and document. Multiple hovers at the same
|
|
67
|
+
* position will be merged by the editor. A hover can have a range which defaults
|
|
68
|
+
* to the word range at the position when omitted.
|
|
69
|
+
*/
|
|
70
|
+
provideInlineValues(
|
|
71
|
+
model: ITextModel,
|
|
72
|
+
viewPort: Range,
|
|
73
|
+
context: InlineValueContext,
|
|
74
|
+
token: CancellationToken,
|
|
75
|
+
): Thenable<InlineValue[]>;
|
|
76
|
+
}
|
|
77
|
+
// End Inline Values
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/* eslint-disable guard-for-in */
|
|
2
|
+
import { CharCode, isWindows } from '@opensumi/ide-core-common';
|
|
3
|
+
|
|
4
|
+
const enum ShellType {
|
|
5
|
+
cmd,
|
|
6
|
+
powershell,
|
|
7
|
+
bash,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function isWindowsDriveLetter(char0: number): boolean {
|
|
11
|
+
return (char0 >= CharCode.A && char0 <= CharCode.Z) || (char0 >= CharCode.a && char0 <= CharCode.z);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function hasDriveLetter(path: string, isWindowsOS: boolean = isWindows): boolean {
|
|
15
|
+
if (isWindowsOS) {
|
|
16
|
+
return isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === CharCode.Colon;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getDriveLetter(path: string): string | undefined {
|
|
23
|
+
return hasDriveLetter(path) ? path[0] : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function prepareCommand(
|
|
27
|
+
shell: string,
|
|
28
|
+
args: string[],
|
|
29
|
+
argsCanBeInterpretedByShell: boolean,
|
|
30
|
+
cwd?: string,
|
|
31
|
+
env?: { [key: string]: string | null },
|
|
32
|
+
): string {
|
|
33
|
+
shell = shell.trim().toLowerCase();
|
|
34
|
+
|
|
35
|
+
// try to determine the shell type
|
|
36
|
+
let shellType;
|
|
37
|
+
if (shell.indexOf('powershell') >= 0 || shell.indexOf('pwsh') >= 0) {
|
|
38
|
+
shellType = ShellType.powershell;
|
|
39
|
+
} else if (shell.indexOf('cmd.exe') >= 0) {
|
|
40
|
+
shellType = ShellType.cmd;
|
|
41
|
+
} else if (shell.indexOf('bash') >= 0) {
|
|
42
|
+
shellType = ShellType.bash;
|
|
43
|
+
} else if (isWindows) {
|
|
44
|
+
shellType = ShellType.cmd; // pick a good default for Windows
|
|
45
|
+
} else {
|
|
46
|
+
shellType = ShellType.bash; // pick a good default for anything else
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let quote: (s: string) => string;
|
|
50
|
+
// begin command with a space to avoid polluting shell history
|
|
51
|
+
let command = ' ';
|
|
52
|
+
|
|
53
|
+
switch (shellType) {
|
|
54
|
+
case ShellType.powershell:
|
|
55
|
+
quote = (s: string) => {
|
|
56
|
+
s = s.replace(/'/g, "''");
|
|
57
|
+
if (s.length > 0 && s.charAt(s.length - 1) === '\\') {
|
|
58
|
+
return `'${s}\\'`;
|
|
59
|
+
}
|
|
60
|
+
return `'${s}'`;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (cwd) {
|
|
64
|
+
const driveLetter = getDriveLetter(cwd);
|
|
65
|
+
if (driveLetter) {
|
|
66
|
+
command += `${driveLetter}:; `;
|
|
67
|
+
}
|
|
68
|
+
command += `cd ${quote(cwd)}; `;
|
|
69
|
+
}
|
|
70
|
+
if (env) {
|
|
71
|
+
for (const key in env) {
|
|
72
|
+
const value = env[key];
|
|
73
|
+
if (value === null) {
|
|
74
|
+
command += `Remove-Item env:${key}; `;
|
|
75
|
+
} else {
|
|
76
|
+
command += `\${env:${key}}='${value}'; `;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (args.length > 0) {
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
|
+
const arg = args.shift()!;
|
|
83
|
+
const cmd = argsCanBeInterpretedByShell ? arg : quote(arg);
|
|
84
|
+
command += cmd[0] === "'" ? `& ${cmd} ` : `${cmd} `;
|
|
85
|
+
for (const a of args) {
|
|
86
|
+
command += a === '<' || a === '>' || argsCanBeInterpretedByShell ? a : quote(a);
|
|
87
|
+
command += ' ';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
|
|
92
|
+
case ShellType.cmd:
|
|
93
|
+
quote = (s: string) => {
|
|
94
|
+
// Note: Wrapping in cmd /C "..." complicates the escaping.
|
|
95
|
+
// cmd /C "node -e "console.log(process.argv)" """A^>0"""" # prints "A>0"
|
|
96
|
+
// cmd /C "node -e "console.log(process.argv)" "foo^> bar"" # prints foo> bar
|
|
97
|
+
// Outside of the cmd /C, it could be a simple quoting, but here, the ^ is needed too
|
|
98
|
+
s = s.replace(/"/g, '""');
|
|
99
|
+
s = s.replace(/([><!^&|])/g, '^$1');
|
|
100
|
+
return ' "'.split('').some((char) => s.includes(char)) || s.length === 0 ? `"${s}"` : s;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
if (cwd) {
|
|
104
|
+
const driveLetter = getDriveLetter(cwd);
|
|
105
|
+
if (driveLetter) {
|
|
106
|
+
command += `${driveLetter}: && `;
|
|
107
|
+
}
|
|
108
|
+
command += `cd ${quote(cwd)} && `;
|
|
109
|
+
}
|
|
110
|
+
if (env) {
|
|
111
|
+
command += 'cmd /C "';
|
|
112
|
+
for (const key in env) {
|
|
113
|
+
let value = env[key];
|
|
114
|
+
if (value === null) {
|
|
115
|
+
command += `set "${key}=" && `;
|
|
116
|
+
} else {
|
|
117
|
+
value = value.replace(/[&^|<>]/g, (s) => `^${s}`);
|
|
118
|
+
command += `set "${key}=${value}" && `;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (const a of args) {
|
|
123
|
+
command += a === '<' || a === '>' || argsCanBeInterpretedByShell ? a : quote(a);
|
|
124
|
+
command += ' ';
|
|
125
|
+
}
|
|
126
|
+
if (env) {
|
|
127
|
+
command += '"';
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case ShellType.bash: {
|
|
132
|
+
quote = (s: string) => {
|
|
133
|
+
s = s.replace(/(["'\\$!><#()[\]*&^| ;{}`])/g, '\\$1');
|
|
134
|
+
return s.length === 0 ? '""' : s;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const hardQuote = (s: string) => (/[^\w@%/+=,.:^-]/.test(s) ? `'${s.replace(/'/g, "'\\''")}'` : s);
|
|
138
|
+
|
|
139
|
+
if (cwd) {
|
|
140
|
+
command += `cd ${quote(cwd)} ; `;
|
|
141
|
+
}
|
|
142
|
+
if (env) {
|
|
143
|
+
command += '/usr/bin/env';
|
|
144
|
+
for (const key in env) {
|
|
145
|
+
const value = env[key];
|
|
146
|
+
if (value === null) {
|
|
147
|
+
command += ` -u ${hardQuote(key)}`;
|
|
148
|
+
} else {
|
|
149
|
+
command += ` ${hardQuote(`${key}=${value}`)}`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
command += ' ';
|
|
153
|
+
}
|
|
154
|
+
for (const a of args) {
|
|
155
|
+
command += a === '<' || a === '>' || argsCanBeInterpretedByShell ? a : quote(a);
|
|
156
|
+
command += ' ';
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return command;
|
|
163
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { IJSONSchemaSnippet } from '@opensumi/ide-core-common';
|
|
2
|
+
|
|
3
|
+
export interface CallStackContext {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
threadId: string;
|
|
6
|
+
frameId: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface IPlatformSpecificAdapterContribution {
|
|
10
|
+
program?: string;
|
|
11
|
+
args?: string[];
|
|
12
|
+
runtime?: string;
|
|
13
|
+
runtimeArgs?: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IDebuggerContribution extends IPlatformSpecificAdapterContribution {
|
|
17
|
+
type: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
// debug adapter executable
|
|
20
|
+
adapterExecutableCommand?: string;
|
|
21
|
+
win?: IPlatformSpecificAdapterContribution;
|
|
22
|
+
winx86?: IPlatformSpecificAdapterContribution;
|
|
23
|
+
windows?: IPlatformSpecificAdapterContribution;
|
|
24
|
+
osx?: IPlatformSpecificAdapterContribution;
|
|
25
|
+
linux?: IPlatformSpecificAdapterContribution;
|
|
26
|
+
|
|
27
|
+
// internal
|
|
28
|
+
aiKey?: string;
|
|
29
|
+
|
|
30
|
+
// supported languages
|
|
31
|
+
languages?: string[];
|
|
32
|
+
enableBreakpointsFor?: { languageIds: string[] };
|
|
33
|
+
|
|
34
|
+
// debug configuration support
|
|
35
|
+
configurationAttributes?: any;
|
|
36
|
+
initialConfigurations?: any[];
|
|
37
|
+
configurationSnippets?: IJSONSchemaSnippet[];
|
|
38
|
+
variables?: { [key: string]: string };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export enum DEBUG_REPORT_NAME {
|
|
42
|
+
/**
|
|
43
|
+
* 启动调试响应耗时
|
|
44
|
+
*/
|
|
45
|
+
DEBUG_SESSION_START_TIME = 'debugSessionStartTime',
|
|
46
|
+
/**
|
|
47
|
+
* preLaunchTask 耗时
|
|
48
|
+
*/
|
|
49
|
+
DEBUG_PRE_LAUNCH_TASK_TIME = 'debugPreLaunchTaskTime',
|
|
50
|
+
/**
|
|
51
|
+
* 工具栏各操作响应耗时
|
|
52
|
+
*/
|
|
53
|
+
DEBUG_TOOLBAR_OPERATION_TIME = 'debugToolBarOperationTime',
|
|
54
|
+
/**
|
|
55
|
+
* 工具栏各操作点击
|
|
56
|
+
*/
|
|
57
|
+
DEBUG_TOOLBAR_OPERATION = 'debugToolBarOperation',
|
|
58
|
+
/**
|
|
59
|
+
* 左侧所有面板展开收起点击
|
|
60
|
+
*/
|
|
61
|
+
DEBUG_PANEL_OPERATION_FOLDEXPR = 'debugPanelOperationFoldexpr',
|
|
62
|
+
/**
|
|
63
|
+
* 监听
|
|
64
|
+
*/
|
|
65
|
+
DEBUG_WATCH = 'debugWatch',
|
|
66
|
+
/**
|
|
67
|
+
* 变量
|
|
68
|
+
*/
|
|
69
|
+
DEBUG_VARIABLES = 'debugVariables',
|
|
70
|
+
/**
|
|
71
|
+
* 断点
|
|
72
|
+
*/
|
|
73
|
+
DEBUG_BREAKPOINT = 'debugBreakpoint',
|
|
74
|
+
/**
|
|
75
|
+
* DAP 请求和响应耗时
|
|
76
|
+
*/
|
|
77
|
+
DEBUG_ADAPTER_PROTOCOL_TIME = 'debugAdapterProtocolTime',
|
|
78
|
+
/**
|
|
79
|
+
* 断点命中
|
|
80
|
+
*/
|
|
81
|
+
DEBUG_STOPPED = 'debugStopped',
|
|
82
|
+
/**
|
|
83
|
+
* 前端 UI 渲染层耗时
|
|
84
|
+
*/
|
|
85
|
+
DEBUG_UI_FRONTEND_TIME = 'debugFrontEndTime',
|
|
86
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './common';
|