forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContracts.ts
More file actions
275 lines (249 loc) · 7.54 KB
/
Copy pathContracts.ts
File metadata and controls
275 lines (249 loc) · 7.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
// tslint:disable:interface-name member-access no-single-line-block-comment no-any no-stateless-class member-ordering prefer-method-signature no-unnecessary-class
'use strict';
import { ChildProcess } from 'child_process';
import * as net from 'net';
import { OutputEvent } from 'vscode-debugadapter';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebuggerPerformanceTelemetry, DebuggerTelemetry } from '../../telemetry/types';
export class TelemetryEvent extends OutputEvent {
body!: {
/** The category of output (such as: 'console', 'stdout', 'stderr', 'telemetry'). If not specified, 'console' is assumed. */
category: string;
/** The output to report. */
output: string;
/** Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. */
data?: any;
};
constructor(output: string, data?: DebuggerTelemetry | DebuggerPerformanceTelemetry) {
super(output, 'telemetry');
if (data) {
this.body.data = data;
}
}
}
export const DjangoApp = 'DJANGO';
export enum DebugFlags {
None = 0,
IgnoreCommandBursts = 1
}
export enum DebugOptions {
WaitOnAbnormalExit = 'WaitOnAbnormalExit',
WaitOnNormalExit = 'WaitOnNormalExit',
RedirectOutput = 'RedirectOutput',
Django = 'Django',
Jinja = 'Jinja',
DebugStdLib = 'DebugStdLib',
BreakOnSystemExitZero = 'BreakOnSystemExitZero',
Sudo = 'Sudo',
Pyramid = 'Pyramid',
FixFilePathCase = 'FixFilePathCase',
WindowsClient = 'WindowsClient'
}
export interface ExceptionHandling {
ignore: string[];
always: string[];
unhandled: string[];
}
export type DebuggerType = 'python' | 'pythonExperimental';
export interface AdditionalLaunchDebugOptions {
redirectOutput?: boolean;
django?: boolean;
gevent?: boolean;
jinja?: boolean;
debugStdLib?: boolean;
sudo?: boolean;
pyramid?: boolean;
}
export interface AdditionalAttachDebugOptions {
redirectOutput?: boolean;
django?: boolean;
gevent?: boolean;
jinja?: boolean;
debugStdLib?: boolean;
}
export interface BaseLaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
type?: DebuggerType;
/** An absolute path to the program to debug. */
module?: string;
program?: string;
pythonPath: string;
/** Automatically stop target after launch. If not specified, target does not stop. */
stopOnEntry?: boolean;
args: string[];
cwd?: string;
debugOptions?: DebugOptions[];
env?: Object;
envFile: string;
console?: 'none' | 'integratedTerminal' | 'externalTerminal';
port?: number;
host?: string;
logToFile?: boolean;
}
export interface LaunchRequestArgumentsV1 extends BaseLaunchRequestArguments {
exceptionHandling?: ExceptionHandling;
}
export interface LaunchRequestArguments extends BaseLaunchRequestArguments, AdditionalLaunchDebugOptions {
}
export interface BaseAttachRequestArguments extends DebugProtocol.AttachRequestArguments {
type?: DebuggerType;
/** An absolute path to local directory with source. */
port?: number;
host?: string;
logToFile?: boolean;
debugOptions?: DebugOptions[];
}
export interface AttachRequestArgumentsV1 extends BaseAttachRequestArguments {
secret?: string;
localRoot: string;
remoteRoot: string;
}
export interface AttachRequestArguments extends BaseAttachRequestArguments, AdditionalAttachDebugOptions {
localRoot?: string;
remoteRoot?: string;
pathMappings?: { localRoot: string; remoteRoot: string }[];
}
export interface IDebugServer {
port: number;
host?: string;
}
export enum FrameKind {
None,
Python,
Django
}
export enum enum_EXCEPTION_STATE {
BREAK_MODE_NEVER = 0,
BREAK_MODE_ALWAYS = 1,
BREAK_MODE_UNHANDLED = 32
}
export enum PythonLanguageVersion {
Is2,
Is3
}
export enum PythonEvaluationResultReprKind {
Normal,
Raw,
RawLen
}
export enum PythonEvaluationResultFlags {
None = 0,
Expandable = 1,
MethodCall = 2,
SideEffects = 4,
Raw = 8,
HasRawRepr = 16
}
export interface IPythonProcess extends NodeJS.EventEmitter {
Connect(buffer: Buffer, socket: net.Socket, isRemoteProcess: boolean): boolean;
HandleIncomingData(buffer: Buffer);
attach(proc: ChildProcess): void;
Detach();
Kill();
SendStepInto(threadId: number);
SendStepOver(threadId: number);
SendStepOut(threadId: number);
SendResumeThread(threadId: number);
AutoResumeThread(threadId: number);
SendClearStepping(threadId: number);
ExecuteText(text: string, reprKind: any, stackFrame: IPythonStackFrame): Promise<IPythonEvaluationResult>;
EnumChildren(text: string, stackFrame: IPythonStackFrame, timeout: number): Promise<IPythonEvaluationResult[]>;
SetLineNumber(pythonStackFrame: IPythonStackFrame, lineNo: number);
Threads: Map<number, IPythonThread>;
ProgramDirectory: string;
PendingChildEnumCommands: Map<number, IChildEnumCommand>;
PendingExecuteCommands: Map<number, IExecutionCommand>;
ProcessPendingExecuteCommands();
}
export interface IPythonEvaluationResult {
Flags: PythonEvaluationResultFlags;
IsExpandable: boolean;
StringRepr: string;
HexRepr: string;
TypeName: string;
Length: number;
ExceptionText?: string;
Expression: string;
ChildName: string;
Process?: IPythonProcess;
Frame: IPythonStackFrame;
}
export interface IPythonModule {
ModuleId: number;
Name: string;
Filename: string;
}
export interface IPythonThread {
IsWorkerThread: boolean;
Process: IPythonProcess;
Name: string;
Id: number;
Int32Id: number;
Frames: IPythonStackFrame[];
}
export interface IPythonStackFrame {
StartLine: number;
EndLine: number;
Thread: IPythonThread;
LineNo: number;
FunctionName: string;
FileName: string;
Kind: FrameKind;
FrameId: number;
Locals: IPythonEvaluationResult[];
Parameters: IPythonEvaluationResult[];
}
export interface IDjangoStackFrame extends IPythonStackFrame {
SourceFile: string;
SourceLine: number;
}
export interface IStepCommand {
PromiseResolve: (pyThread: IPythonThread) => void;
PythonThreadId: number;
}
export interface IBreakpointCommand {
Id: number;
PromiseResolve: () => void;
PromiseReject: () => void;
}
export interface IChildEnumCommand {
Id: number;
Frame: IPythonStackFrame;
PromiseResolve: (value: IPythonEvaluationResult[]) => void;
PromiseReject: () => void;
}
export interface IExecutionCommand {
Id: number;
Text: string;
Frame: IPythonStackFrame;
PromiseResolve: (value: IPythonEvaluationResult) => void;
PromiseReject: (error: string) => void;
ReprKind: PythonEvaluationResultReprKind;
}
// Must be in sync with BREAKPOINT_CONDITION_* constants in visualstudio_py_debugger.py.
export enum PythonBreakpointConditionKind {
Always = 0,
WhenTrue = 1,
WhenChanged = 2
}
// Must be in sync with BREAKPOINT_PASS_COUNT_* constants in visualstudio_py_debugger.py.
export enum PythonBreakpointPassCountKind {
Always = 0,
Every = 1,
WhenEqual = 2,
WhenEqualOrGreater = 3
}
export interface IPythonBreakpoint {
IsDjangoBreakpoint?: boolean;
Id: number;
Filename: string;
LineNo: number;
ConditionKind: PythonBreakpointConditionKind;
Condition: string;
PassCountKind: PythonBreakpointPassCountKind;
PassCount: number;
Enabled: boolean;
}
export interface IPythonException {
TypeName: string;
Description: string;
}