@opensumi/ide-debug 2.21.13 → 2.22.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 (338) 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 +2 -2
  12. package/lib/browser/debug-configuration-manager.js.map +1 -1
  13. package/lib/browser/debug-contribution.d.ts +2 -147
  14. package/lib/browser/debug-contribution.d.ts.map +1 -1
  15. package/lib/browser/debug-contribution.js +50 -200
  16. package/lib/browser/debug-contribution.js.map +1 -1
  17. package/lib/browser/debug-exception-widget.js.map +1 -1
  18. package/lib/browser/debug-link-detector.js.map +1 -1
  19. package/lib/browser/debug-memory.js +4 -4
  20. package/lib/browser/debug-memory.js.map +1 -1
  21. package/lib/browser/debug-preferences.d.ts +1 -1
  22. package/lib/browser/debug-preferences.d.ts.map +1 -1
  23. package/lib/browser/debug-progress.service.js.map +1 -1
  24. package/lib/browser/debug-schema-updater.js.map +1 -1
  25. package/lib/browser/debug-service.js.map +1 -1
  26. package/lib/browser/debug-session-connection.d.ts +2 -3
  27. package/lib/browser/debug-session-connection.d.ts.map +1 -1
  28. package/lib/browser/debug-session-connection.js.map +1 -1
  29. package/lib/browser/debug-session-contribution.js.map +1 -1
  30. package/lib/browser/debug-session-manager.d.ts +3 -4
  31. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  32. package/lib/browser/debug-session-manager.js +7 -8
  33. package/lib/browser/debug-session-manager.js.map +1 -1
  34. package/lib/browser/debug-session.d.ts +3 -4
  35. package/lib/browser/debug-session.d.ts.map +1 -1
  36. package/lib/browser/debug-session.js +15 -11
  37. package/lib/browser/debug-session.js.map +1 -1
  38. package/lib/browser/debugUtils.js +4 -4
  39. package/lib/browser/debugUtils.js.map +1 -1
  40. package/lib/browser/editor/debug-breakpoint-widget.js.map +1 -1
  41. package/lib/browser/editor/debug-breakpoint-zone-widget.js +7 -7
  42. package/lib/browser/editor/debug-breakpoint-zone-widget.js.map +1 -1
  43. package/lib/browser/editor/debug-breakpoint.module.less +3 -4
  44. package/lib/browser/editor/debug-editor-contribution.d.ts +2 -2
  45. package/lib/browser/editor/debug-editor-contribution.d.ts.map +1 -1
  46. package/lib/browser/editor/debug-editor-contribution.js +3 -4
  47. package/lib/browser/editor/debug-editor-contribution.js.map +1 -1
  48. package/lib/browser/editor/debug-expression-provider.js.map +1 -1
  49. package/lib/browser/editor/debug-hover-model.js.map +1 -1
  50. package/lib/browser/editor/debug-hover-source.d.ts +1 -1
  51. package/lib/browser/editor/debug-hover-source.d.ts.map +1 -1
  52. package/lib/browser/editor/debug-hover-source.js.map +1 -1
  53. package/lib/browser/editor/debug-hover-tree.model.service.js.map +1 -1
  54. package/lib/browser/editor/debug-hover-widget.js.map +1 -1
  55. package/lib/browser/editor/debug-model-manager.d.ts +2 -9
  56. package/lib/browser/editor/debug-model-manager.d.ts.map +1 -1
  57. package/lib/browser/editor/debug-model-manager.js +8 -15
  58. package/lib/browser/editor/debug-model-manager.js.map +1 -1
  59. package/lib/browser/editor/debug-model.d.ts +2 -2
  60. package/lib/browser/editor/debug-model.d.ts.map +1 -1
  61. package/lib/browser/editor/debug-model.js +27 -27
  62. package/lib/browser/editor/debug-model.js.map +1 -1
  63. package/lib/browser/editor/debug-run-to-cursor.service.js +7 -7
  64. package/lib/browser/editor/debug-run-to-cursor.service.js.map +1 -1
  65. package/lib/browser/editor/evaluatable-expression.js.map +1 -1
  66. package/lib/browser/index.d.ts +0 -14
  67. package/lib/browser/index.d.ts.map +1 -1
  68. package/lib/browser/index.js +8 -24
  69. package/lib/browser/index.js.map +1 -1
  70. package/lib/browser/markers/marker-manager.js.map +1 -1
  71. package/lib/browser/model/debug-source.d.ts +3 -3
  72. package/lib/browser/model/debug-source.d.ts.map +1 -1
  73. package/lib/browser/model/debug-source.js.map +1 -1
  74. package/lib/browser/model/debug-thread.d.ts +1 -1
  75. package/lib/browser/model/debug-thread.d.ts.map +1 -1
  76. package/lib/browser/model/debug-watch.d.ts.map +1 -1
  77. package/lib/browser/model/debug-watch.js +1 -2
  78. package/lib/browser/model/debug-watch.js.map +1 -1
  79. package/lib/browser/preferences/launch-folder-preference-provider.d.ts +2 -2
  80. package/lib/browser/preferences/launch-folder-preference-provider.d.ts.map +1 -1
  81. package/lib/browser/preferences/launch-folder-preference-provider.js +2 -2
  82. package/lib/browser/preferences/launch-folder-preference-provider.js.map +1 -1
  83. package/lib/browser/preferences/launch-preferences-contribution.js.map +1 -1
  84. package/lib/browser/tree/debug-console-tree-node.define.js +6 -6
  85. package/lib/browser/tree/debug-console-tree-node.define.js.map +1 -1
  86. package/lib/browser/tree/debug-tree-node.define.js +18 -18
  87. package/lib/browser/tree/debug-tree-node.define.js.map +1 -1
  88. package/lib/browser/view/breakpoints/debug-breakpoints.service.js +3 -3
  89. package/lib/browser/view/breakpoints/debug-breakpoints.service.js.map +1 -1
  90. package/lib/browser/view/configuration/debug-configuration.module.less +5 -5
  91. package/lib/browser/view/configuration/debug-configuration.service.d.ts +1 -2
  92. package/lib/browser/view/configuration/debug-configuration.service.d.ts.map +1 -1
  93. package/lib/browser/view/configuration/debug-configuration.service.js.map +1 -1
  94. package/lib/browser/view/configuration/debug-configuration.view.d.ts.map +1 -1
  95. package/lib/browser/view/configuration/debug-configuration.view.js +1 -1
  96. package/lib/browser/view/configuration/debug-configuration.view.js.map +1 -1
  97. package/lib/browser/view/configuration/debug-toolbar.service.js.map +1 -1
  98. package/lib/browser/view/configuration/debug-toolbar.view.js +2 -2
  99. package/lib/browser/view/configuration/debug-toolbar.view.js.map +1 -1
  100. package/lib/browser/view/console/debug-console-filter.model.js.map +1 -1
  101. package/lib/browser/view/console/debug-console-filter.service.js.map +1 -1
  102. package/lib/browser/view/console/debug-console-model.js.map +1 -1
  103. package/lib/browser/view/console/debug-console-session.d.ts +3 -2
  104. package/lib/browser/view/console/debug-console-session.d.ts.map +1 -1
  105. package/lib/browser/view/console/debug-console-session.js.map +1 -1
  106. package/lib/browser/view/console/debug-console-tree.model.service.d.ts +1 -1
  107. package/lib/browser/view/console/debug-console-tree.model.service.d.ts.map +1 -1
  108. package/lib/browser/view/console/debug-console-tree.model.service.js +5 -3
  109. package/lib/browser/view/console/debug-console-tree.model.service.js.map +1 -1
  110. package/lib/browser/view/console/debug-console.contribution.d.ts.map +1 -1
  111. package/lib/browser/view/console/debug-console.contribution.js +21 -23
  112. package/lib/browser/view/console/debug-console.contribution.js.map +1 -1
  113. package/lib/browser/view/console/debug-console.module.less +2 -3
  114. package/lib/browser/view/console/debug-console.service.js +7 -7
  115. package/lib/browser/view/console/debug-console.service.js.map +1 -1
  116. package/lib/browser/view/console/debug-console.view.d.ts +1 -1
  117. package/lib/browser/view/console/debug-console.view.d.ts.map +1 -1
  118. package/lib/browser/view/console/debug-console.view.js +15 -3
  119. package/lib/browser/view/console/debug-console.view.js.map +1 -1
  120. package/lib/browser/view/debug-view-model.js.map +1 -1
  121. package/lib/browser/view/frames/debug-call-stack-frame.view.d.ts.map +1 -1
  122. package/lib/browser/view/frames/debug-call-stack-frame.view.js +25 -24
  123. package/lib/browser/view/frames/debug-call-stack-frame.view.js.map +1 -1
  124. package/lib/browser/view/frames/debug-call-stack-session.view.d.ts.map +1 -1
  125. package/lib/browser/view/frames/debug-call-stack-session.view.js +8 -5
  126. package/lib/browser/view/frames/debug-call-stack-session.view.js.map +1 -1
  127. package/lib/browser/view/frames/debug-call-stack-thread.view.d.ts.map +1 -1
  128. package/lib/browser/view/frames/debug-call-stack-thread.view.js +12 -7
  129. package/lib/browser/view/frames/debug-call-stack-thread.view.js.map +1 -1
  130. package/lib/browser/view/frames/debug-call-stack.contribution.js +5 -5
  131. package/lib/browser/view/frames/debug-call-stack.contribution.js.map +1 -1
  132. package/lib/browser/view/frames/debug-call-stack.service.js.map +1 -1
  133. package/lib/browser/view/variables/debug-variables-model.js.map +1 -1
  134. package/lib/browser/view/variables/debug-variables-tree.model.service.d.ts +1 -1
  135. package/lib/browser/view/variables/debug-variables-tree.model.service.d.ts.map +1 -1
  136. package/lib/browser/view/variables/debug-variables-tree.model.service.js +5 -3
  137. package/lib/browser/view/variables/debug-variables-tree.model.service.js.map +1 -1
  138. package/lib/browser/view/variables/debug-variables.contribution.d.ts.map +1 -1
  139. package/lib/browser/view/variables/debug-variables.contribution.js +13 -14
  140. package/lib/browser/view/variables/debug-variables.contribution.js.map +1 -1
  141. package/lib/browser/view/variables/debug-variables.module.less +2 -11
  142. package/lib/browser/view/variables/debug-variables.view.d.ts +1 -1
  143. package/lib/browser/view/variables/debug-variables.view.d.ts.map +1 -1
  144. package/lib/browser/view/variables/debug-variables.view.js +1 -1
  145. package/lib/browser/view/variables/debug-variables.view.js.map +1 -1
  146. package/lib/browser/view/watch/debug-watch-model.js.map +1 -1
  147. package/lib/browser/view/watch/debug-watch-tree.model.service.d.ts +2 -2
  148. package/lib/browser/view/watch/debug-watch-tree.model.service.d.ts.map +1 -1
  149. package/lib/browser/view/watch/debug-watch-tree.model.service.js +5 -3
  150. package/lib/browser/view/watch/debug-watch-tree.model.service.js.map +1 -1
  151. package/lib/browser/view/watch/debug-watch.contribution.d.ts.map +1 -1
  152. package/lib/browser/view/watch/debug-watch.contribution.js +21 -19
  153. package/lib/browser/view/watch/debug-watch.contribution.js.map +1 -1
  154. package/lib/browser/view/watch/debug-watch.module.less +2 -12
  155. package/lib/browser/view/watch/debug-watch.view.d.ts +1 -1
  156. package/lib/browser/view/watch/debug-watch.view.d.ts.map +1 -1
  157. package/lib/browser/view/watch/debug-watch.view.js +1 -1
  158. package/lib/browser/view/watch/debug-watch.view.js.map +1 -1
  159. package/lib/common/commands.d.ts +46 -0
  160. package/lib/common/commands.d.ts.map +1 -0
  161. package/lib/common/commands.js +149 -0
  162. package/lib/common/commands.js.map +1 -0
  163. package/lib/common/debug-breakpoint.d.ts +3 -3
  164. package/lib/common/debug-breakpoint.d.ts.map +1 -1
  165. package/lib/common/debug-configuration.d.ts +1 -1
  166. package/lib/common/debug-configuration.d.ts.map +1 -1
  167. package/lib/common/debug-console.d.ts +18 -0
  168. package/lib/common/debug-console.d.ts.map +1 -0
  169. package/lib/common/debug-console.js +5 -0
  170. package/lib/common/debug-console.js.map +1 -0
  171. package/lib/common/debug-editor.d.ts +1 -1
  172. package/lib/common/debug-editor.d.ts.map +1 -1
  173. package/lib/common/debug-model.d.ts +19 -4
  174. package/lib/common/debug-model.d.ts.map +1 -1
  175. package/lib/common/debug-model.js +14 -6
  176. package/lib/common/debug-model.js.map +1 -1
  177. package/lib/common/debug-schema-updater.d.ts +2 -1
  178. package/lib/common/debug-schema-updater.d.ts.map +1 -1
  179. package/lib/common/debug-schema-updater.js +1 -1
  180. package/lib/common/debug-schema-updater.js.map +1 -1
  181. package/lib/common/debug-service.d.ts +1 -1
  182. package/lib/common/debug-service.d.ts.map +1 -1
  183. package/lib/common/debug-session.d.ts +1 -1
  184. package/lib/common/debug-session.d.ts.map +1 -1
  185. package/lib/common/index.d.ts +2 -0
  186. package/lib/common/index.d.ts.map +1 -1
  187. package/lib/common/index.js +2 -0
  188. package/lib/common/index.js.map +1 -1
  189. package/lib/common/inline-values.d.ts +1 -1
  190. package/lib/common/inline-values.d.ts.map +1 -1
  191. package/lib/common/terminal.js +10 -10
  192. package/lib/common/terminal.js.map +1 -1
  193. package/package.json +27 -26
  194. package/src/browser/assets/breakpoint-conditional-disabled.svg +4 -0
  195. package/src/browser/assets/breakpoint-conditional-unverified.svg +4 -0
  196. package/src/browser/assets/breakpoint-conditional.svg +4 -0
  197. package/src/browser/assets/breakpoint-disabled.svg +4 -0
  198. package/src/browser/assets/breakpoint-hint.svg +4 -0
  199. package/src/browser/assets/breakpoint-log-disabled.svg +4 -0
  200. package/src/browser/assets/breakpoint-log-unverified.svg +4 -0
  201. package/src/browser/assets/breakpoint-log.svg +4 -0
  202. package/src/browser/assets/breakpoint-unsupported.svg +4 -0
  203. package/src/browser/assets/breakpoint-unverified.svg +4 -0
  204. package/src/browser/assets/breakpoint.svg +4 -0
  205. package/src/browser/assets/breakpoints-activate-inverse.svg +4 -0
  206. package/src/browser/assets/breakpoints-activate.svg +4 -0
  207. package/src/browser/assets/configure-inverse.svg +4 -0
  208. package/src/browser/assets/configure.svg +4 -0
  209. package/src/browser/assets/continue-inverse.svg +4 -0
  210. package/src/browser/assets/current-and-breakpoint.svg +4 -0
  211. package/src/browser/assets/current-arrow.svg +4 -0
  212. package/src/browser/assets/remove-all-inverse.svg +4 -0
  213. package/src/browser/assets/remove-all.svg +4 -0
  214. package/src/browser/assets/repl-inverse.svg +4 -0
  215. package/src/browser/assets/repl.svg +4 -0
  216. package/src/browser/assets/restart-inverse.svg +4 -0
  217. package/src/browser/assets/stackframe-and-breakpoint.svg +4 -0
  218. package/src/browser/assets/stackframe-arrow.svg +4 -0
  219. package/src/browser/assets/start-inverse.svg +4 -0
  220. package/src/browser/breakpoint/breakpoint-decoration.ts +57 -0
  221. package/src/browser/breakpoint/breakpoint-manager.ts +348 -0
  222. package/src/browser/breakpoint/breakpoint-marker.ts +70 -0
  223. package/src/browser/breakpoint/index.ts +3 -0
  224. package/src/browser/components/debug-action/index.module.less +73 -0
  225. package/src/browser/components/debug-action/index.tsx +40 -0
  226. package/src/browser/components/debug-exception-widget.less +42 -0
  227. package/src/browser/components/floating-click-widget/index.module.less +5 -0
  228. package/src/browser/components/floating-click-widget/index.tsx +21 -0
  229. package/src/browser/components/index.ts +1 -0
  230. package/src/browser/contextkeys/debug-call-stack-item-type-key.ts +4 -0
  231. package/src/browser/contextkeys/debug-contextkey.service.ts +54 -0
  232. package/src/browser/contextkeys/index.ts +1 -0
  233. package/src/browser/debug-ansi-handle.ts +521 -0
  234. package/src/browser/debug-configuration-manager.ts +514 -0
  235. package/src/browser/debug-configuration-model.ts +66 -0
  236. package/src/browser/debug-contribution.ts +756 -0
  237. package/src/browser/debug-exception-widget.tsx +89 -0
  238. package/src/browser/debug-link-detector.ts +234 -0
  239. package/src/browser/debug-memory.ts +220 -0
  240. package/src/browser/debug-preferences.ts +70 -0
  241. package/src/browser/debug-progress.service.ts +122 -0
  242. package/src/browser/debug-schema-updater.ts +67 -0
  243. package/src/browser/debug-service.ts +42 -0
  244. package/src/browser/debug-session-connection.ts +331 -0
  245. package/src/browser/debug-session-contribution.ts +57 -0
  246. package/src/browser/debug-session-manager.ts +622 -0
  247. package/src/browser/debug-session.ts +1181 -0
  248. package/src/browser/debug-style.less +128 -0
  249. package/src/browser/debugUtils.ts +110 -0
  250. package/src/browser/editor/debug-breakpoint-widget.ts +99 -0
  251. package/src/browser/editor/debug-breakpoint-zone-widget.tsx +262 -0
  252. package/src/browser/editor/debug-breakpoint.module.less +30 -0
  253. package/src/browser/editor/debug-editor-contribution.ts +589 -0
  254. package/src/browser/editor/debug-expression-provider.ts +101 -0
  255. package/src/browser/editor/debug-hover-model.ts +38 -0
  256. package/src/browser/editor/debug-hover-source.ts +107 -0
  257. package/src/browser/editor/debug-hover-tree.model.service.ts +332 -0
  258. package/src/browser/editor/debug-hover-widget.tsx +200 -0
  259. package/src/browser/editor/debug-hover.module.less +29 -0
  260. package/src/browser/editor/debug-hover.view.tsx +147 -0
  261. package/src/browser/editor/debug-model-manager.ts +219 -0
  262. package/src/browser/editor/debug-model.ts +853 -0
  263. package/src/browser/editor/debug-run-to-cursor.service.ts +180 -0
  264. package/src/browser/editor/debug-styles.ts +66 -0
  265. package/src/browser/editor/evaluatable-expression.ts +47 -0
  266. package/src/browser/editor/index.ts +6 -0
  267. package/src/browser/index.ts +119 -0
  268. package/src/browser/markers/index.ts +2 -0
  269. package/src/browser/markers/marker-manager.ts +201 -0
  270. package/src/browser/markers/marker.ts +20 -0
  271. package/src/browser/model/debug-source.ts +144 -0
  272. package/src/browser/model/debug-stack-frame.ts +111 -0
  273. package/src/browser/model/debug-thread.ts +186 -0
  274. package/src/browser/model/debug-watch.ts +129 -0
  275. package/src/browser/model/index.ts +4 -0
  276. package/src/browser/preferences/launch-folder-preference-provider.ts +23 -0
  277. package/src/browser/preferences/launch-preferences-contribution.ts +9 -0
  278. package/src/browser/preferences/launch-preferences.ts +16 -0
  279. package/src/browser/tree/debug-console-tree-node.define.tsx +76 -0
  280. package/src/browser/tree/debug-tree-node.define.ts +768 -0
  281. package/src/browser/tree/index.ts +2 -0
  282. package/src/browser/view/breakpoints/debug-breakpoints.module.less +72 -0
  283. package/src/browser/view/breakpoints/debug-breakpoints.service.ts +217 -0
  284. package/src/browser/view/breakpoints/debug-breakpoints.view.tsx +174 -0
  285. package/src/browser/view/configuration/debug-configuration.module.less +110 -0
  286. package/src/browser/view/configuration/debug-configuration.service.ts +170 -0
  287. package/src/browser/view/configuration/debug-configuration.view.tsx +252 -0
  288. package/src/browser/view/configuration/debug-toolbar.service.ts +167 -0
  289. package/src/browser/view/configuration/debug-toolbar.view.tsx +335 -0
  290. package/src/browser/view/console/debug-console-filter.model.ts +49 -0
  291. package/src/browser/view/console/debug-console-filter.service.ts +81 -0
  292. package/src/browser/view/console/debug-console-filter.view.tsx +78 -0
  293. package/src/browser/view/console/debug-console-model.ts +48 -0
  294. package/src/browser/view/console/debug-console-session.ts +165 -0
  295. package/src/browser/view/console/debug-console-toolbar.view.tsx +28 -0
  296. package/src/browser/view/console/debug-console-tree.model.service.ts +553 -0
  297. package/src/browser/view/console/debug-console.contribution.ts +179 -0
  298. package/src/browser/view/console/debug-console.module.less +371 -0
  299. package/src/browser/view/console/debug-console.service.ts +433 -0
  300. package/src/browser/view/console/debug-console.view.tsx +511 -0
  301. package/src/browser/view/debug-view-model.ts +182 -0
  302. package/src/browser/view/frames/debug-call-stack-frame.view.tsx +230 -0
  303. package/src/browser/view/frames/debug-call-stack-session.view.tsx +253 -0
  304. package/src/browser/view/frames/debug-call-stack-thread.view.tsx +103 -0
  305. package/src/browser/view/frames/debug-call-stack.contribution.ts +88 -0
  306. package/src/browser/view/frames/debug-call-stack.module.less +193 -0
  307. package/src/browser/view/frames/debug-call-stack.operation.tsx +97 -0
  308. package/src/browser/view/frames/debug-call-stack.service.ts +105 -0
  309. package/src/browser/view/frames/debug-call-stack.view.tsx +43 -0
  310. package/src/browser/view/variables/debug-variables-model.ts +38 -0
  311. package/src/browser/view/variables/debug-variables-tree.model.service.ts +470 -0
  312. package/src/browser/view/variables/debug-variables.contribution.ts +244 -0
  313. package/src/browser/view/variables/debug-variables.module.less +139 -0
  314. package/src/browser/view/variables/debug-variables.view.tsx +303 -0
  315. package/src/browser/view/watch/debug-watch-model.ts +38 -0
  316. package/src/browser/view/watch/debug-watch-tree.model.service.ts +570 -0
  317. package/src/browser/view/watch/debug-watch.contribution.ts +170 -0
  318. package/src/browser/view/watch/debug-watch.module.less +178 -0
  319. package/src/browser/view/watch/debug-watch.view.tsx +337 -0
  320. package/src/common/commands.ts +146 -0
  321. package/src/common/constants.ts +81 -0
  322. package/src/common/debug-breakpoint.ts +43 -0
  323. package/src/common/debug-configuration.ts +68 -0
  324. package/src/common/debug-console.ts +20 -0
  325. package/src/common/debug-editor.ts +4 -0
  326. package/src/common/debug-hover.ts +31 -0
  327. package/src/common/debug-model.ts +272 -0
  328. package/src/common/debug-progress.ts +8 -0
  329. package/src/common/debug-schema-updater.ts +3 -0
  330. package/src/common/debug-service.ts +176 -0
  331. package/src/common/debug-session-options.ts +19 -0
  332. package/src/common/debug-session.ts +200 -0
  333. package/src/common/evaluatable-expression.ts +43 -0
  334. package/src/common/index.ts +16 -0
  335. package/src/common/inline-values.ts +77 -0
  336. package/src/common/terminal.ts +163 -0
  337. package/src/common/types.ts +86 -0
  338. package/src/index.ts +1 -0
