tokens.ts 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import {
  4. IClientSession,
  5. IWidgetTracker,
  6. MainAreaWidget
  7. } from '@jupyterlab/apputils';
  8. import { CodeEditor } from '@jupyterlab/codeeditor';
  9. import { Token } from '@phosphor/coreutils';
  10. import { IObservableDisposable } from '@phosphor/disposable';
  11. import { DebugProtocol } from 'vscode-debugprotocol';
  12. import { Debugger } from './debugger';
  13. /**
  14. * An interface describing an application's visual debugger.
  15. */
  16. export interface IDebugger extends IWidgetTracker<MainAreaWidget<Debugger>> {}
  17. /**
  18. * A namespace for visual debugger types.
  19. */
  20. export namespace IDebugger {
  21. /**
  22. * A visual debugger session.
  23. */
  24. export interface ISession extends IObservableDisposable {
  25. /**
  26. * The API client session to connect to a debugger.
  27. */
  28. client: IClientSession;
  29. /**
  30. * The code editors in a debugger session.
  31. */
  32. editors: CodeEditor.IEditor[];
  33. /**
  34. * Start a new debug session.
  35. */
  36. start(): void;
  37. /**
  38. * Stop a running debug session.
  39. */
  40. stop(): void;
  41. }
  42. export namespace ISession {
  43. /**
  44. * Arguments for 'updateCell' request.
  45. * This is an addition to the Debug Adapter Protocol to support
  46. * setting breakpoints for cells
  47. */
  48. export interface IUpdateCellArguments {
  49. cellId: number;
  50. nextId: number;
  51. code: string;
  52. }
  53. /**
  54. * Response to 'updateCell' request.
  55. * This is an addition to the Debug Adapter Protocol to support
  56. * setting breakpoints for cells
  57. */
  58. export interface IUpdateCellResponse extends DebugProtocol.Response {
  59. body: {
  60. sourcePath: string;
  61. };
  62. }
  63. /**
  64. * Interface for all the debug requests types.
  65. */
  66. export interface IRequest {
  67. attach: DebugProtocol.AttachRequestArguments;
  68. completions: DebugProtocol.CompletionsArguments;
  69. configurationDone: DebugProtocol.ConfigurationDoneArguments;
  70. continue: DebugProtocol.ContinueArguments;
  71. disconnect: DebugProtocol.DisconnectArguments;
  72. evaluate: DebugProtocol.EvaluateArguments;
  73. exceptionInfo: DebugProtocol.ExceptionInfoArguments;
  74. goto: DebugProtocol.GotoArguments;
  75. gotoTargets: DebugProtocol.GotoTargetsArguments;
  76. initialize: DebugProtocol.InitializeRequestArguments;
  77. launch: DebugProtocol.LaunchRequestArguments;
  78. loadedSources: DebugProtocol.LoadedSourcesArguments;
  79. modules: DebugProtocol.ModulesArguments;
  80. next: DebugProtocol.NextArguments;
  81. pause: DebugProtocol.PauseArguments;
  82. restart: DebugProtocol.RestartArguments;
  83. restartFrame: DebugProtocol.RestartFrameArguments;
  84. reverseContinue: DebugProtocol.ReverseContinueArguments;
  85. scopes: DebugProtocol.ScopesArguments;
  86. setBreakpoints: DebugProtocol.SetBreakpointsArguments;
  87. setExceptionBreakpoints: DebugProtocol.SetExceptionBreakpointsArguments;
  88. setExpression: DebugProtocol.SetExpressionArguments;
  89. setFunctionBreakpoints: DebugProtocol.SetFunctionBreakpointsArguments;
  90. setVariable: DebugProtocol.SetVariableArguments;
  91. source: DebugProtocol.SourceArguments;
  92. stackTrace: DebugProtocol.StackTraceArguments;
  93. stepBack: DebugProtocol.StepBackArguments;
  94. stepIn: DebugProtocol.StepInArguments;
  95. stepInTargets: DebugProtocol.StepInTargetsArguments;
  96. stepOut: DebugProtocol.StepOutArguments;
  97. terminate: DebugProtocol.TerminateArguments;
  98. terminateThreads: DebugProtocol.TerminateThreadsArguments;
  99. threads: {};
  100. updateCell: IUpdateCellArguments;
  101. }
  102. /**
  103. * Interface for all the debug response types.
  104. */
  105. export interface IResponse {
  106. attach: DebugProtocol.AttachResponse;
  107. completions: DebugProtocol.CompletionsResponse;
  108. configurationDone: DebugProtocol.ConfigurationDoneResponse;
  109. continue: DebugProtocol.ContinueResponse;
  110. disconnect: DebugProtocol.DisconnectResponse;
  111. evaluate: DebugProtocol.EvaluateResponse;
  112. exceptionInfo: DebugProtocol.ExceptionInfoResponse;
  113. goto: DebugProtocol.GotoResponse;
  114. gotoTargets: DebugProtocol.GotoTargetsResponse;
  115. initialize: DebugProtocol.InitializeResponse;
  116. launch: DebugProtocol.LaunchResponse;
  117. loadedSources: DebugProtocol.LoadedSourcesResponse;
  118. modules: DebugProtocol.ModulesResponse;
  119. next: DebugProtocol.NextResponse;
  120. pause: DebugProtocol.PauseResponse;
  121. restart: DebugProtocol.RestartResponse;
  122. restartFrame: DebugProtocol.RestartFrameResponse;
  123. reverseContinue: DebugProtocol.ReverseContinueResponse;
  124. scopes: DebugProtocol.ScopesResponse;
  125. setBreakpoints: DebugProtocol.SetBreakpointsResponse;
  126. setExceptionBreakpoints: DebugProtocol.SetExceptionBreakpointsResponse;
  127. setExpression: DebugProtocol.SetExpressionResponse;
  128. setFunctionBreakpoints: DebugProtocol.SetFunctionBreakpointsResponse;
  129. setVariable: DebugProtocol.SetVariableResponse;
  130. source: DebugProtocol.SourceResponse;
  131. stackTrace: DebugProtocol.StackTraceResponse;
  132. stepBack: DebugProtocol.StepBackResponse;
  133. stepIn: DebugProtocol.StepInResponse;
  134. stepInTargets: DebugProtocol.StepInTargetsResponse;
  135. stepOut: DebugProtocol.StepOutResponse;
  136. terminate: DebugProtocol.TerminateResponse;
  137. terminateThreads: DebugProtocol.TerminateThreadsResponse;
  138. threads: DebugProtocol.ThreadsResponse;
  139. updateCell: IUpdateCellResponse;
  140. variables: DebugProtocol.VariablesResponse;
  141. }
  142. /**
  143. * A generic debug event.
  144. */
  145. export type IEvent = DebugProtocol.Event;
  146. }
  147. }
  148. /**
  149. * A token for a tracker for an application's visual debugger instances.
  150. */
  151. export const IDebugger = new Token<IDebugger>('@jupyterlab/debugger');