@opensumi/ide-debug 2.21.6 → 2.21.7-next-1670228715.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.
Files changed (320) hide show
  1. package/lib/browser/breakpoint/breakpoint-manager.js.map +1 -1
  2. package/lib/browser/breakpoint/breakpoint-marker.d.ts +1 -1
  3. package/lib/browser/breakpoint/breakpoint-marker.d.ts.map +1 -1
  4. package/lib/browser/breakpoint/breakpoint-marker.js +3 -2
  5. package/lib/browser/breakpoint/breakpoint-marker.js.map +1 -1
  6. package/lib/browser/contextkeys/debug-call-stack-item-type-key.d.ts +1 -1
  7. package/lib/browser/contextkeys/debug-call-stack-item-type-key.d.ts.map +1 -1
  8. package/lib/browser/contextkeys/debug-contextkey.service.js.map +1 -1
  9. package/lib/browser/debug-configuration-manager.d.ts +2 -2
  10. package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
  11. package/lib/browser/debug-configuration-manager.js.map +1 -1
  12. package/lib/browser/debug-contribution.d.ts +2 -147
  13. package/lib/browser/debug-contribution.d.ts.map +1 -1
  14. package/lib/browser/debug-contribution.js +48 -197
  15. package/lib/browser/debug-contribution.js.map +1 -1
  16. package/lib/browser/debug-exception-widget.js.map +1 -1
  17. package/lib/browser/debug-link-detector.js.map +1 -1
  18. package/lib/browser/debug-memory.js +4 -4
  19. package/lib/browser/debug-memory.js.map +1 -1
  20. package/lib/browser/debug-preferences.d.ts +1 -1
  21. package/lib/browser/debug-preferences.d.ts.map +1 -1
  22. package/lib/browser/debug-progress.service.js.map +1 -1
  23. package/lib/browser/debug-schema-updater.js.map +1 -1
  24. package/lib/browser/debug-service.js.map +1 -1
  25. package/lib/browser/debug-session-connection.d.ts +2 -3
  26. package/lib/browser/debug-session-connection.d.ts.map +1 -1
  27. package/lib/browser/debug-session-connection.js.map +1 -1
  28. package/lib/browser/debug-session-contribution.js.map +1 -1
  29. package/lib/browser/debug-session-manager.d.ts +3 -4
  30. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  31. package/lib/browser/debug-session-manager.js +6 -7
  32. package/lib/browser/debug-session-manager.js.map +1 -1
  33. package/lib/browser/debug-session.d.ts +3 -4
  34. package/lib/browser/debug-session.d.ts.map +1 -1
  35. package/lib/browser/debug-session.js +15 -11
  36. package/lib/browser/debug-session.js.map +1 -1
  37. package/lib/browser/debugUtils.js +4 -4
  38. package/lib/browser/debugUtils.js.map +1 -1
  39. package/lib/browser/editor/debug-breakpoint-widget.js.map +1 -1
  40. package/lib/browser/editor/debug-breakpoint-zone-widget.js +7 -7
  41. package/lib/browser/editor/debug-breakpoint-zone-widget.js.map +1 -1
  42. package/lib/browser/editor/debug-editor-contribution.d.ts +2 -2
  43. package/lib/browser/editor/debug-editor-contribution.d.ts.map +1 -1
  44. package/lib/browser/editor/debug-editor-contribution.js +3 -4
  45. package/lib/browser/editor/debug-editor-contribution.js.map +1 -1
  46. package/lib/browser/editor/debug-expression-provider.js.map +1 -1
  47. package/lib/browser/editor/debug-hover-model.js.map +1 -1
  48. package/lib/browser/editor/debug-hover-source.d.ts +1 -1
  49. package/lib/browser/editor/debug-hover-source.d.ts.map +1 -1
  50. package/lib/browser/editor/debug-hover-source.js.map +1 -1
  51. package/lib/browser/editor/debug-hover-tree.model.service.js.map +1 -1
  52. package/lib/browser/editor/debug-hover-widget.js.map +1 -1
  53. package/lib/browser/editor/debug-model-manager.d.ts +2 -9
  54. package/lib/browser/editor/debug-model-manager.d.ts.map +1 -1
  55. package/lib/browser/editor/debug-model-manager.js +8 -15
  56. package/lib/browser/editor/debug-model-manager.js.map +1 -1
  57. package/lib/browser/editor/debug-model.d.ts +2 -2
  58. package/lib/browser/editor/debug-model.d.ts.map +1 -1
  59. package/lib/browser/editor/debug-model.js +27 -27
  60. package/lib/browser/editor/debug-model.js.map +1 -1
  61. package/lib/browser/editor/debug-run-to-cursor.service.js +7 -7
  62. package/lib/browser/editor/debug-run-to-cursor.service.js.map +1 -1
  63. package/lib/browser/editor/evaluatable-expression.js.map +1 -1
  64. package/lib/browser/index.d.ts +0 -14
  65. package/lib/browser/index.d.ts.map +1 -1
  66. package/lib/browser/index.js +8 -24
  67. package/lib/browser/index.js.map +1 -1
  68. package/lib/browser/markers/marker-manager.js.map +1 -1
  69. package/lib/browser/model/debug-source.d.ts +3 -3
  70. package/lib/browser/model/debug-source.d.ts.map +1 -1
  71. package/lib/browser/model/debug-source.js.map +1 -1
  72. package/lib/browser/model/debug-thread.d.ts +1 -1
  73. package/lib/browser/model/debug-thread.d.ts.map +1 -1
  74. package/lib/browser/model/debug-watch.d.ts.map +1 -1
  75. package/lib/browser/model/debug-watch.js +1 -2
  76. package/lib/browser/model/debug-watch.js.map +1 -1
  77. package/lib/browser/preferences/launch-folder-preference-provider.d.ts +2 -2
  78. package/lib/browser/preferences/launch-folder-preference-provider.d.ts.map +1 -1
  79. package/lib/browser/preferences/launch-folder-preference-provider.js +2 -2
  80. package/lib/browser/preferences/launch-folder-preference-provider.js.map +1 -1
  81. package/lib/browser/preferences/launch-preferences-contribution.js.map +1 -1
  82. package/lib/browser/tree/debug-console-tree-node.define.js +6 -6
  83. package/lib/browser/tree/debug-console-tree-node.define.js.map +1 -1
  84. package/lib/browser/tree/debug-tree-node.define.js +18 -18
  85. package/lib/browser/tree/debug-tree-node.define.js.map +1 -1
  86. package/lib/browser/view/breakpoints/debug-breakpoints.service.js +3 -3
  87. package/lib/browser/view/breakpoints/debug-breakpoints.service.js.map +1 -1
  88. package/lib/browser/view/configuration/debug-configuration.module.less +5 -5
  89. package/lib/browser/view/configuration/debug-configuration.service.d.ts +1 -2
  90. package/lib/browser/view/configuration/debug-configuration.service.d.ts.map +1 -1
  91. package/lib/browser/view/configuration/debug-configuration.service.js.map +1 -1
  92. package/lib/browser/view/configuration/debug-configuration.view.d.ts.map +1 -1
  93. package/lib/browser/view/configuration/debug-configuration.view.js +1 -1
  94. package/lib/browser/view/configuration/debug-configuration.view.js.map +1 -1
  95. package/lib/browser/view/configuration/debug-toolbar.service.js.map +1 -1
  96. package/lib/browser/view/configuration/debug-toolbar.view.js +2 -2
  97. package/lib/browser/view/configuration/debug-toolbar.view.js.map +1 -1
  98. package/lib/browser/view/console/debug-console-filter.model.js.map +1 -1
  99. package/lib/browser/view/console/debug-console-filter.service.js.map +1 -1
  100. package/lib/browser/view/console/debug-console-model.js.map +1 -1
  101. package/lib/browser/view/console/debug-console-session.d.ts +3 -2
  102. package/lib/browser/view/console/debug-console-session.d.ts.map +1 -1
  103. package/lib/browser/view/console/debug-console-session.js.map +1 -1
  104. package/lib/browser/view/console/debug-console-tree.model.service.d.ts +1 -1
  105. package/lib/browser/view/console/debug-console-tree.model.service.d.ts.map +1 -1
  106. package/lib/browser/view/console/debug-console-tree.model.service.js.map +1 -1
  107. package/lib/browser/view/console/debug-console.contribution.d.ts.map +1 -1
  108. package/lib/browser/view/console/debug-console.contribution.js +21 -23
  109. package/lib/browser/view/console/debug-console.contribution.js.map +1 -1
  110. package/lib/browser/view/console/debug-console.module.less +2 -1
  111. package/lib/browser/view/console/debug-console.service.js +7 -7
  112. package/lib/browser/view/console/debug-console.service.js.map +1 -1
  113. package/lib/browser/view/console/debug-console.view.d.ts +1 -1
  114. package/lib/browser/view/console/debug-console.view.d.ts.map +1 -1
  115. package/lib/browser/view/console/debug-console.view.js +2 -2
  116. package/lib/browser/view/console/debug-console.view.js.map +1 -1
  117. package/lib/browser/view/debug-view-model.js.map +1 -1
  118. package/lib/browser/view/frames/debug-call-stack.contribution.js +5 -5
  119. package/lib/browser/view/frames/debug-call-stack.contribution.js.map +1 -1
  120. package/lib/browser/view/frames/debug-call-stack.service.js.map +1 -1
  121. package/lib/browser/view/variables/debug-variables-model.js.map +1 -1
  122. package/lib/browser/view/variables/debug-variables-tree.model.service.d.ts +1 -1
  123. package/lib/browser/view/variables/debug-variables-tree.model.service.d.ts.map +1 -1
  124. package/lib/browser/view/variables/debug-variables-tree.model.service.js.map +1 -1
  125. package/lib/browser/view/variables/debug-variables.contribution.d.ts.map +1 -1
  126. package/lib/browser/view/variables/debug-variables.contribution.js +12 -13
  127. package/lib/browser/view/variables/debug-variables.contribution.js.map +1 -1
  128. package/lib/browser/view/variables/debug-variables.module.less +2 -1
  129. package/lib/browser/view/variables/debug-variables.view.d.ts +1 -1
  130. package/lib/browser/view/variables/debug-variables.view.d.ts.map +1 -1
  131. package/lib/browser/view/variables/debug-variables.view.js +1 -1
  132. package/lib/browser/view/variables/debug-variables.view.js.map +1 -1
  133. package/lib/browser/view/watch/debug-watch-model.js.map +1 -1
  134. package/lib/browser/view/watch/debug-watch-tree.model.service.d.ts +2 -2
  135. package/lib/browser/view/watch/debug-watch-tree.model.service.d.ts.map +1 -1
  136. package/lib/browser/view/watch/debug-watch-tree.model.service.js.map +1 -1
  137. package/lib/browser/view/watch/debug-watch.contribution.d.ts.map +1 -1
  138. package/lib/browser/view/watch/debug-watch.contribution.js +21 -19
  139. package/lib/browser/view/watch/debug-watch.contribution.js.map +1 -1
  140. package/lib/browser/view/watch/debug-watch.module.less +2 -1
  141. package/lib/browser/view/watch/debug-watch.view.d.ts +1 -1
  142. package/lib/browser/view/watch/debug-watch.view.d.ts.map +1 -1
  143. package/lib/browser/view/watch/debug-watch.view.js +1 -1
  144. package/lib/browser/view/watch/debug-watch.view.js.map +1 -1
  145. package/lib/common/commands.d.ts +46 -0
  146. package/lib/common/commands.d.ts.map +1 -0
  147. package/lib/common/commands.js +149 -0
  148. package/lib/common/commands.js.map +1 -0
  149. package/lib/common/debug-breakpoint.d.ts +3 -3
  150. package/lib/common/debug-breakpoint.d.ts.map +1 -1
  151. package/lib/common/debug-configuration.d.ts +1 -1
  152. package/lib/common/debug-configuration.d.ts.map +1 -1
  153. package/lib/common/debug-console.d.ts +18 -0
  154. package/lib/common/debug-console.d.ts.map +1 -0
  155. package/lib/common/debug-console.js +5 -0
  156. package/lib/common/debug-console.js.map +1 -0
  157. package/lib/common/debug-editor.d.ts +1 -1
  158. package/lib/common/debug-editor.d.ts.map +1 -1
  159. package/lib/common/debug-model.d.ts +19 -4
  160. package/lib/common/debug-model.d.ts.map +1 -1
  161. package/lib/common/debug-model.js +14 -6
  162. package/lib/common/debug-model.js.map +1 -1
  163. package/lib/common/debug-service.d.ts +1 -1
  164. package/lib/common/debug-service.d.ts.map +1 -1
  165. package/lib/common/debug-session.d.ts +1 -1
  166. package/lib/common/debug-session.d.ts.map +1 -1
  167. package/lib/common/index.d.ts +2 -0
  168. package/lib/common/index.d.ts.map +1 -1
  169. package/lib/common/index.js +2 -0
  170. package/lib/common/index.js.map +1 -1
  171. package/lib/common/inline-values.d.ts +1 -1
  172. package/lib/common/inline-values.d.ts.map +1 -1
  173. package/lib/common/terminal.js +10 -10
  174. package/lib/common/terminal.js.map +1 -1
  175. package/package.json +24 -25
  176. package/src/browser/assets/breakpoint-conditional-disabled.svg +4 -0
  177. package/src/browser/assets/breakpoint-conditional-unverified.svg +4 -0
  178. package/src/browser/assets/breakpoint-conditional.svg +4 -0
  179. package/src/browser/assets/breakpoint-disabled.svg +4 -0
  180. package/src/browser/assets/breakpoint-hint.svg +4 -0
  181. package/src/browser/assets/breakpoint-log-disabled.svg +4 -0
  182. package/src/browser/assets/breakpoint-log-unverified.svg +4 -0
  183. package/src/browser/assets/breakpoint-log.svg +4 -0
  184. package/src/browser/assets/breakpoint-unsupported.svg +4 -0
  185. package/src/browser/assets/breakpoint-unverified.svg +4 -0
  186. package/src/browser/assets/breakpoint.svg +4 -0
  187. package/src/browser/assets/breakpoints-activate-inverse.svg +4 -0
  188. package/src/browser/assets/breakpoints-activate.svg +4 -0
  189. package/src/browser/assets/configure-inverse.svg +4 -0
  190. package/src/browser/assets/configure.svg +4 -0
  191. package/src/browser/assets/continue-inverse.svg +4 -0
  192. package/src/browser/assets/current-and-breakpoint.svg +4 -0
  193. package/src/browser/assets/current-arrow.svg +4 -0
  194. package/src/browser/assets/remove-all-inverse.svg +4 -0
  195. package/src/browser/assets/remove-all.svg +4 -0
  196. package/src/browser/assets/repl-inverse.svg +4 -0
  197. package/src/browser/assets/repl.svg +4 -0
  198. package/src/browser/assets/restart-inverse.svg +4 -0
  199. package/src/browser/assets/stackframe-and-breakpoint.svg +4 -0
  200. package/src/browser/assets/stackframe-arrow.svg +4 -0
  201. package/src/browser/assets/start-inverse.svg +4 -0
  202. package/src/browser/breakpoint/breakpoint-decoration.ts +57 -0
  203. package/src/browser/breakpoint/breakpoint-manager.ts +348 -0
  204. package/src/browser/breakpoint/breakpoint-marker.ts +70 -0
  205. package/src/browser/breakpoint/index.ts +3 -0
  206. package/src/browser/components/debug-action/index.module.less +73 -0
  207. package/src/browser/components/debug-action/index.tsx +40 -0
  208. package/src/browser/components/debug-exception-widget.less +42 -0
  209. package/src/browser/components/floating-click-widget/index.module.less +5 -0
  210. package/src/browser/components/floating-click-widget/index.tsx +21 -0
  211. package/src/browser/components/index.ts +1 -0
  212. package/src/browser/contextkeys/debug-call-stack-item-type-key.ts +4 -0
  213. package/src/browser/contextkeys/debug-contextkey.service.ts +54 -0
  214. package/src/browser/contextkeys/index.ts +1 -0
  215. package/src/browser/debug-ansi-handle.ts +521 -0
  216. package/src/browser/debug-configuration-manager.ts +513 -0
  217. package/src/browser/debug-configuration-model.ts +66 -0
  218. package/src/browser/debug-contribution.ts +757 -0
  219. package/src/browser/debug-exception-widget.tsx +89 -0
  220. package/src/browser/debug-link-detector.ts +234 -0
  221. package/src/browser/debug-memory.ts +220 -0
  222. package/src/browser/debug-preferences.ts +70 -0
  223. package/src/browser/debug-progress.service.ts +122 -0
  224. package/src/browser/debug-schema-updater.ts +67 -0
  225. package/src/browser/debug-service.ts +42 -0
  226. package/src/browser/debug-session-connection.ts +331 -0
  227. package/src/browser/debug-session-contribution.ts +57 -0
  228. package/src/browser/debug-session-manager.ts +622 -0
  229. package/src/browser/debug-session.ts +1181 -0
  230. package/src/browser/debug-style.less +128 -0
  231. package/src/browser/debugUtils.ts +110 -0
  232. package/src/browser/editor/debug-breakpoint-widget.ts +99 -0
  233. package/src/browser/editor/debug-breakpoint-zone-widget.tsx +262 -0
  234. package/src/browser/editor/debug-breakpoint.module.less +31 -0
  235. package/src/browser/editor/debug-editor-contribution.ts +589 -0
  236. package/src/browser/editor/debug-expression-provider.ts +101 -0
  237. package/src/browser/editor/debug-hover-model.ts +38 -0
  238. package/src/browser/editor/debug-hover-source.ts +107 -0
  239. package/src/browser/editor/debug-hover-tree.model.service.ts +332 -0
  240. package/src/browser/editor/debug-hover-widget.tsx +200 -0
  241. package/src/browser/editor/debug-hover.module.less +29 -0
  242. package/src/browser/editor/debug-hover.view.tsx +147 -0
  243. package/src/browser/editor/debug-model-manager.ts +219 -0
  244. package/src/browser/editor/debug-model.ts +853 -0
  245. package/src/browser/editor/debug-run-to-cursor.service.ts +180 -0
  246. package/src/browser/editor/debug-styles.ts +66 -0
  247. package/src/browser/editor/evaluatable-expression.ts +47 -0
  248. package/src/browser/editor/index.ts +6 -0
  249. package/src/browser/index.ts +119 -0
  250. package/src/browser/markers/index.ts +2 -0
  251. package/src/browser/markers/marker-manager.ts +201 -0
  252. package/src/browser/markers/marker.ts +20 -0
  253. package/src/browser/model/debug-source.ts +144 -0
  254. package/src/browser/model/debug-stack-frame.ts +111 -0
  255. package/src/browser/model/debug-thread.ts +186 -0
  256. package/src/browser/model/debug-watch.ts +129 -0
  257. package/src/browser/model/index.ts +4 -0
  258. package/src/browser/preferences/launch-folder-preference-provider.ts +23 -0
  259. package/src/browser/preferences/launch-preferences-contribution.ts +9 -0
  260. package/src/browser/preferences/launch-preferences.ts +16 -0
  261. package/src/browser/tree/debug-console-tree-node.define.tsx +76 -0
  262. package/src/browser/tree/debug-tree-node.define.ts +768 -0
  263. package/src/browser/tree/index.ts +2 -0
  264. package/src/browser/view/breakpoints/debug-breakpoints.module.less +72 -0
  265. package/src/browser/view/breakpoints/debug-breakpoints.service.ts +217 -0
  266. package/src/browser/view/breakpoints/debug-breakpoints.view.tsx +174 -0
  267. package/src/browser/view/configuration/debug-configuration.module.less +110 -0
  268. package/src/browser/view/configuration/debug-configuration.service.ts +170 -0
  269. package/src/browser/view/configuration/debug-configuration.view.tsx +252 -0
  270. package/src/browser/view/configuration/debug-toolbar.service.ts +167 -0
  271. package/src/browser/view/configuration/debug-toolbar.view.tsx +335 -0
  272. package/src/browser/view/console/debug-console-filter.model.ts +49 -0
  273. package/src/browser/view/console/debug-console-filter.service.ts +81 -0
  274. package/src/browser/view/console/debug-console-filter.view.tsx +78 -0
  275. package/src/browser/view/console/debug-console-model.ts +48 -0
  276. package/src/browser/view/console/debug-console-session.ts +165 -0
  277. package/src/browser/view/console/debug-console-toolbar.view.tsx +28 -0
  278. package/src/browser/view/console/debug-console-tree.model.service.ts +550 -0
  279. package/src/browser/view/console/debug-console.contribution.ts +179 -0
  280. package/src/browser/view/console/debug-console.module.less +373 -0
  281. package/src/browser/view/console/debug-console.service.ts +433 -0
  282. package/src/browser/view/console/debug-console.view.tsx +500 -0
  283. package/src/browser/view/debug-view-model.ts +182 -0
  284. package/src/browser/view/frames/debug-call-stack-frame.view.tsx +224 -0
  285. package/src/browser/view/frames/debug-call-stack-session.view.tsx +237 -0
  286. package/src/browser/view/frames/debug-call-stack-thread.view.tsx +93 -0
  287. package/src/browser/view/frames/debug-call-stack.contribution.ts +88 -0
  288. package/src/browser/view/frames/debug-call-stack.module.less +193 -0
  289. package/src/browser/view/frames/debug-call-stack.operation.tsx +97 -0
  290. package/src/browser/view/frames/debug-call-stack.service.ts +105 -0
  291. package/src/browser/view/frames/debug-call-stack.view.tsx +43 -0
  292. package/src/browser/view/variables/debug-variables-model.ts +38 -0
  293. package/src/browser/view/variables/debug-variables-tree.model.service.ts +467 -0
  294. package/src/browser/view/variables/debug-variables.contribution.ts +243 -0
  295. package/src/browser/view/variables/debug-variables.module.less +149 -0
  296. package/src/browser/view/variables/debug-variables.view.tsx +303 -0
  297. package/src/browser/view/watch/debug-watch-model.ts +38 -0
  298. package/src/browser/view/watch/debug-watch-tree.model.service.ts +567 -0
  299. package/src/browser/view/watch/debug-watch.contribution.ts +170 -0
  300. package/src/browser/view/watch/debug-watch.module.less +189 -0
  301. package/src/browser/view/watch/debug-watch.view.tsx +337 -0
  302. package/src/common/commands.ts +146 -0
  303. package/src/common/constants.ts +81 -0
  304. package/src/common/debug-breakpoint.ts +43 -0
  305. package/src/common/debug-configuration.ts +68 -0
  306. package/src/common/debug-console.ts +20 -0
  307. package/src/common/debug-editor.ts +4 -0
  308. package/src/common/debug-hover.ts +31 -0
  309. package/src/common/debug-model.ts +272 -0
  310. package/src/common/debug-progress.ts +8 -0
  311. package/src/common/debug-schema-updater.ts +1 -0
  312. package/src/common/debug-service.ts +176 -0
  313. package/src/common/debug-session-options.ts +19 -0
  314. package/src/common/debug-session.ts +200 -0
  315. package/src/common/evaluatable-expression.ts +43 -0
  316. package/src/common/index.ts +16 -0
  317. package/src/common/inline-values.ts +77 -0
  318. package/src/common/terminal.ts +163 -0
  319. package/src/common/types.ts +86 -0
  320. package/src/index.ts +1 -0