@@ -0,0 +1,622 @@
1
+ /** ******************************************************************************
2
+ * Copyright (C) 2018 Red Hat, Inc. and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/debug/src/browser/debug-session-manager.ts
17
+
18
+ import { Injectable, Autowired } from '@opensumi/di';
19
+ import {
20
+ WaitUntilEvent,
21
+ Emitter,
22
+ Event,
23
+ URI,
24
+ IContextKey,
25
+ DisposableCollection,
26
+ IContextKeyService,
27
+ formatLocalize,
28
+ Uri,
29
+ IReporterService,
30
+ uuid,
31
+ localize,
32
+ COMMON_COMMANDS,
33
+ CommandService,
34
+ } from '@opensumi/ide-core-browser';
35
+ import { LabelService } from '@opensumi/ide-core-browser/lib/services';
36
+ import { WorkbenchEditorService } from '@opensumi/ide-editor';
37
+ import { IMessageService } from '@opensumi/ide-overlay';
38
+ import { ITaskService } from '@opensumi/ide-task/lib/common';
39
+ import { IVariableResolverService } from '@opensumi/ide-variable';
40
+
41
+ import {
42
+ DebugConfiguration,
43
+ DebugError,
44
+ IDebugServer,
45
+ DebugServer,
46
+ DebugSessionOptions,
47
+ IDebugSessionDTO,
48
+ DEBUG_REPORT_NAME,
49
+ IDebugSessionManager,
50
+ DebugSessionExtra,
51
+ DebugThreadExtra,
52
+ CONTEXT_DEBUG_STOPPED_KEY,
53
+ CONTEXT_IN_DEBUG_MODE_KEY,
54
+ CONTEXT_DEBUG_TYPE_KEY,
55
+ DebugState,
56
+ IDebugModelManager,
57
+ } from '../common';
58
+ import { IDebugProgress } from '../common/debug-progress';
59
+
60
+ import { BreakpointManager } from './breakpoint/breakpoint-manager';
61
+ import { DebugContextKey } from './contextkeys/debug-contextkey.service';
62
+ import { DebugSession } from './debug-session';
63
+ import { DebugSessionContributionRegistry } from './debug-session-contribution';
64
+ import { isRemoteAttach } from './debugUtils';
65
+ import { DebugStackFrame } from './model/debug-stack-frame';
66
+ import { DebugThread } from './model/debug-thread';
67
+
68
+ export type WillStartDebugSession = WaitUntilEvent;
69
+
70
+ export interface WillResolveDebugConfiguration extends WaitUntilEvent {
71
+ debugType: string;
72
+ }
73
+
74
+ export interface DidChangeActiveDebugSession {
75
+ previous: DebugSession | undefined;
76
+ current: DebugSession | undefined;
77
+ }
78
+
79
+ export interface DebugSessionCustomEvent {
80
+ readonly body?: any;
81
+ readonly event: string;
82
+ readonly session: DebugSession;
83
+ }
84
+
85
+ @Injectable()
86
+ export class DebugSessionManager implements IDebugSessionManager {
87
+ protected readonly _uid = uuid();
88
+ protected readonly _sessions = new Map<string, DebugSession>();
89
+ protected readonly _extraMap = new Map<string, DebugSessionExtra>();
90
+ protected _actionIndex = 0;
91
+
92
+ protected readonly onWillStartDebugSessionEmitter = new Emitter<WillStartDebugSession>();
93
+ readonly onWillStartDebugSession: Event<WillStartDebugSession> = this.onWillStartDebugSessionEmitter.event;
94
+
95
+ protected readonly onWillResolveDebugConfigurationEmitter = new Emitter<WillResolveDebugConfiguration>();
96
+ readonly onWillResolveDebugConfiguration: Event<WillResolveDebugConfiguration> =
97
+ this.onWillResolveDebugConfigurationEmitter.event;
98
+
99
+ protected readonly onDidCreateDebugSessionEmitter = new Emitter<DebugSession>();
100
+ readonly onDidCreateDebugSession: Event<DebugSession> = this.onDidCreateDebugSessionEmitter.event;
101
+
102
+ protected readonly onDidStartDebugSessionEmitter = new Emitter<DebugSession>();
103
+ readonly onDidStartDebugSession: Event<DebugSession> = this.onDidStartDebugSessionEmitter.event;
104
+
105
+ protected readonly onDidStopDebugSessionEmitter = new Emitter<DebugSession>();
106
+ readonly onDidStopDebugSession: Event<DebugSession> = this.onDidStopDebugSessionEmitter.event;
107
+
108
+ protected readonly onDidChangeActiveDebugSessionEmitter = new Emitter<DidChangeActiveDebugSession>();
109
+ readonly onDidChangeActiveDebugSession: Event<DidChangeActiveDebugSession> =
110
+ this.onDidChangeActiveDebugSessionEmitter.event;
111
+
112
+ protected readonly onDidDestroyDebugSessionEmitter = new Emitter<DebugSession>();
113
+ readonly onDidDestroyDebugSession: Event<DebugSession> = this.onDidDestroyDebugSessionEmitter.event;
114
+
115
+ protected readonly onDidReceiveDebugSessionCustomEventEmitter = new Emitter<DebugSessionCustomEvent>();
116
+ readonly onDidReceiveDebugSessionCustomEvent: Event<DebugSessionCustomEvent> =
117
+ this.onDidReceiveDebugSessionCustomEventEmitter.event;
118
+
119
+ protected readonly onDidChangeEmitter = new Emitter<DebugSession | undefined>();
120
+ readonly onDidChange: Event<DebugSession | undefined> = this.onDidChangeEmitter.event;
121
+ protected fireDidChange(current: DebugSession | undefined): void {
122
+ this.inDebugModeKey.set(this.inDebugMode);
123
+ this.onDidChangeEmitter.fire(current);
124
+ }
125
+
126
+ protected debugTypeKey: IContextKey<string>;
127
+ protected inDebugModeKey: IContextKey<boolean>;
128
+ protected debugStopped: IContextKey<boolean>;
129
+
130
+ @Autowired(LabelService)
131
+ protected readonly labelProvider: LabelService;
132
+
133
+ @Autowired(IContextKeyService)
134
+ protected readonly contextKeyService: IContextKeyService;
135
+
136
+ @Autowired(DebugSessionContributionRegistry)
137
+ protected readonly sessionContributionRegistry: DebugSessionContributionRegistry;
138
+
139
+ @Autowired(IDebugServer)
140
+ protected readonly debug: DebugServer;
141
+
142
+ @Autowired(WorkbenchEditorService)
143
+ protected readonly workbenchEditorService: WorkbenchEditorService;
144
+
145
+ @Autowired(IMessageService)
146
+ protected readonly messageService: IMessageService;
147
+
148
+ @Autowired(IVariableResolverService)
149
+ protected readonly variableResolver: IVariableResolverService;
150
+
151
+ @Autowired(BreakpointManager)
152
+ protected readonly breakpoints: BreakpointManager;
153
+
154
+ @Autowired(IDebugModelManager)
155
+ protected readonly modelManager: IDebugModelManager;
156
+
157
+ @Autowired(ITaskService)
158
+ protected readonly taskService: ITaskService;
159
+
160
+ @Autowired(IReporterService)
161
+ protected readonly reporterService: IReporterService;
162
+
163
+ @Autowired(IDebugProgress)
164
+ protected readonly debugProgressService: IDebugProgress;
165
+
166
+ @Autowired(DebugContextKey)
167
+ protected readonly debugContextKey: DebugContextKey;
168
+
169
+ @Autowired(CommandService)
170
+ protected readonly commandService: CommandService;
171
+
172
+ constructor() {
173
+ this.init();
174
+ }
175
+
176
+ protected init(): void {
177
+ this.debugTypeKey = this.contextKeyService.createKey<string>(CONTEXT_DEBUG_TYPE_KEY, undefined);
178
+ this.inDebugModeKey = this.contextKeyService.createKey<boolean>(CONTEXT_IN_DEBUG_MODE_KEY, this.inDebugMode);
179
+ this.debugStopped = this.contextKeyService.createKey<boolean>(CONTEXT_DEBUG_STOPPED_KEY, false);
180
+
181
+ this.modelManager.onModelChanged((event) => {
182
+ const { newModelUrl } = event;
183
+ if (newModelUrl) {
184
+ const uri = URI.parse(newModelUrl.toString());
185
+ const model = this.modelManager.model;
186
+ if (this.currentSession && this.currentThread && model) {
187
+ const frame = this.currentThread.frames.find((f) => f.source?.uri.toString() === uri.toString());
188
+ if (frame && frame !== this.currentFrame) {
189
+ this.currentThread.currentFrame = frame;
190
+ setTimeout(() => {
191
+ if (this.workbenchEditorService.currentEditor) {
192
+ this.workbenchEditorService.currentEditor.monacoEditor.revealLineInCenter(frame.raw.line);
193
+ }
194
+ }, 0);
195
+ }
196
+ }
197
+ }
198
+ });
199
+ }
200
+
201
+ private _getExtra(
202
+ sessionId: string | undefined,
203
+ threadId: number | string | undefined,
204
+ ): DebugThreadExtra | undefined {
205
+ if (sessionId == null) {
206
+ return;
207
+ }
208
+ const data = this._extraMap.get(sessionId);
209
+ if (data) {
210
+ return {
211
+ traceId: data.traceId,
212
+ remote: data.remote,
213
+ adapterID: data.adapterID,
214
+ request: data.request,
215
+ ...(threadId && data.threads.get(`${threadId}`)),
216
+ };
217
+ }
218
+ }
219
+
220
+ public getExtra(sessionId: string | undefined, threadId: number | string | undefined): DebugThreadExtra | undefined {
221
+ return this._getExtra(sessionId, threadId);
222
+ }
223
+
224
+ private _setExtra(sessionId: string, threadId: string, extra?: DebugThreadExtra) {
225
+ const data = this._extraMap.get(sessionId);
226
+ if (!data) {
227
+ return;
228
+ }
229
+ if (extra) {
230
+ data.threads.set(threadId, extra);
231
+ } else {
232
+ data.threads.delete(threadId);
233
+ }
234
+ }
235
+
236
+ public setExtra(sessionId: string, threadId: string, extra?: DebugThreadExtra) {
237
+ return this._setExtra(sessionId, threadId, extra);
238
+ }
239
+
240
+ report(name: string, msg: string | undefined, extra?: any) {
241
+ extra = {
242
+ traceId: this._uid,
243
+ ...this._getExtra(extra?.sessionId, extra?.threadId),
244
+ ...extra,
245
+ };
246
+ return this.reporterService.point(name, msg, extra);
247
+ }
248
+
249
+ reportTime(name: string, defaults?: any) {
250
+ const timer = this.reporterService.time(name);
251
+ return (msg: string | undefined, extra?: any) => {
252
+ extra = {
253
+ ...defaults,
254
+ ...extra,
255
+ };
256
+ extra = {
257
+ traceId: this._uid,
258
+ ...this._getExtra(extra?.sessionId, extra?.threadId),
259
+ ...extra,
260
+ };
261
+ return timer.timeEnd(msg, extra);
262
+ };
263
+ }
264
+
265
+ reportAction(sessionId: string, threadId: number | string | undefined, action: string) {
266
+ let extra = this._getExtra(sessionId, threadId);
267
+ if (!extra) {
268
+ // session 不存在,忽略
269
+ return;
270
+ }
271
+ if (threadId && !extra.threadId) {
272
+ extra = {
273
+ ...extra,
274
+ };
275
+ }
276
+ this._actionIndex += 1;
277
+ extra.action = `${action}-${this._actionIndex}`;
278
+
279
+ // 记录被暂停的文件路径和行号
280
+ extra.filePath = this.currentFrame?.raw.source?.path;
281
+ extra.fileLineNumber = this.currentFrame?.raw.line;
282
+ this._setExtra(sessionId, `${threadId ?? ''}`, extra);
283
+ }
284
+
285
+ async start(options: DebugSessionOptions): Promise<DebugSession | undefined> {
286
+ const { configuration } = options;
287
+ const extra: DebugSessionExtra = {
288
+ adapterID: configuration.type,
289
+ request: configuration.request === 'launch' ? 'launch' : 'attach',
290
+ traceId: this._uid,
291
+ remote: 0,
292
+ threads: new Map(),
293
+ };
294
+ if (isRemoteAttach(configuration)) {
295
+ extra.remote = 1;
296
+ }
297
+ this.report(DEBUG_REPORT_NAME.DEBUG_BREAKPOINT, 'number', {
298
+ count: this.breakpoints.getBreakpoints().length,
299
+ ...extra,
300
+ });
301
+ if (!options.configuration.__restart) {
302
+ if (this.isExistedDebugSession(options)) {
303
+ this.messageService.error(formatLocalize('debug.launch.existed', options.configuration.name));
304
+ return;
305
+ }
306
+ }
307
+ try {
308
+ const timeStart = this.reportTime(DEBUG_REPORT_NAME.DEBUG_SESSION_START_TIME, extra);
309
+ await this.fireWillStartDebugSession();
310
+ const resolved = await this.resolveConfiguration(options);
311
+ if (!resolved) {
312
+ if (options.configuration.type) {
313
+ this.messageService.error(formatLocalize('debug.notSupported.type', options.configuration.type));
314
+ } else {
315
+ this.messageService.error(localize('debug.notSupported.any'));
316
+ }
317
+ return;
318
+ } else if (resolved.configuration.preLaunchTask) {
319
+ this.debugProgressService.onDebugServiceStateChange(DebugState.Initializing);
320
+ const workspaceFolderUri = Uri.parse(resolved.workspaceFolderUri!);
321
+ const task = await this.taskService.getTask(workspaceFolderUri, resolved.configuration.preLaunchTask);
322
+ if (task) {
323
+ const timeTask = this.reportTime(DEBUG_REPORT_NAME.DEBUG_PRE_LAUNCH_TASK_TIME, extra);
324
+ const result = await this.taskService.run(task);
325
+ if (result.exitCode !== 0) {
326
+ this.messageService.error(
327
+ `The preLaunchTask ${resolved.configuration.preLaunchTask} exitCode is ${result.exitCode}`,
328
+ );
329
+ }
330
+ timeTask(workspaceFolderUri.toString(), {
331
+ exitCode: result.exitCode,
332
+ });
333
+ }
334
+ this.debugProgressService.onDebugServiceStateChange(DebugState.Running);
335
+ }
336
+ const sessionId = await this.debug.createDebugSession(resolved);
337
+ timeStart(resolved.configuration.type, {
338
+ adapterID: resolved.configuration.type,
339
+ request: resolved.configuration.request,
340
+ sessionId,
341
+ });
342
+ if (!sessionId) {
343
+ this.messageService.error(formatLocalize('debug.launch.typeNotSupported', resolved.configuration.type));
344
+ return;
345
+ }
346
+ return this.doStart(sessionId, resolved, extra);
347
+ } catch (e) {
348
+ if (DebugError.NotFound.is(e)) {
349
+ this.messageService.error(formatLocalize('debug.launch.typeNotSupported', e.data.type));
350
+ return;
351
+ }
352
+
353
+ this.messageService.error(localize('debug.launch.catchError'));
354
+ throw e;
355
+ }
356
+ }
357
+
358
+ async fireWillStartDebugSession(): Promise<void> {
359
+ await WaitUntilEvent.fire(this.onWillStartDebugSessionEmitter, {});
360
+ }
361
+
362
+ protected configurationIds = new Map<string, number>();
363
+ async resolveConfiguration(options: Readonly<DebugSessionOptions>): Promise<IDebugSessionDTO | undefined> {
364
+ if (IDebugSessionDTO.is(options)) {
365
+ return options;
366
+ }
367
+ const { workspaceFolderUri, index, noDebug, parentSession, repl, compact, lifecycleManagedByParent } = options;
368
+
369
+ const resolvedConfiguration = await this.resolveDebugConfiguration(options.configuration, workspaceFolderUri);
370
+ if (resolvedConfiguration && !('cwd' in resolvedConfiguration)) {
371
+ // 当调试配置不存在配置项时,提供默认的 `cwd` 选项
372
+ resolvedConfiguration['cwd'] = '${workspaceFolder}';
373
+ }
374
+ let configuration = await this.variableResolver.resolve(resolvedConfiguration, {});
375
+ if (!configuration) {
376
+ // 当返回值为 `undefined` 或 `null` 时,中断调试
377
+ if (configuration === null) {
378
+ // 当返回值为 `null` 时,打开配置文件
379
+ this.commandService.executeCommand(COMMON_COMMANDS.OPEN_LAUNCH_CONFIGURATION.id);
380
+ }
381
+ return;
382
+ }
383
+ configuration = await this.resolveDebugConfigurationWithSubstitutedVariables(configuration, workspaceFolderUri);
384
+ if (!configuration) {
385
+ // 当返回值为 `undefined` 或 `null` 时,中断调试
386
+ if (configuration === null) {
387
+ // 当返回值为 `null` 时,打开配置文件
388
+ this.commandService.executeCommand(COMMON_COMMANDS.OPEN_LAUNCH_CONFIGURATION.id);
389
+ }
390
+ return;
391
+ }
392
+ const key = configuration.name + workspaceFolderUri;
393
+ const id = this.configurationIds.has(key) ? this.configurationIds.get(key)! + 1 : 0;
394
+ this.configurationIds.set(key, id);
395
+ return {
396
+ id,
397
+ configuration,
398
+ workspaceFolderUri,
399
+ index,
400
+ noDebug,
401
+ parentSession,
402
+ repl,
403
+ compact,
404
+ lifecycleManagedByParent,
405
+ };
406
+ }
407
+
408
+ async resolveDebugConfiguration(
409
+ configuration: DebugConfiguration,
410
+ workspaceFolderUri: string | undefined,
411
+ ): Promise<DebugConfiguration | undefined | null> {
412
+ await this.fireWillResolveDebugConfiguration(configuration.type);
413
+ return this.debug.resolveDebugConfiguration(configuration, workspaceFolderUri);
414
+ }
415
+
416
+ protected async resolveDebugConfigurationWithSubstitutedVariables(
417
+ configuration: DebugConfiguration,
418
+ workspaceFolderUri: string | undefined,
419
+ ): Promise<DebugConfiguration | undefined | null> {
420
+ return this.debug.resolveDebugConfigurationWithSubstitutedVariables(configuration, workspaceFolderUri);
421
+ }
422
+
423
+ async fireWillResolveDebugConfiguration(debugType: string): Promise<void> {
424
+ await WaitUntilEvent.fire(this.onWillResolveDebugConfigurationEmitter, { debugType });
425
+ }
426
+
427
+ protected async doStart(
428
+ sessionId: string,
429
+ options: DebugSessionOptions,
430
+ extra: DebugSessionExtra,
431
+ ): Promise<DebugSession | undefined> {
432
+ const contrib = this.sessionContributionRegistry.get(options.configuration.type);
433
+ if (!contrib) {
434
+ return;
435
+ }
436
+ const sessionFactory = contrib.debugSessionFactory();
437
+ const session = sessionFactory.get(sessionId, options);
438
+ this._sessions.set(sessionId, session);
439
+ this._extraMap.set(sessionId, extra);
440
+
441
+ this.debugTypeKey.set(session.configuration.type);
442
+ this.onDidCreateDebugSessionEmitter.fire(session);
443
+
444
+ let state = DebugState.Inactive;
445
+ session.onDidChange(() => {
446
+ if (state !== session.state) {
447
+ state = session.state;
448
+ if (state === DebugState.Stopped) {
449
+ this.onDidStopDebugSessionEmitter.fire(session);
450
+ this.debugStopped.set(true);
451
+ } else {
452
+ this.debugStopped.set(false);
453
+ }
454
+ }
455
+ this.debugContextKey.contextSetVariableSupported.set(session.capabilities.supportsSetVariable ?? false);
456
+ this.debugContextKey.contextRestartFrameSupported.set(session.capabilities.supportsRestartFrame ?? false);
457
+ this.debugContextKey.contextDebugState.set(DebugState[session.state] as keyof typeof DebugState);
458
+ this.debugContextKey.contextInDdebugMode.set(state !== DebugState.Inactive);
459
+ });
460
+ session.on('terminated', (event) => {
461
+ const restart = event.body && event.body.restart;
462
+ if (restart) {
463
+ this.doRestart(session, restart);
464
+ } else {
465
+ this.destroy(session.id);
466
+ }
467
+ });
468
+ session.on('exited', () => this.destroy(session.id));
469
+ session.start().then(() => this.onDidStartDebugSessionEmitter.fire(session));
470
+ session.onDidCustomEvent(({ event, body }) =>
471
+ this.onDidReceiveDebugSessionCustomEventEmitter.fire({ event, body, session }),
472
+ );
473
+
474
+ this.updateCurrentSession(session);
475
+ return session;
476
+ }
477
+
478
+ protected isExistedDebugSession(options: DebugSessionOptions): boolean {
479
+ const { name } = options.configuration;
480
+ for (const [, session] of this._sessions) {
481
+ if (session.configuration.name === name && !session.terminated) {
482
+ return true;
483
+ }
484
+ }
485
+ return false;
486
+ }
487
+
488
+ restart(): Promise<DebugSession | undefined>;
489
+ restart(session: DebugSession): Promise<DebugSession>;
490
+ async restart(session: DebugSession | undefined = this.currentSession): Promise<DebugSession | undefined> {
491
+ return session && this.doRestart(session);
492
+ }
493
+ protected async doRestart(session: DebugSession, restart?: any): Promise<DebugSession | undefined> {
494
+ if (await session.restart()) {
495
+ return session;
496
+ }
497
+ await session.terminate(true);
498
+ const { options, configuration } = session;
499
+ configuration.__restart = restart;
500
+ return this.start(options);
501
+ }
502
+ public updateCurrentSession(session: DebugSession | undefined) {
503
+ this.currentSession = session || this.sessions[this.sessions.length - 1];
504
+ }
505
+
506
+ get inDebugMode(): boolean {
507
+ return this.state > DebugState.Inactive;
508
+ }
509
+
510
+ get currentThread(): DebugThread | undefined {
511
+ const session = this.currentSession;
512
+ return session && session.currentThread;
513
+ }
514
+
515
+ get state(): DebugState {
516
+ const session = this.currentSession;
517
+ return session ? session.state : DebugState.Inactive;
518
+ }
519
+
520
+ get currentFrame(): DebugStackFrame | undefined {
521
+ const { currentThread } = this;
522
+ return currentThread && currentThread.currentFrame;
523
+ }
524
+ get topFrame(): DebugStackFrame | undefined {
525
+ const { currentThread } = this;
526
+ return currentThread && currentThread.topFrame;
527
+ }
528
+
529
+ getSession(sessionId: string | undefined): DebugSession | undefined {
530
+ if (sessionId) {
531
+ return this._sessions.get(sessionId);
532
+ }
533
+ return undefined;
534
+ }
535
+
536
+ get sessions(): DebugSession[] {
537
+ return Array.from(this._sessions.values()).filter((session) => session.state > DebugState.Inactive);
538
+ }
539
+
540
+ protected _currentSession: DebugSession | undefined;
541
+ protected readonly toDisposeOnCurrentSession = new DisposableCollection();
542
+ get currentSession(): DebugSession | undefined {
543
+ return this._currentSession;
544
+ }
545
+ set currentSession(current: DebugSession | undefined) {
546
+ if (this._currentSession === current) {
547
+ return;
548
+ }
549
+ this.toDisposeOnCurrentSession.dispose();
550
+ const previous = this._currentSession;
551
+ this._currentSession = current;
552
+ this.onDidChangeActiveDebugSessionEmitter.fire({ previous, current });
553
+ if (current) {
554
+ this.toDisposeOnCurrentSession.push(
555
+ current.onDidChange(() => {
556
+ if (this.currentFrame === this.topFrame) {
557
+ this.open();
558
+ }
559
+ this.fireDidChange(current);
560
+ }),
561
+ );
562
+ this.toDisposeOnCurrentSession.push(
563
+ current.onCurrentThreadChange(() => {
564
+ this.fireDidChange(current);
565
+ }),
566
+ );
567
+ }
568
+ this.open();
569
+ this.fireDidChange(current);
570
+ }
571
+
572
+ open(): void {
573
+ const { currentFrame } = this;
574
+ if (currentFrame) {
575
+ currentFrame.open();
576
+ }
577
+ }
578
+
579
+ async stopSession(session: DebugSession | undefined, disconnect = false): Promise<any> {
580
+ if (session) {
581
+ return disconnect ? session.disconnect() : session.terminate();
582
+ }
583
+
584
+ return Promise.all(this.sessions.map((s) => (disconnect ? s.disconnect() : s.terminate())));
585
+ }
586
+
587
+ /**
588
+ * 根据sessionId销毁进程
589
+ * @param sessionId
590
+ */
591
+ destroy(sessionId?: string): void {
592
+ if (sessionId) {
593
+ const session = this._sessions.get(sessionId);
594
+ if (session) {
595
+ this.doDestroy(session);
596
+ }
597
+ } else {
598
+ this._sessions.forEach((session) => this.doDestroy(session));
599
+ }
600
+ }
601
+
602
+ private doDestroy(session: DebugSession): void {
603
+ this.debug.terminateDebugSession(session.id);
604
+
605
+ this.remove(session.id);
606
+ session.dispose();
607
+ this.onDidDestroyDebugSessionEmitter.fire(session);
608
+ }
609
+
610
+ protected remove(sessionId: string): void {
611
+ this._sessions.delete(sessionId);
612
+ const { currentSession } = this;
613
+ if (currentSession && currentSession.id === sessionId) {
614
+ this.updateCurrentSession(undefined);
615
+ }
616
+ // server 有可能会先返回一个 exited 事件,导致 destroy 先触发
617
+ // 包一个 setTimeout 等埋点上报后再清理
618
+ setTimeout(() => {
619
+ this._extraMap.delete(sessionId);
620
+ });
621
+ }
622
+ }