PageRenderTime 36ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/src/client/debugger/Common/Contracts.ts

https://gitlab.com/jslee1/pythonVSCode
TypeScript | 222 lines | 188 code | 22 blank | 12 comment | 0 complexity | cd025122e6f9968c68761f75c19be487 MD5 | raw file
  1. 'use strict';
  2. import * as net from 'net';
  3. import {DebugProtocol} from 'vscode-debugprotocol';
  4. export const DjangoApp = "DJANGO";
  5. export enum DebugFlags {
  6. None = 0,
  7. IgnoreCommandBursts = 1
  8. }
  9. export class DebugOptions {
  10. public static get WaitOnAbnormalExit(): string { return "WaitOnAbnormalExit"; }
  11. public static get WaitOnNormalExit(): string { return "WaitOnNormalExit"; }
  12. public static get RedirectOutput(): string { return "RedirectOutput"; }
  13. public static get DjangoDebugging(): string { return "DjangoDebugging"; }
  14. public static get DebugStdLib(): string { return "DebugStdLib"; }
  15. public static get BreakOnSystemExitZero(): string { return "BreakOnSystemExitZero"; }
  16. }
  17. export interface ExceptionHandling {
  18. ignore: string[];
  19. always: string[];
  20. unhandled: string[];
  21. }
  22. export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
  23. /** An absolute path to the program to debug. */
  24. program: string;
  25. pythonPath: string;
  26. /** Automatically stop target after launch. If not specified, target does not stop. */
  27. stopOnEntry?: boolean;
  28. args: string[];
  29. applicationType?: string;
  30. externalConsole?: boolean;
  31. cwd?: string;
  32. debugOptions?: string[];
  33. env?: Object;
  34. exceptionHandling?: ExceptionHandling
  35. }
  36. //
  37. // export interface LaunchDjangoRequestArguments extends LaunchRequestArguments {
  38. // port?: number;
  39. // noReload?: boolean;
  40. // settings?: string;
  41. // }
  42. export interface AttachRequestArguments extends DebugProtocol.AttachRequestArguments {
  43. /** An absolute path to local directory with source. */
  44. localRoot: string;
  45. remoteRoot: string;
  46. port?: number;
  47. host?: string;
  48. secret?: string;
  49. }
  50. export interface IDebugServer {
  51. port: number;
  52. host?: string;
  53. }
  54. export enum FrameKind {
  55. None,
  56. Python,
  57. Django
  58. };
  59. export enum enum_EXCEPTION_STATE {
  60. BREAK_MODE_NEVER = 0,
  61. BREAK_MODE_ALWAYS = 1,
  62. BREAK_MODE_UNHANDLED = 32
  63. }
  64. export enum PythonLanguageVersion {
  65. Is2,
  66. Is3
  67. }
  68. export enum PythonEvaluationResultReprKind {
  69. Normal,
  70. Raw,
  71. RawLen
  72. }
  73. export enum PythonEvaluationResultFlags {
  74. None = 0,
  75. Expandable = 1,
  76. MethodCall = 2,
  77. SideEffects = 4,
  78. Raw = 8,
  79. HasRawRepr = 16,
  80. }
  81. export interface IPythonProcess extends NodeJS.EventEmitter {
  82. Connect(buffer: Buffer, socket: net.Socket, isRemoteProcess: boolean);
  83. HandleIncomingData(buffer: Buffer);
  84. Detach();
  85. Kill();
  86. SendStepInto(threadId: number);
  87. SendStepOver(threadId: number);
  88. SendStepOut(threadId: number);
  89. SendResumeThread(threadId: number);
  90. AutoResumeThread(threadId: number);
  91. SendClearStepping(threadId: number);
  92. ExecuteText(text: string, reprKind: any, stackFrame: IPythonStackFrame): Promise<IPythonEvaluationResult>;
  93. EnumChildren(text: string, stackFrame: IPythonStackFrame, timeout: number): Promise<IPythonEvaluationResult[]>;
  94. SetLineNumber(pythonStackFrame: IPythonStackFrame, lineNo: number);
  95. Threads: Map<number, IPythonThread>;
  96. ProgramDirectory: string;
  97. //TODO:Fix this, shouldn't be exposed
  98. PendingChildEnumCommands: Map<number, IChildEnumCommand>;
  99. PendingExecuteCommands: Map<number, IExecutionCommand>;
  100. }
  101. export interface IPythonEvaluationResult {
  102. Flags: PythonEvaluationResultFlags;
  103. IsExpandable: boolean;
  104. StringRepr: string;
  105. HexRepr: string;
  106. TypeName: string;
  107. Length: number;
  108. ExceptionText?: string;
  109. Expression: string;
  110. ChildName: string;
  111. Process: IPythonProcess;
  112. Frame: IPythonStackFrame;
  113. }
  114. export interface IPythonModule {
  115. ModuleId: number;
  116. Name: string;
  117. Filename: string;
  118. }
  119. export interface IPythonThread {
  120. IsWorkerThread: boolean;
  121. Process: IPythonProcess;
  122. Name: string;
  123. Id: number;
  124. Frames: IPythonStackFrame[];
  125. }
  126. export interface IPythonStackFrame {
  127. StartLine: number;
  128. EndLine: number;
  129. Thread: IPythonThread;
  130. LineNo: number;
  131. FunctionName: string;
  132. FileName: string;
  133. Kind: FrameKind;
  134. FrameId: number;
  135. Locals: IPythonEvaluationResult[];
  136. Parameters: IPythonEvaluationResult[];
  137. }
  138. export interface IDjangoStackFrame extends IPythonStackFrame {
  139. SourceFile: string;
  140. SourceLine: number;
  141. }
  142. export interface IStepCommand {
  143. PromiseResolve: (pyThread: IPythonThread) => void;
  144. PythonThreadId: number;
  145. }
  146. export interface IBreakpointCommand {
  147. Id: number;
  148. PromiseResolve: () => void;
  149. PromiseReject: () => void;
  150. }
  151. export interface IChildEnumCommand {
  152. Id: number;
  153. Frame: IPythonStackFrame;
  154. PromiseResolve: (value: IPythonEvaluationResult[]) => void;
  155. PromiseReject: () => void;
  156. }
  157. export interface IExecutionCommand {
  158. Id: number;
  159. Text: string;
  160. Frame: IPythonStackFrame;
  161. PromiseResolve: (value: IPythonEvaluationResult) => void;
  162. PromiseReject: (error: string) => void;
  163. }
  164. // Must be in sync with BREAKPOINT_CONDITION_* constants in visualstudio_py_debugger.py.
  165. export enum PythonBreakpointConditionKind {
  166. Always = 0,
  167. WhenTrue = 1,
  168. WhenChanged = 2
  169. }
  170. // Must be in sync with BREAKPOINT_PASS_COUNT_* constants in visualstudio_py_debugger.py.
  171. export enum PythonBreakpointPassCountKind {
  172. Always = 0,
  173. Every = 1,
  174. WhenEqual = 2,
  175. WhenEqualOrGreater = 3
  176. }
  177. export interface IPythonBreakpoint {
  178. IsDjangoBreakpoint?: boolean;
  179. Id: number;
  180. Filename: string;
  181. LineNo: number;
  182. ConditionKind: PythonBreakpointConditionKind;
  183. Condition: string;
  184. PassCountKind: PythonBreakpointPassCountKind;
  185. PassCount: number;
  186. Enabled: boolean;
  187. }
  188. export interface IPythonException {
  189. TypeName: string;
  190. Description: string;
  191. }
  192. export enum StreamDataType {
  193. Int32,
  194. Int64,
  195. String
  196. }
  197. export interface IStreamData {
  198. DataType: StreamDataType;
  199. RawData: any;
  200. }