@@ -0,0 +1,122 @@
1
+ /* ---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { Injectable, Autowired } from '@opensumi/di';
6
+ import { Event, IDisposable } from '@opensumi/ide-core-browser';
7
+ import { IProgressService } from '@opensumi/ide-core-browser/lib/progress';
8
+ import { DisposableCollection, IProgress, IProgressStep } from '@opensumi/ide-core-common';
9
+ import { ProgressLocation } from '@opensumi/ide-core-common';
10
+ import { DebugProtocol } from '@opensumi/vscode-debugprotocol';
11
+
12
+ import { IDebugProgress } from '../common/debug-progress';
13
+ import { DebugState, IDebugSessionManager } from '../common/debug-session';
14
+
15
+ import { DebugSession } from './debug-session';
16
+
17
+ @Injectable()
18
+ export class DebugProgressService implements IDebugProgress {
19
+ static DEBUG_PANEL_PROGRESS_ID = 'debug';
20
+
21
+ @Autowired(IProgressService)
22
+ protected readonly progressService: IProgressService;
23
+
24
+ private progressResolve: (() => void) | undefined;
25
+
26
+ private toDispose: IDisposable[] = [];
27
+
28
+ public async onDebugServiceStateChange(state: DebugState) {
29
+ if (this.progressResolve) {
30
+ this.progressResolve();
31
+ this.progressResolve = undefined;
32
+ }
33
+ if (
34
+ state === DebugState.Initializing &&
35
+ this.progressService.getIndicator(DebugProgressService.DEBUG_PANEL_PROGRESS_ID)
36
+ ) {
37
+ this.progressService.withProgress(
38
+ { location: DebugProgressService.DEBUG_PANEL_PROGRESS_ID },
39
+ (_progress) => new Promise<void>((resolve) => (this.progressResolve = resolve)),
40
+ );
41
+ }
42
+ }
43
+
44
+ public run(sessionsManager: IDebugSessionManager): void {
45
+ let progressListener: DisposableCollection | undefined;
46
+ const listenOnProgress = (session: DebugSession | undefined) => {
47
+ progressListener = new DisposableCollection();
48
+
49
+ if (session) {
50
+ progressListener?.push(session.onDidChangeState((state: DebugState) => this.onDebugServiceStateChange(state)));
51
+ progressListener?.push(
52
+ session.onDidProgressStart(async (progressStartEvent: DebugProtocol.ProgressStartEvent) => {
53
+ const promise = new Promise<void>((r) => {
54
+ const listener = Event.any(
55
+ Event.filter(session.onDidProgressEnd, (e) => e.body.progressId === progressStartEvent.body.progressId),
56
+ session.onDidExitAdapter as Event<any>,
57
+ )(() => {
58
+ listener.dispose();
59
+ r();
60
+ });
61
+ });
62
+
63
+ if (this.progressService.getIndicator(DebugProgressService.DEBUG_PANEL_PROGRESS_ID)) {
64
+ this.progressService.withProgress(
65
+ { location: DebugProgressService.DEBUG_PANEL_PROGRESS_ID },
66
+ () => promise,
67
+ );
68
+ }
69
+
70
+ this.progressService.withProgress(
71
+ {
72
+ location: ProgressLocation.Notification,
73
+ title: progressStartEvent.body.title,
74
+ cancellable: progressStartEvent.body.cancellable,
75
+ silent: true,
76
+ delay: 500,
77
+ },
78
+ (progressStep: IProgress<IProgressStep>) => {
79
+ let total = 0;
80
+ const reportProgress = (progress: { message?: string; percentage?: number }) => {
81
+ let increment: undefined | number;
82
+ if (typeof progress.percentage === 'number') {
83
+ increment = progress.percentage - total;
84
+ total += increment;
85
+ }
86
+ progressStep.report({
87
+ message: progress.message,
88
+ increment,
89
+ total: typeof increment === 'number' ? 100 : undefined,
90
+ });
91
+ };
92
+
93
+ if (progressStartEvent.body.message) {
94
+ reportProgress(progressStartEvent.body);
95
+ }
96
+
97
+ const progressUpdateListener = session.onDidProgressUpdate((e) => {
98
+ if (e.body.progressId === progressStartEvent.body.progressId) {
99
+ reportProgress(e.body);
100
+ }
101
+ });
102
+
103
+ return promise.then(() => progressUpdateListener.dispose());
104
+ },
105
+ () => session.cancel(progressStartEvent.body.progressId),
106
+ );
107
+ }),
108
+ );
109
+ }
110
+ };
111
+
112
+ this.toDispose.push(
113
+ sessionsManager.onDidChangeActiveDebugSession(({ current }) => {
114
+ if (progressListener) {
115
+ progressListener.dispose();
116
+ }
117
+ listenOnProgress(current);
118
+ }),
119
+ );
120
+ listenOnProgress(sessionsManager.currentSession);
121
+ }
122
+ }
@@ -0,0 +1,67 @@
1
+ import { Injectable, Autowired } from '@opensumi/di';
2
+ import { objects, IJSONSchema, IJSONSchemaRegistry } from '@opensumi/ide-core-browser';
3
+
4
+ import { launchSchemaUri } from '../common';
5
+ import { DebugServer, IDebugServer } from '../common/debug-service';
6
+
7
+ import { DebugConfigurationManager } from './debug-configuration-manager';
8
+
9
+ const { deepClone } = objects;
10
+
11
+ @Injectable()
12
+ export class DebugSchemaUpdater {
13
+ @Autowired(IDebugServer)
14
+ protected readonly debug: DebugServer;
15
+
16
+ @Autowired(IJSONSchemaRegistry)
17
+ private schemaRegistry: IJSONSchemaRegistry;
18
+
19
+ @Autowired(DebugConfigurationManager)
20
+ private config: DebugConfigurationManager;
21
+
22
+ async update(): Promise<void> {
23
+ const debuggers = this.config.getDebuggers();
24
+ const schema = { ...deepClone(launchSchema) };
25
+ const items = schema!.properties!.configurations.items as IJSONSchema;
26
+ const configurations = debuggers.map((dbg) => ({
27
+ attributes: Object.keys(dbg.configurationAttributes || {}).map((request) => {
28
+ const attributes: IJSONSchema = dbg.configurationAttributes[request];
29
+ return attributes;
30
+ }),
31
+ configurationSnippets: dbg.configurationSnippets,
32
+ }));
33
+ for (const { attributes, configurationSnippets } of configurations) {
34
+ if (attributes && items.oneOf) {
35
+ items.oneOf!.push(...attributes);
36
+ }
37
+ if (configurationSnippets && items.defaultSnippets) {
38
+ items.defaultSnippets.push(...configurationSnippets);
39
+ }
40
+ }
41
+ this.schemaRegistry.registerSchema(`${launchSchemaUri}/extension`, schema, ['launch.json']);
42
+ }
43
+ }
44
+
45
+ export const launchSchema: IJSONSchema = {
46
+ $id: launchSchemaUri,
47
+ type: 'object',
48
+ title: 'Launch',
49
+ required: [],
50
+ default: { version: '0.2.0', configurations: [] },
51
+ properties: {
52
+ version: {
53
+ type: 'string',
54
+ description: 'Version of this file format.',
55
+ default: '0.2.0',
56
+ },
57
+ configurations: {
58
+ type: 'array',
59
+ description: 'List of configurations. Add new configurations or edit existing ones by using IntelliSense.',
60
+ items: {
61
+ defaultSnippets: [],
62
+ type: 'object',
63
+ oneOf: [],
64
+ },
65
+ },
66
+ },
67
+ };
@@ -0,0 +1,42 @@
1
+ import { Injectable } from '@opensumi/di';
2
+ import { IJSONSchema, Event, Emitter } from '@opensumi/ide-core-browser';
3
+
4
+ import { IDebugService, IDebugServiceContributionPoint } from '../common';
5
+
6
+ @Injectable()
7
+ export class DebugService implements IDebugService {
8
+ private onDidDebugContributionPointChangeEmitter: Emitter<IDebugServiceContributionPoint> =
9
+ new Emitter<IDebugServiceContributionPoint>();
10
+
11
+ private debugContributionPointsMap: Map<string, IJSONSchema[]> = new Map();
12
+
13
+ registerDebugContributionPoints(path: string, contributions: IJSONSchema[]) {
14
+ if (!this.debugContributionPointsMap.has(path)) {
15
+ this.debugContributionPointsMap.set(path, contributions);
16
+ this.onDidDebugContributionPointChangeEmitter.fire({
17
+ path,
18
+ contributions,
19
+ });
20
+ }
21
+ }
22
+
23
+ unregisterDebugContributionPoints(path: string) {
24
+ const contributions = this.debugContributionPointsMap.get(path);
25
+ if (contributions) {
26
+ this.debugContributionPointsMap.delete(path);
27
+ this.onDidDebugContributionPointChangeEmitter.fire({
28
+ path,
29
+ contributions,
30
+ removed: true,
31
+ });
32
+ }
33
+ }
34
+
35
+ get debugContributionPoints() {
36
+ return this.debugContributionPointsMap;
37
+ }
38
+
39
+ get onDidDebugContributionPointChange(): Event<IDebugServiceContributionPoint> {
40
+ return this.onDidDebugContributionPointChangeEmitter.event;
41
+ }
42
+ }
@@ -0,0 +1,331 @@
1
+ import { Injectable, Optional, Autowired } from '@opensumi/di';
2
+ import { IWebSocket } from '@opensumi/ide-connection';
3
+ import {
4
+ Event,
5
+ Emitter,
6
+ DisposableCollection,
7
+ Disposable,
8
+ IDisposable,
9
+ Deferred,
10
+ getDebugLogger,
11
+ } from '@opensumi/ide-core-browser';
12
+ import { CancellationToken } from '@opensumi/ide-core-common';
13
+ import { OutputChannel } from '@opensumi/ide-output/lib/browser/output.channel';
14
+ import { DebugProtocol } from '@opensumi/vscode-debugprotocol';
15
+
16
+ import {
17
+ DebugConfiguration,
18
+ DebugEventTypes,
19
+ DebugExitEvent,
20
+ DebugRequestTypes,
21
+ DEBUG_REPORT_NAME,
22
+ getSequenceId,
23
+ IDebugSessionManager,
24
+ } from '../common';
25
+
26
+ import { DebugSessionManager } from './debug-session-manager';
27
+
28
+ export type DebugRequestHandler = (request: DebugProtocol.Request) => any;
29
+
30
+ const standardDebugEvents = new Set<Required<keyof DebugEventTypes>>([
31
+ 'breakpoint',
32
+ 'capabilities',
33
+ 'continued',
34
+ 'exited',
35
+ 'initialized',
36
+ 'loadedSource',
37
+ 'module',
38
+ 'output',
39
+ 'process',
40
+ 'stopped',
41
+ 'terminated',
42
+ 'thread',
43
+ 'progressStart',
44
+ 'progressUpdate',
45
+ 'progressEnd',
46
+ 'invalidated',
47
+ ]);
48
+
49
+ @Injectable({ multiple: true })
50
+ export class DebugSessionConnection implements IDisposable {
51
+ @Autowired(IDebugSessionManager)
52
+ protected readonly manager: DebugSessionManager;
53
+
54
+ protected readonly pendingRequests = new Map<number, (response: DebugProtocol.Response) => void>();
55
+ protected readonly connection: Promise<IWebSocket>;
56
+
57
+ protected readonly requestHandlers = new Map<string, DebugRequestHandler>();
58
+
59
+ protected readonly onDidCustomEventEmitter = new Emitter<DebugProtocol.Event>();
60
+ readonly onDidCustomEvent: Event<DebugProtocol.Event> = this.onDidCustomEventEmitter.event;
61
+
62
+ protected readonly toDispose = new DisposableCollection(
63
+ this.onDidCustomEventEmitter,
64
+ Disposable.create(() => this.pendingRequests.clear()),
65
+ Disposable.create(() => this.emitters.clear()),
66
+ );
67
+
68
+ constructor(
69
+ @Optional() readonly sessionId: string,
70
+ @Optional() protected readonly connectionFactory: (sessionId: string) => Promise<IWebSocket>,
71
+ @Optional() protected readonly traceOutputChannel: OutputChannel | undefined,
72
+ ) {
73
+ this.connection = this.createConnection();
74
+ }
75
+
76
+ get disposed(): boolean {
77
+ return this.toDispose.disposed;
78
+ }
79
+
80
+ dispose(): void {
81
+ this.toDispose.dispose();
82
+ }
83
+
84
+ /**
85
+ * 通过 Connection 模块创建可与 Node 进程通信的链接
86
+ * @returns IWebSocket
87
+ */
88
+ protected async createConnection(): Promise<IWebSocket> {
89
+ if (this.disposed) {
90
+ throw new Error('Connection has been already disposed.');
91
+ } else {
92
+ const connection = await this.connectionFactory(this.sessionId);
93
+ connection.onClose((code, reason) => {
94
+ this.fire('exited', { code, reason });
95
+ });
96
+
97
+ connection.onMessage((data) => this.handleMessage(data));
98
+
99
+ this.toDispose.push(
100
+ Disposable.create(() => {
101
+ connection.close();
102
+ }),
103
+ );
104
+ return connection;
105
+ }
106
+ }
107
+
108
+ protected allThreadsContinued = true;
109
+
110
+ protected sessionAdapterID: DebugProtocol.InitializeRequestArguments['adapterID'];
111
+
112
+ async sendRequest<K extends keyof DebugRequestTypes>(
113
+ command: K,
114
+ args: DebugRequestTypes[K][0],
115
+ configuration: DebugConfiguration,
116
+ token?: CancellationToken,
117
+ ): Promise<DebugRequestTypes[K][1]> {
118
+ /**
119
+ * 在接收到 initialize 请求的时候记录当前的 session 适配器类型
120
+ */
121
+ if (command === 'initialize') {
122
+ this.sessionAdapterID = (args as DebugProtocol.InitializeRequestArguments).adapterID;
123
+ }
124
+
125
+ const reportDAP = this.manager.reportTime(DEBUG_REPORT_NAME.DEBUG_ADAPTER_PROTOCOL_TIME, {
126
+ sessionId: this.sessionId,
127
+ threadId: (args && (args as DebugProtocol.ThreadsArguments).threadId) || this.manager.currentThread?.raw.id,
128
+ });
129
+ const result = await this.doSendRequest(command, args, token);
130
+
131
+ /*
132
+ * 对 threads 请求增加 数量 统计
133
+ */
134
+ const reportExtra: any = {
135
+ adapterID: this.sessionAdapterID,
136
+ request: configuration.request,
137
+ };
138
+
139
+ if (command === 'threads') {
140
+ reportExtra.amount = (result as DebugProtocol.ThreadsResponse).body.threads.length;
141
+ }
142
+
143
+ reportDAP(command, reportExtra);
144
+
145
+ if (
146
+ command === 'next' ||
147
+ command === 'stepIn' ||
148
+ command === 'stepOut' ||
149
+ command === 'stepBack' ||
150
+ command === 'reverseContinue' ||
151
+ command === 'restartFrame'
152
+ ) {
153
+ this.fireContinuedEvent((args as any).threadId);
154
+ }
155
+ if (command === 'continue') {
156
+ const response = result as DebugProtocol.ContinueResponse;
157
+ const allThreadsContinued = response && response.body && response.body.allThreadsContinued;
158
+ if (allThreadsContinued !== undefined) {
159
+ this.allThreadsContinued = result.body.allThreadsContinued;
160
+ }
161
+ this.fireContinuedEvent((args as any).threadId, this.allThreadsContinued);
162
+ return result;
163
+ }
164
+ return result;
165
+ }
166
+
167
+ async sendCustomRequest<T extends DebugProtocol.Response>(command: string, args?: any): Promise<T> {
168
+ return (await this.doSendRequest<T>(command, args))?.body;
169
+ }
170
+
171
+ protected async doSendRequest<K extends DebugProtocol.Response>(
172
+ command: string,
173
+ args: any = null,
174
+ token?: CancellationToken,
175
+ ): Promise<K> {
176
+ const result = new Deferred<K>();
177
+
178
+ const request: DebugProtocol.Request = {
179
+ seq: getSequenceId(),
180
+ type: 'request',
181
+ command,
182
+ };
183
+
184
+ let cancelationListener: IDisposable;
185
+ if (args && Object.keys(args).length > 0) {
186
+ request.arguments = args;
187
+ }
188
+
189
+ this.pendingRequests.set(request.seq, (response: any) => {
190
+ if (cancelationListener) {
191
+ cancelationListener.dispose();
192
+ }
193
+ if (!response.success) {
194
+ result.reject(response);
195
+ } else {
196
+ result.resolve(response);
197
+ }
198
+ });
199
+
200
+ if (token) {
201
+ cancelationListener = token.onCancellationRequested(async () => {
202
+ cancelationListener.dispose();
203
+ const session = this.manager.getSession(this.sessionId);
204
+ if (session && session.capabilities.supportsCancelRequest) {
205
+ session.sendRequest('cancel', {
206
+ requestId: request.seq,
207
+ });
208
+ }
209
+ });
210
+ }
211
+
212
+ await this.send(request);
213
+ return result.promise;
214
+ }
215
+
216
+ protected async send(message: DebugProtocol.ProtocolMessage): Promise<void> {
217
+ const connection = await this.connection;
218
+ const messageStr = JSON.stringify(message);
219
+ if (this.traceOutputChannel) {
220
+ this.traceOutputChannel.appendLine(`${this.sessionId.substring(0, 8)} [UI -> adapter]: ${messageStr}`);
221
+ }
222
+ connection.send(messageStr);
223
+ }
224
+
225
+ protected handleMessage(data: string) {
226
+ if (this.traceOutputChannel) {
227
+ this.traceOutputChannel.appendLine(`${this.sessionId.substring(0, 8)} [adapter -> UI ]: ${data}`);
228
+ }
229
+ const message: DebugProtocol.ProtocolMessage = JSON.parse(data);
230
+ if (message.type === 'request') {
231
+ this.handleRequest(message as DebugProtocol.Request);
232
+ } else if (message.type === 'response') {
233
+ this.handleResponse(message as DebugProtocol.Response);
234
+ } else if (message.type === 'event') {
235
+ this.handleEvent(message as DebugProtocol.Event);
236
+ }
237
+ }
238
+
239
+ protected handleResponse(response: DebugProtocol.Response): void {
240
+ const callback = this.pendingRequests.get(response.request_seq);
241
+ if (callback) {
242
+ this.pendingRequests.delete(response.request_seq);
243
+ callback(response);
244
+ }
245
+ }
246
+
247
+ onRequest(command: string, handler: DebugRequestHandler): void {
248
+ this.requestHandlers.set(command, handler);
249
+ }
250
+
251
+ protected async handleRequest(request: DebugProtocol.Request): Promise<void> {
252
+ const response: DebugProtocol.Response = {
253
+ type: 'response',
254
+ seq: getSequenceId(),
255
+ command: request.command,
256
+ request_seq: request.seq,
257
+ success: true,
258
+ };
259
+ const handler = this.requestHandlers.get(request.command);
260
+ if (handler) {
261
+ try {
262
+ response.body = handler(request);
263
+ } catch (error) {
264
+ response.success = false;
265
+ response.message = error.message;
266
+ }
267
+ } else {
268
+ getDebugLogger().error('Unhandled request', request);
269
+ }
270
+ await this.send(response);
271
+ }
272
+
273
+ protected handleEvent(event: DebugProtocol.Event): void {
274
+ if ('event' in event) {
275
+ if (event.event === 'continued') {
276
+ this.allThreadsContinued =
277
+ (event as DebugProtocol.ContinuedEvent).body.allThreadsContinued === false ? false : true;
278
+ }
279
+ if (standardDebugEvents.has(event.event as keyof DebugEventTypes)) {
280
+ this.doFire(event.event, event);
281
+ } else {
282
+ this.onDidCustomEventEmitter.fire(event);
283
+ }
284
+ } else {
285
+ this.fire('exited', event as DebugEventTypes['exited']);
286
+ }
287
+ }
288
+
289
+ protected readonly emitters = new Map<string, Emitter<DebugProtocol.Event | DebugExitEvent>>();
290
+ on<K extends keyof DebugEventTypes>(kind: K, listener: (e: DebugEventTypes[K]) => any): IDisposable {
291
+ if (this.disposed) {
292
+ return Disposable.create(() => {});
293
+ }
294
+ return this.getEmitter(kind).event(listener);
295
+ }
296
+
297
+ public fire<K extends keyof DebugEventTypes>(kind: K, e: DebugEventTypes[K]): void {
298
+ this.doFire(kind, e);
299
+ }
300
+
301
+ protected doFire(kind: string, e: DebugProtocol.Event | DebugExitEvent): void {
302
+ if (this.disposed) {
303
+ return;
304
+ }
305
+ this.getEmitter(kind).fire(e);
306
+ }
307
+
308
+ protected getEmitter(kind: string): Emitter<DebugProtocol.Event | DebugExitEvent> {
309
+ const emitter = this.emitters.get(kind) || this.newEmitter();
310
+ this.emitters.set(kind, emitter);
311
+ return emitter;
312
+ }
313
+
314
+ protected newEmitter(): Emitter<DebugProtocol.Event | DebugExitEvent> {
315
+ const emitter = new Emitter<DebugProtocol.Event | DebugExitEvent>();
316
+ this.toDispose.push(emitter);
317
+ return emitter;
318
+ }
319
+
320
+ protected fireContinuedEvent(threadId: number, allThreadsContinued = false): void {
321
+ this.fire('continued', {
322
+ type: 'event',
323
+ event: 'continued',
324
+ body: {
325
+ threadId,
326
+ allThreadsContinued,
327
+ },
328
+ seq: getSequenceId(),
329
+ });
330
+ }
331
+ }
@@ -0,0 +1,57 @@
1
+ import { Injectable, Autowired } from '@opensumi/di';
2
+ import { ContributionProvider } from '@opensumi/ide-core-browser';
3
+
4
+ import { DebugSessionOptions } from '../common';
5
+
6
+ import { DebugSession } from './debug-session';
7
+
8
+ export const DebugSessionContribution = Symbol('DebugSessionContribution');
9
+
10
+ export interface DebugSessionContribution {
11
+ /**
12
+ * 调试类型,如node2
13
+ */
14
+ debugType: string;
15
+
16
+ /**
17
+ * 生成DebugSession的工厂函数.
18
+ */
19
+ debugSessionFactory(): DebugSessionFactory;
20
+ }
21
+
22
+ export const DebugSessionContributionRegistry = Symbol('DebugSessionContributionRegistry');
23
+
24
+ export interface DebugSessionContributionRegistry {
25
+ get(debugType: string): DebugSessionContribution | undefined;
26
+ }
27
+
28
+ @Injectable()
29
+ export class DebugSessionContributionRegistryImpl implements DebugSessionContributionRegistry {
30
+ protected readonly contribs = new Map<string, DebugSessionContribution>();
31
+
32
+ @Autowired(DebugSessionContribution)
33
+ protected readonly contributions: ContributionProvider<DebugSessionContribution>;
34
+
35
+ constructor() {
36
+ this.init();
37
+ }
38
+
39
+ protected init(): void {
40
+ for (const contrib of this.contributions.getContributions()) {
41
+ this.contribs.set(contrib.debugType, contrib);
42
+ }
43
+ }
44
+
45
+ get(debugType: string): DebugSessionContribution | undefined {
46
+ return this.contribs.get(debugType);
47
+ }
48
+ }
49
+
50
+ export const DebugSessionFactory = Symbol('DebugSessionFactory');
51
+
52
+ /**
53
+ * 生成DebugSession的工厂函数.
54
+ */
55
+ export interface DebugSessionFactory {
56
+ get(sessionId: string, options: DebugSessionOptions): DebugSession;
57
+ }