tokens.ts 6.0 KB

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