@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.0.1

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 (352) hide show
  1. package/LICENSE +21 -0
  2. package/out/src/bind-host.d.ts +3 -0
  3. package/out/src/bind-host.js +52 -0
  4. package/out/src/bind-host.js.map +1 -0
  5. package/out/src/context-keys.d.ts +4 -0
  6. package/out/src/context-keys.js +54 -0
  7. package/out/src/context-keys.js.map +1 -0
  8. package/out/src/dap-evaluate.d.ts +84 -0
  9. package/out/src/dap-evaluate.js +442 -0
  10. package/out/src/dap-evaluate.js.map +1 -0
  11. package/out/src/dap-output.d.ts +50 -0
  12. package/out/src/dap-output.js +177 -0
  13. package/out/src/dap-output.js.map +1 -0
  14. package/out/src/debug/adapter-resolution.d.ts +56 -0
  15. package/out/src/debug/adapter-resolution.js +112 -0
  16. package/out/src/debug/adapter-resolution.js.map +1 -0
  17. package/out/src/debug/dap-messages.d.ts +18 -0
  18. package/out/src/debug/dap-messages.js +71 -0
  19. package/out/src/debug/dap-messages.js.map +1 -0
  20. package/out/src/debug/index.d.ts +7 -0
  21. package/out/src/debug/index.js +27 -0
  22. package/out/src/debug/index.js.map +1 -0
  23. package/out/src/debug/launch-config.d.ts +42 -0
  24. package/out/src/debug/launch-config.js +73 -0
  25. package/out/src/debug/launch-config.js.map +1 -0
  26. package/out/src/debug/launch-lifecycle.d.ts +29 -0
  27. package/out/src/debug/launch-lifecycle.js +40 -0
  28. package/out/src/debug/launch-lifecycle.js.map +1 -0
  29. package/out/src/debug/poll.d.ts +25 -0
  30. package/out/src/debug/poll.js +70 -0
  31. package/out/src/debug/poll.js.map +1 -0
  32. package/out/src/debug/profiling.d.ts +34 -0
  33. package/out/src/debug/profiling.js +81 -0
  34. package/out/src/debug/profiling.js.map +1 -0
  35. package/out/src/debug/testing/assertions.d.ts +27 -0
  36. package/out/src/debug/testing/assertions.js +111 -0
  37. package/out/src/debug/testing/assertions.js.map +1 -0
  38. package/out/src/debug/testing/dap-client.d.ts +86 -0
  39. package/out/src/debug/testing/dap-client.js +204 -0
  40. package/out/src/debug/testing/dap-client.js.map +1 -0
  41. package/out/src/debug/testing/index.d.ts +7 -0
  42. package/out/src/debug/testing/index.js +31 -0
  43. package/out/src/debug/testing/index.js.map +1 -0
  44. package/out/src/debug/testing/vscode-harness.d.ts +44 -0
  45. package/out/src/debug/testing/vscode-harness.js +81 -0
  46. package/out/src/debug/testing/vscode-harness.js.map +1 -0
  47. package/out/src/debug/ui-stubs.d.ts +26 -0
  48. package/out/src/debug/ui-stubs.js +88 -0
  49. package/out/src/debug/ui-stubs.js.map +1 -0
  50. package/out/src/debug-link-setup.d.ts +4 -0
  51. package/out/src/debug-link-setup.js +19 -0
  52. package/out/src/debug-link-setup.js.map +1 -0
  53. package/out/src/debug-link-view.d.ts +4 -0
  54. package/out/src/debug-link-view.js +49 -0
  55. package/out/src/debug-link-view.js.map +1 -0
  56. package/out/src/debug-link.d.ts +6 -0
  57. package/out/src/debug-link.js +95 -0
  58. package/out/src/debug-link.js.map +1 -0
  59. package/out/src/debug-selection.d.ts +14 -0
  60. package/out/src/debug-selection.js +33 -0
  61. package/out/src/debug-selection.js.map +1 -0
  62. package/out/src/debuggee-pause.d.ts +11 -0
  63. package/out/src/debuggee-pause.js +109 -0
  64. package/out/src/debuggee-pause.js.map +1 -0
  65. package/out/src/editor-path-key.d.ts +52 -0
  66. package/out/src/editor-path-key.js +105 -0
  67. package/out/src/editor-path-key.js.map +1 -0
  68. package/out/src/failure.d.ts +5 -0
  69. package/out/src/failure.js +53 -0
  70. package/out/src/failure.js.map +1 -0
  71. package/out/src/file-log-sink.d.ts +20 -0
  72. package/out/src/file-log-sink.js +74 -0
  73. package/out/src/file-log-sink.js.map +1 -0
  74. package/out/src/flame-html.d.ts +8 -0
  75. package/out/src/flame-html.js +104 -0
  76. package/out/src/flame-html.js.map +1 -0
  77. package/out/src/flame-model.d.ts +93 -0
  78. package/out/src/flame-model.js +242 -0
  79. package/out/src/flame-model.js.map +1 -0
  80. package/out/src/flame-script-helpers.d.ts +26 -0
  81. package/out/src/flame-script-helpers.js +71 -0
  82. package/out/src/flame-script-helpers.js.map +1 -0
  83. package/out/src/flame-script.d.ts +1 -0
  84. package/out/src/flame-script.js +332 -0
  85. package/out/src/flame-script.js.map +1 -0
  86. package/out/src/flame-time-order.d.ts +14 -0
  87. package/out/src/flame-time-order.js +112 -0
  88. package/out/src/flame-time-order.js.map +1 -0
  89. package/out/src/flamegraph-artifact.d.ts +9 -0
  90. package/out/src/flamegraph-artifact.js +45 -0
  91. package/out/src/flamegraph-artifact.js.map +1 -0
  92. package/out/src/host.d.ts +31 -0
  93. package/out/src/host.js +6 -0
  94. package/out/src/host.js.map +1 -0
  95. package/out/src/ids.d.ts +27 -0
  96. package/out/src/ids.js +63 -0
  97. package/out/src/ids.js.map +1 -0
  98. package/out/src/index.d.ts +42 -0
  99. package/out/src/index.js +98 -0
  100. package/out/src/index.js.map +1 -0
  101. package/out/src/logger.d.ts +50 -0
  102. package/out/src/logger.js +86 -0
  103. package/out/src/logger.js.map +1 -0
  104. package/out/src/memory-autopilot.d.ts +64 -0
  105. package/out/src/memory-autopilot.js +306 -0
  106. package/out/src/memory-autopilot.js.map +1 -0
  107. package/out/src/memory-capture-ids.d.ts +17 -0
  108. package/out/src/memory-capture-ids.js +45 -0
  109. package/out/src/memory-capture-ids.js.map +1 -0
  110. package/out/src/memory-capture-ingest.d.ts +15 -0
  111. package/out/src/memory-capture-ingest.js +84 -0
  112. package/out/src/memory-capture-ingest.js.map +1 -0
  113. package/out/src/memory-capture-legs.d.ts +4 -0
  114. package/out/src/memory-capture-legs.js +55 -0
  115. package/out/src/memory-capture-legs.js.map +1 -0
  116. package/out/src/memory-capture-present.d.ts +32 -0
  117. package/out/src/memory-capture-present.js +71 -0
  118. package/out/src/memory-capture-present.js.map +1 -0
  119. package/out/src/memory-capture-roundtrip.d.ts +17 -0
  120. package/out/src/memory-capture-roundtrip.js +75 -0
  121. package/out/src/memory-capture-roundtrip.js.map +1 -0
  122. package/out/src/memory-capture-state.d.ts +23 -0
  123. package/out/src/memory-capture-state.js +89 -0
  124. package/out/src/memory-capture-state.js.map +1 -0
  125. package/out/src/memory-capture-types.d.ts +28 -0
  126. package/out/src/memory-capture-types.js +70 -0
  127. package/out/src/memory-capture-types.js.map +1 -0
  128. package/out/src/memory-capture.d.ts +24 -0
  129. package/out/src/memory-capture.js +51 -0
  130. package/out/src/memory-capture.js.map +1 -0
  131. package/out/src/memory-dashboard-html.d.ts +3 -0
  132. package/out/src/memory-dashboard-html.js +327 -0
  133. package/out/src/memory-dashboard-html.js.map +1 -0
  134. package/out/src/memory-dashboard-mapping.d.ts +34 -0
  135. package/out/src/memory-dashboard-mapping.js +135 -0
  136. package/out/src/memory-dashboard-mapping.js.map +1 -0
  137. package/out/src/memory-dashboard.d.ts +82 -0
  138. package/out/src/memory-dashboard.js +142 -0
  139. package/out/src/memory-dashboard.js.map +1 -0
  140. package/out/src/memory-decorations.d.ts +61 -0
  141. package/out/src/memory-decorations.js +247 -0
  142. package/out/src/memory-decorations.js.map +1 -0
  143. package/out/src/memory-finalize.d.ts +25 -0
  144. package/out/src/memory-finalize.js +207 -0
  145. package/out/src/memory-finalize.js.map +1 -0
  146. package/out/src/memory-guidance.d.ts +14 -0
  147. package/out/src/memory-guidance.js +36 -0
  148. package/out/src/memory-guidance.js.map +1 -0
  149. package/out/src/memory-inspect-commands.d.ts +20 -0
  150. package/out/src/memory-inspect-commands.js +114 -0
  151. package/out/src/memory-inspect-commands.js.map +1 -0
  152. package/out/src/memory-launch-direct.d.ts +12 -0
  153. package/out/src/memory-launch-direct.js +74 -0
  154. package/out/src/memory-launch-direct.js.map +1 -0
  155. package/out/src/memory-launch.d.ts +4 -0
  156. package/out/src/memory-launch.js +92 -0
  157. package/out/src/memory-launch.js.map +1 -0
  158. package/out/src/memory-leak-offer.d.ts +18 -0
  159. package/out/src/memory-leak-offer.js +51 -0
  160. package/out/src/memory-leak-offer.js.map +1 -0
  161. package/out/src/memory-profiler.d.ts +27 -0
  162. package/out/src/memory-profiler.js +71 -0
  163. package/out/src/memory-profiler.js.map +1 -0
  164. package/out/src/memory-ref-graph.d.ts +62 -0
  165. package/out/src/memory-ref-graph.js +248 -0
  166. package/out/src/memory-ref-graph.js.map +1 -0
  167. package/out/src/memory-ref-picker.d.ts +21 -0
  168. package/out/src/memory-ref-picker.js +103 -0
  169. package/out/src/memory-ref-picker.js.map +1 -0
  170. package/out/src/memory-registration.d.ts +4 -0
  171. package/out/src/memory-registration.js +63 -0
  172. package/out/src/memory-registration.js.map +1 -0
  173. package/out/src/memory-start-core.d.ts +8 -0
  174. package/out/src/memory-start-core.js +165 -0
  175. package/out/src/memory-start-core.js.map +1 -0
  176. package/out/src/memory-start-stop-commands.d.ts +10 -0
  177. package/out/src/memory-start-stop-commands.js +75 -0
  178. package/out/src/memory-start-stop-commands.js.map +1 -0
  179. package/out/src/memory-start.d.ts +6 -0
  180. package/out/src/memory-start.js +13 -0
  181. package/out/src/memory-start.js.map +1 -0
  182. package/out/src/memory-status.d.ts +24 -0
  183. package/out/src/memory-status.js +135 -0
  184. package/out/src/memory-status.js.map +1 -0
  185. package/out/src/palette-vscode.d.ts +2 -0
  186. package/out/src/palette-vscode.js +50 -0
  187. package/out/src/palette-vscode.js.map +1 -0
  188. package/out/src/palette.d.ts +70 -0
  189. package/out/src/palette.js +150 -0
  190. package/out/src/palette.js.map +1 -0
  191. package/out/src/process-bind-panel.d.ts +11 -0
  192. package/out/src/process-bind-panel.js +65 -0
  193. package/out/src/process-bind-panel.js.map +1 -0
  194. package/out/src/process-commands.d.ts +5 -0
  195. package/out/src/process-commands.js +112 -0
  196. package/out/src/process-commands.js.map +1 -0
  197. package/out/src/process-context-keys.d.ts +11 -0
  198. package/out/src/process-context-keys.js +48 -0
  199. package/out/src/process-context-keys.js.map +1 -0
  200. package/out/src/process-decoration.d.ts +18 -0
  201. package/out/src/process-decoration.js +76 -0
  202. package/out/src/process-decoration.js.map +1 -0
  203. package/out/src/process-explorer-rows.d.ts +59 -0
  204. package/out/src/process-explorer-rows.js +47 -0
  205. package/out/src/process-explorer-rows.js.map +1 -0
  206. package/out/src/process-explorer.d.ts +66 -0
  207. package/out/src/process-explorer.js +241 -0
  208. package/out/src/process-explorer.js.map +1 -0
  209. package/out/src/process-group-item.d.ts +8 -0
  210. package/out/src/process-group-item.js +55 -0
  211. package/out/src/process-group-item.js.map +1 -0
  212. package/out/src/process-launch-item.d.ts +12 -0
  213. package/out/src/process-launch-item.js +57 -0
  214. package/out/src/process-launch-item.js.map +1 -0
  215. package/out/src/process-launch.d.ts +47 -0
  216. package/out/src/process-launch.js +205 -0
  217. package/out/src/process-launch.js.map +1 -0
  218. package/out/src/process-message-item.d.ts +10 -0
  219. package/out/src/process-message-item.js +53 -0
  220. package/out/src/process-message-item.js.map +1 -0
  221. package/out/src/process-poll.d.ts +26 -0
  222. package/out/src/process-poll.js +125 -0
  223. package/out/src/process-poll.js.map +1 -0
  224. package/out/src/process-reactivity.d.ts +55 -0
  225. package/out/src/process-reactivity.js +188 -0
  226. package/out/src/process-reactivity.js.map +1 -0
  227. package/out/src/process-registration.d.ts +11 -0
  228. package/out/src/process-registration.js +55 -0
  229. package/out/src/process-registration.js.map +1 -0
  230. package/out/src/process-tree-item.d.ts +18 -0
  231. package/out/src/process-tree-item.js +219 -0
  232. package/out/src/process-tree-item.js.map +1 -0
  233. package/out/src/processes-state.d.ts +75 -0
  234. package/out/src/processes-state.js +76 -0
  235. package/out/src/processes-state.js.map +1 -0
  236. package/out/src/profile-on-launch.d.ts +4 -0
  237. package/out/src/profile-on-launch.js +16 -0
  238. package/out/src/profile-on-launch.js.map +1 -0
  239. package/out/src/profile-server.d.ts +24 -0
  240. package/out/src/profile-server.js +170 -0
  241. package/out/src/profile-server.js.map +1 -0
  242. package/out/src/profiler-attach.d.ts +19 -0
  243. package/out/src/profiler-attach.js +129 -0
  244. package/out/src/profiler-attach.js.map +1 -0
  245. package/out/src/profiler-commands.d.ts +8 -0
  246. package/out/src/profiler-commands.js +110 -0
  247. package/out/src/profiler-commands.js.map +1 -0
  248. package/out/src/profiler-decorations.d.ts +74 -0
  249. package/out/src/profiler-decorations.js +237 -0
  250. package/out/src/profiler-decorations.js.map +1 -0
  251. package/out/src/profiler-dispose.d.ts +6 -0
  252. package/out/src/profiler-dispose.js +20 -0
  253. package/out/src/profiler-dispose.js.map +1 -0
  254. package/out/src/profiler-flamegraph-html.d.ts +61 -0
  255. package/out/src/profiler-flamegraph-html.js +366 -0
  256. package/out/src/profiler-flamegraph-html.js.map +1 -0
  257. package/out/src/profiler-format.d.ts +10 -0
  258. package/out/src/profiler-format.js +28 -0
  259. package/out/src/profiler-format.js.map +1 -0
  260. package/out/src/profiler-launch-cooperative.d.ts +16 -0
  261. package/out/src/profiler-launch-cooperative.js +167 -0
  262. package/out/src/profiler-launch-cooperative.js.map +1 -0
  263. package/out/src/profiler-launch.d.ts +29 -0
  264. package/out/src/profiler-launch.js +123 -0
  265. package/out/src/profiler-launch.js.map +1 -0
  266. package/out/src/profiler-results.d.ts +22 -0
  267. package/out/src/profiler-results.js +104 -0
  268. package/out/src/profiler-results.js.map +1 -0
  269. package/out/src/profiler-session-core.d.ts +42 -0
  270. package/out/src/profiler-session-core.js +116 -0
  271. package/out/src/profiler-session-core.js.map +1 -0
  272. package/out/src/profiler-state.d.ts +87 -0
  273. package/out/src/profiler-state.js +83 -0
  274. package/out/src/profiler-state.js.map +1 -0
  275. package/out/src/profiler-status.d.ts +38 -0
  276. package/out/src/profiler-status.js +163 -0
  277. package/out/src/profiler-status.js.map +1 -0
  278. package/out/src/profiler-styles.d.ts +21 -0
  279. package/out/src/profiler-styles.js +160 -0
  280. package/out/src/profiler-styles.js.map +1 -0
  281. package/out/src/profiler-webview.d.ts +95 -0
  282. package/out/src/profiler-webview.js +243 -0
  283. package/out/src/profiler-webview.js.map +1 -0
  284. package/out/src/profiler.d.ts +23 -0
  285. package/out/src/profiler.js +113 -0
  286. package/out/src/profiler.js.map +1 -0
  287. package/out/src/progress-ops.d.ts +24 -0
  288. package/out/src/progress-ops.js +135 -0
  289. package/out/src/progress-ops.js.map +1 -0
  290. package/out/src/reactive-refresh.d.ts +24 -0
  291. package/out/src/reactive-refresh.js +33 -0
  292. package/out/src/reactive-refresh.js.map +1 -0
  293. package/out/src/sample-summary.d.ts +39 -0
  294. package/out/src/sample-summary.js +32 -0
  295. package/out/src/sample-summary.js.map +1 -0
  296. package/out/src/sampled-view.d.ts +15 -0
  297. package/out/src/sampled-view.js +56 -0
  298. package/out/src/sampled-view.js.map +1 -0
  299. package/out/src/server-command.d.ts +4 -0
  300. package/out/src/server-command.js +14 -0
  301. package/out/src/server-command.js.map +1 -0
  302. package/out/src/settings.d.ts +1 -0
  303. package/out/src/settings.js +22 -0
  304. package/out/src/settings.js.map +1 -0
  305. package/out/src/store.d.ts +34 -0
  306. package/out/src/store.js +64 -0
  307. package/out/src/store.js.map +1 -0
  308. package/out/src/testing/cpu-capture-assertions.d.ts +8 -0
  309. package/out/src/testing/cpu-capture-assertions.js +71 -0
  310. package/out/src/testing/cpu-capture-assertions.js.map +1 -0
  311. package/out/src/testing/cpu-capture-contract.d.ts +8 -0
  312. package/out/src/testing/cpu-capture-contract.js +123 -0
  313. package/out/src/testing/cpu-capture-contract.js.map +1 -0
  314. package/out/src/testing/webview-contract-helpers.d.ts +24 -0
  315. package/out/src/testing/webview-contract-helpers.js +125 -0
  316. package/out/src/testing/webview-contract-helpers.js.map +1 -0
  317. package/out/src/testing/webview-contract-leak.d.ts +2 -0
  318. package/out/src/testing/webview-contract-leak.js +80 -0
  319. package/out/src/testing/webview-contract-leak.js.map +1 -0
  320. package/out/src/testing/webview-contract-memory.d.ts +5 -0
  321. package/out/src/testing/webview-contract-memory.js +221 -0
  322. package/out/src/testing/webview-contract-memory.js.map +1 -0
  323. package/out/src/testing/webview-contract-palette.d.ts +6 -0
  324. package/out/src/testing/webview-contract-palette.js +121 -0
  325. package/out/src/testing/webview-contract-palette.js.map +1 -0
  326. package/out/src/testing/webview-contract-panel.d.ts +7 -0
  327. package/out/src/testing/webview-contract-panel.js +100 -0
  328. package/out/src/testing/webview-contract-panel.js.map +1 -0
  329. package/out/src/testing/webview-contract-results.d.ts +6 -0
  330. package/out/src/testing/webview-contract-results.js +136 -0
  331. package/out/src/testing/webview-contract-results.js.map +1 -0
  332. package/out/src/testing/webview-contract.d.ts +18 -0
  333. package/out/src/testing/webview-contract.js +23 -0
  334. package/out/src/testing/webview-contract.js.map +1 -0
  335. package/out/src/timeouts.d.ts +21 -0
  336. package/out/src/timeouts.js +30 -0
  337. package/out/src/timeouts.js.map +1 -0
  338. package/out/src/trace-actions.d.ts +33 -0
  339. package/out/src/trace-actions.js +135 -0
  340. package/out/src/trace-actions.js.map +1 -0
  341. package/out/src/unknown-shape.d.ts +58 -0
  342. package/out/src/unknown-shape.js +110 -0
  343. package/out/src/unknown-shape.js.map +1 -0
  344. package/out/src/wire-adapters.d.ts +18 -0
  345. package/out/src/wire-adapters.js +160 -0
  346. package/out/src/wire-adapters.js.map +1 -0
  347. package/out/src/wire-generated.d.ts +760 -0
  348. package/out/src/wire-generated.js +38 -0
  349. package/out/src/wire-generated.js.map +1 -0
  350. package/package.json +53 -4
  351. package/scripts/contributions.mjs +187 -0
  352. package/README.md +0 -3
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ // A DAP test client over a session that exposes `customRequest` (the shape VS
3
+ // Code's DebugSession provides). Every wrapper is language-neutral and depends
4
+ // only on `customRequest`, so it unit-tests against a fake session and drives a
5
+ // real session in a VS Code test host unchanged. This is the harness Osprey,
6
+ // Basilisk and SharpLsp e2e suites share instead of each re-deriving it.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.threads = threads;
9
+ exports.stackTrace = stackTrace;
10
+ exports.scopes = scopes;
11
+ exports.variables = variables;
12
+ exports.evaluate = evaluate;
13
+ exports.stepOver = stepOver;
14
+ exports.stepIn = stepIn;
15
+ exports.stepOut = stepOut;
16
+ exports.continueExecution = continueExecution;
17
+ exports.readFrameVariables = readFrameVariables;
18
+ exports.findVariable = findVariable;
19
+ exports.waitForStop = waitForStop;
20
+ const poll_1 = require("../poll");
21
+ const DEFAULT_STACK_LEVELS = 20;
22
+ const DEFAULT_STOP_TIMEOUT_MS = 30_000;
23
+ const STOP_POLL_INTERVAL_MS = 100;
24
+ /** True when `value` is a non-null object whose fields can be inspected. */
25
+ function isRecord(value) {
26
+ return typeof value === "object" && value !== null;
27
+ }
28
+ /** The elements of `value` when it is an array, and no elements otherwise. */
29
+ function arrayItems(value) {
30
+ return Array.isArray(value) ? value : [];
31
+ }
32
+ /** True when an optional field is absent or a string. */
33
+ function isOptionalString(value) {
34
+ return value === undefined || typeof value === "string";
35
+ }
36
+ function isThread(value) {
37
+ return isRecord(value) && typeof value.id === "number" && typeof value.name === "string";
38
+ }
39
+ function isFrameSource(value) {
40
+ return isRecord(value) && isOptionalString(value.path) && isOptionalString(value.name);
41
+ }
42
+ function isStackFrame(value) {
43
+ return (isRecord(value) &&
44
+ typeof value.id === "number" &&
45
+ typeof value.name === "string" &&
46
+ typeof value.line === "number" &&
47
+ typeof value.column === "number" &&
48
+ (value.source === undefined || isFrameSource(value.source)));
49
+ }
50
+ function isScope(value) {
51
+ return (isRecord(value) &&
52
+ typeof value.name === "string" &&
53
+ typeof value.variablesReference === "number" &&
54
+ (value.expensive === undefined || typeof value.expensive === "boolean"));
55
+ }
56
+ function isVariable(value) {
57
+ return (isRecord(value) &&
58
+ typeof value.name === "string" &&
59
+ typeof value.value === "string" &&
60
+ typeof value.variablesReference === "number" &&
61
+ isOptionalString(value.type));
62
+ }
63
+ function isEvaluateResult(value) {
64
+ return (isRecord(value) &&
65
+ typeof value.result === "string" &&
66
+ typeof value.variablesReference === "number" &&
67
+ isOptionalString(value.type));
68
+ }
69
+ /** The `key` array of a response body, keeping only well-formed entries. */
70
+ function arrayField(body, key, isItem) {
71
+ return isRecord(body)
72
+ ? arrayItems(body[key]).filter((item) => isItem(item))
73
+ : [];
74
+ }
75
+ /** All threads currently known to the adapter. */
76
+ async function threads(session) {
77
+ const response = await session.customRequest("threads");
78
+ return arrayField(response, "threads", isThread);
79
+ }
80
+ /** The stack trace for a thread. */
81
+ async function stackTrace(session, threadId, levels = DEFAULT_STACK_LEVELS) {
82
+ const response = await session.customRequest("stackTrace", {
83
+ threadId,
84
+ startFrame: 0,
85
+ levels,
86
+ });
87
+ return { stackFrames: arrayField(response, "stackFrames", isStackFrame) };
88
+ }
89
+ /** The scopes of a stack frame. */
90
+ async function scopes(session, frameId) {
91
+ const response = await session.customRequest("scopes", { frameId });
92
+ return { scopes: arrayField(response, "scopes", isScope) };
93
+ }
94
+ /** The variables under a variablesReference. */
95
+ async function variables(session, variablesReference) {
96
+ const response = await session.customRequest("variables", { variablesReference });
97
+ return { variables: arrayField(response, "variables", isVariable) };
98
+ }
99
+ /** The result used when the adapter answers `evaluate` malformed. */
100
+ function emptyEvaluateResult() {
101
+ return { result: "", variablesReference: 0 };
102
+ }
103
+ /** Evaluate an expression in a frame (watch/repl/hover context). */
104
+ async function evaluate(session, request) {
105
+ const { expression, frameId, context = "watch" } = request;
106
+ const response = await session.customRequest("evaluate", {
107
+ expression,
108
+ frameId,
109
+ context,
110
+ });
111
+ return isEvaluateResult(response) ? response : emptyEvaluateResult();
112
+ }
113
+ /** Issue a thread-scoped DAP request (step/resume), awaiting its response. */
114
+ async function threadRequest(session, command, threadId) {
115
+ const response = await session.customRequest(command, { threadId });
116
+ return response;
117
+ }
118
+ /** Step over (DAP `next`). */
119
+ async function stepOver(session, threadId) {
120
+ const response = await threadRequest(session, "next", threadId);
121
+ return response;
122
+ }
123
+ /** Step into (DAP `stepIn`). */
124
+ async function stepIn(session, threadId) {
125
+ const response = await threadRequest(session, "stepIn", threadId);
126
+ return response;
127
+ }
128
+ /** Step out (DAP `stepOut`). */
129
+ async function stepOut(session, threadId) {
130
+ const response = await threadRequest(session, "stepOut", threadId);
131
+ return response;
132
+ }
133
+ /** Resume (DAP `continue`). */
134
+ async function continueExecution(session, threadId) {
135
+ const response = await threadRequest(session, "continue", threadId);
136
+ return response;
137
+ }
138
+ /** Flatten every concrete (referenceable) scope's variables for a frame. */
139
+ async function readFrameVariables(session, frameId) {
140
+ const frameScopes = await scopes(session, frameId);
141
+ const groups = await Promise.all(frameScopes.scopes
142
+ .filter((scope) => scope.variablesReference > 0)
143
+ .map(async (scope) => {
144
+ const group = await variables(session, scope.variablesReference);
145
+ return group.variables;
146
+ }));
147
+ return groups.flat();
148
+ }
149
+ /** Find a named local/argument in a frame, or undefined. */
150
+ async function findVariable(session, frameId, name) {
151
+ const all = await readFrameVariables(session, frameId);
152
+ return all.find((variable) => variable.name === name);
153
+ }
154
+ /** The first thread, in order, whose stack has at least one frame. */
155
+ async function firstStopped(session, candidates) {
156
+ const [thread, ...rest] = candidates;
157
+ if (thread === undefined) {
158
+ return undefined;
159
+ }
160
+ const stack = await stackTraceQuietly(session, thread.id);
161
+ if (stack !== undefined && stack.stackFrames.length > 0) {
162
+ return { threadId: thread.id, stack };
163
+ }
164
+ return firstStopped(session, rest);
165
+ }
166
+ /** One poll: look for a stopped thread among every thread the adapter knows. */
167
+ async function probeForStop(session) {
168
+ return firstStopped(session, await threadsQuietly(session));
169
+ }
170
+ /**
171
+ * Poll until the debuggee is stopped with at least one stack frame, returning
172
+ * the stopped thread and its stack. Resolves the first thread that reports a
173
+ * frame. Throws a labelled error on timeout.
174
+ */
175
+ async function waitForStop(session, timeoutMs = DEFAULT_STOP_TIMEOUT_MS) {
176
+ const probe = () => probeForStop(session);
177
+ const stop = await (0, poll_1.pollUntilResult)({
178
+ fn: probe,
179
+ predicate: (value) => value !== undefined,
180
+ timeoutMs,
181
+ intervalMs: STOP_POLL_INTERVAL_MS,
182
+ });
183
+ if (stop === undefined) {
184
+ throw new Error(`Timed out after ${timeoutMs}ms waiting for the debuggee to stop`);
185
+ }
186
+ return stop;
187
+ }
188
+ async function threadsQuietly(session) {
189
+ try {
190
+ return await threads(session);
191
+ }
192
+ catch {
193
+ return [];
194
+ }
195
+ }
196
+ async function stackTraceQuietly(session, threadId) {
197
+ try {
198
+ return await stackTrace(session, threadId);
199
+ }
200
+ catch {
201
+ return undefined;
202
+ }
203
+ }
204
+ //# sourceMappingURL=dap-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dap-client.js","sourceRoot":"","sources":["../../../../src/debug/testing/dap-client.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,yEAAyE;;;;;;;;;;;;;;AAEzE,kCAA0C;AAqD1C,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,4EAA4E;AAC5E,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,8EAA8E;AAC9E,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,yDAAyD;AACzD,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AAC1D,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC3F,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,gBAAgB,CAAC,KAAK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AC;QACH,OAAO,MAAM,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./dap-client";
2
+ export * from "./assertions";
3
+ export * from "./vscode-harness";
4
+ export { pollUntilResult, waitForCondition, sleep } from "../poll";
5
+ export type { PollOptions } from "../poll";
6
+ export { installUiStubs } from "../ui-stubs";
7
+ export type { UiStubs, UiStubLog, WindowLike } from "../ui-stubs";
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // @nimblesite/lsp-profiler-ui/out/src/debug/testing — the shared DAP integration-test harness:
3
+ // a session-injected DAP client, high-level assertions, and VS Code-bound
4
+ // breakpoint/session helpers. Re-exports poll + ui-stubs so a test file needs a
5
+ // single import.
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.installUiStubs = exports.sleep = exports.waitForCondition = exports.pollUntilResult = void 0;
22
+ __exportStar(require("./dap-client"), exports);
23
+ __exportStar(require("./assertions"), exports);
24
+ __exportStar(require("./vscode-harness"), exports);
25
+ var poll_1 = require("../poll");
26
+ Object.defineProperty(exports, "pollUntilResult", { enumerable: true, get: function () { return poll_1.pollUntilResult; } });
27
+ Object.defineProperty(exports, "waitForCondition", { enumerable: true, get: function () { return poll_1.waitForCondition; } });
28
+ Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return poll_1.sleep; } });
29
+ var ui_stubs_1 = require("../ui-stubs");
30
+ Object.defineProperty(exports, "installUiStubs", { enumerable: true, get: function () { return ui_stubs_1.installUiStubs; } });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/debug/testing/index.ts"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,0EAA0E;AAC1E,gFAAgF;AAChF,iBAAiB;;;;;;;;;;;;;;;;;AAEjB,+CAA6B;AAC7B,+CAA6B;AAC7B,mDAAiC;AACjC,gCAAmE;AAA1D,uGAAA,eAAe,OAAA;AAAE,wGAAA,gBAAgB,OAAA;AAAE,6FAAA,KAAK,OAAA;AAEjD,wCAA6C;AAApC,0GAAA,cAAc,OAAA"}
@@ -0,0 +1,44 @@
1
+ /** The breakpoint subset of `vscode.debug` the tools mutate. */
2
+ export interface VscodeBreakpointApi {
3
+ readonly breakpoints: readonly unknown[];
4
+ addBreakpoints: (breakpoints: unknown[]) => void;
5
+ removeBreakpoints: (breakpoints: readonly unknown[]) => void;
6
+ }
7
+ /** Builds a host SourceBreakpoint (the consumer wires vscode's classes). */
8
+ export type BreakpointFactory = (filePath: string, line: number, condition?: string) => unknown;
9
+ /** A breakpoint spec: a bare 1-based line, or a line with a condition. */
10
+ export type BreakpointSpec = number | {
11
+ line: number;
12
+ condition?: string;
13
+ };
14
+ /** Breakpoint tools bound to a VS Code debug API + breakpoint factory. */
15
+ export interface BreakpointTools {
16
+ /** Replace all breakpoints with one per spec on `filePath`. */
17
+ setSourceBreakpoints: (filePath: string, specs: BreakpointSpec[]) => void;
18
+ /** Remove every breakpoint. */
19
+ clearBreakpoints: () => void;
20
+ }
21
+ /** Bind breakpoint tools to a debug API and a host breakpoint factory. */
22
+ export declare function makeBreakpointTools(api: VscodeBreakpointApi, makeBreakpoint: BreakpointFactory): BreakpointTools;
23
+ /** A started debug session (only the id is read by the waiters). */
24
+ export interface DebugSessionHandle {
25
+ readonly id: string;
26
+ }
27
+ /** What an `onDidStartDebugSession` registration hands back. */
28
+ export interface SessionSubscription {
29
+ dispose: () => void;
30
+ }
31
+ /** The session-lifecycle subset of `vscode.debug`. */
32
+ export interface VscodeSessionApi<TSession extends DebugSessionHandle = DebugSessionHandle> {
33
+ onDidStartDebugSession: (listener: (session: TSession) => void) => SessionSubscription;
34
+ readonly activeDebugSession: TSession | undefined;
35
+ }
36
+ /** Session-lifecycle waiters bound to a VS Code debug API. */
37
+ export interface SessionWaiters<TSession extends DebugSessionHandle> {
38
+ /** Resolve with the next started debug session, or reject on timeout. */
39
+ waitForDebugSessionStart: (timeoutMs?: number) => Promise<TSession>;
40
+ /** Resolve once no (matching) session is active, or reject on timeout. */
41
+ waitForDebugSessionEnd: (timeoutMs?: number, sessionId?: string) => Promise<void>;
42
+ }
43
+ /** Bind session-lifecycle waiters to a debug API. */
44
+ export declare function makeSessionWaiters<TSession extends DebugSessionHandle>(api: VscodeSessionApi<TSession>): SessionWaiters<TSession>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ // VS Code-bound test helpers: source/conditional breakpoint management and
3
+ // debug-session lifecycle waiters. The VS Code `debug` surface and the
4
+ // breakpoint constructor are INJECTED, so these unit-test against fakes and run
5
+ // against the real `vscode` namespace in a test host with no code change.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.makeBreakpointTools = makeBreakpointTools;
8
+ exports.makeSessionWaiters = makeSessionWaiters;
9
+ const poll_1 = require("../poll");
10
+ /** Default budget for the session-lifecycle waiters. */
11
+ const DEFAULT_SESSION_TIMEOUT_MS = 30_000;
12
+ /** Delay between checks that the active debug session has ended. */
13
+ const SESSION_POLL_INTERVAL_MS = 100;
14
+ /** The breakpoint for one spec: a bare line, or a line plus condition. */
15
+ function breakpointFor(makeBreakpoint, filePath, spec) {
16
+ return typeof spec === "number"
17
+ ? makeBreakpoint(filePath, spec)
18
+ : makeBreakpoint(filePath, spec.line, spec.condition);
19
+ }
20
+ /** Bind breakpoint tools to a debug API and a host breakpoint factory. */
21
+ function makeBreakpointTools(api, makeBreakpoint) {
22
+ return {
23
+ setSourceBreakpoints(filePath, specs) {
24
+ api.removeBreakpoints(api.breakpoints);
25
+ api.addBreakpoints(specs.map((spec) => breakpointFor(makeBreakpoint, filePath, spec)));
26
+ },
27
+ clearBreakpoints() {
28
+ api.removeBreakpoints(api.breakpoints);
29
+ },
30
+ };
31
+ }
32
+ /** Resolve with the next started session, rejecting on timeout. */
33
+ async function startSession(api, timeoutMs) {
34
+ const started = [];
35
+ const subscription = api.onDidStartDebugSession((session) => { started.push(session); });
36
+ try {
37
+ const first = await (0, poll_1.pollUntilResult)({
38
+ fn: () => Promise.resolve(started.at(0)),
39
+ predicate: (session) => session !== undefined,
40
+ timeoutMs,
41
+ intervalMs: SESSION_POLL_INTERVAL_MS,
42
+ });
43
+ if (first === undefined) {
44
+ throw new Error(`Debug session did not start within ${timeoutMs}ms`);
45
+ }
46
+ return first;
47
+ }
48
+ finally {
49
+ subscription.dispose();
50
+ }
51
+ }
52
+ /** True when the (matching) session is no longer the active one. */
53
+ function hasEnded(active, sessionId) {
54
+ return active === undefined || (sessionId !== undefined && active.id !== sessionId);
55
+ }
56
+ /** Resolve once no (matching) session is active, or reject on timeout. */
57
+ async function endSession(api, timeoutMs, sessionId) {
58
+ const readActive = () => Promise.resolve(api.activeDebugSession);
59
+ const ended = await (0, poll_1.pollUntilResult)({
60
+ fn: readActive,
61
+ predicate: (active) => hasEnded(active, sessionId),
62
+ timeoutMs,
63
+ intervalMs: SESSION_POLL_INTERVAL_MS,
64
+ });
65
+ if (!hasEnded(ended, sessionId)) {
66
+ throw new Error(`Debug session did not end within ${timeoutMs}ms`);
67
+ }
68
+ }
69
+ /** Bind session-lifecycle waiters to a debug API. */
70
+ function makeSessionWaiters(api) {
71
+ return {
72
+ waitForDebugSessionStart: async (timeoutMs) => {
73
+ const started = await startSession(api, timeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS);
74
+ return started;
75
+ },
76
+ waitForDebugSessionEnd: async (timeoutMs, sessionId) => {
77
+ await endSession(api, timeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS, sessionId);
78
+ },
79
+ };
80
+ }
81
+ //# sourceMappingURL=vscode-harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vscode-harness.js","sourceRoot":"","sources":["../../../../src/debug/testing/vscode-harness.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,gFAAgF;AAChF,0EAA0E;;;;AAE1E,kCAA0C;AAE1C,wDAAwD;AACxD,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAE1C,oEAAoE;AACpE,MAAM,wBAAwB,GAAG,GAAG,CAAC;AA2BrC,0EAA0E;AAC1E,SAAS,aAAa,CACpB,cAAiC,EACjC,QAAgB,EAChB,IAAoB;IAEpB,OAAO,OAAO,IAAI,KAAK,QAAQ;QAC7B,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC;QAChC,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED,0EAA0E;AAC1E,6BACE,GAAwB,EACxB,cAAiC;IAEjC,OAAO;QACL,oBAAoB,CAAC,QAAQ,EAAE,KAAK;YAClC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACvC,GAAG,CAAC,cAAc,CAChB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CACnE,CAAC;QACJ,CAAC;QACD,gBAAgB;YACd,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACz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d,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;QAClD,SAAS;QACT,UAAU,EAAE,wBAAwB;KACrC,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,oCAAoC,SAAS,IAAI,CAAC,CAAC;IACrE,CAAC;AACH,CAAC;AAED,qDAAqD;AACrD,4BACE,GAA+B;IAE/B,OAAO;QACL,wBAAwB,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,SAAS,IAAI,0BAA0B,CAAC,CAAC;YACjF,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,sBAAsB,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE;YACrD,MAAM,UAAU,CAAC,GAAG,EAAE,SAAS,IAAI,0BAA0B,EAAE,SAAS,CAAC,CAAC;QAC5E,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ /** The subset of `vscode.window` the stubs intercept. */
2
+ export interface WindowLike {
3
+ showInformationMessage: (...args: unknown[]) => unknown;
4
+ showWarningMessage: (...args: unknown[]) => unknown;
5
+ showErrorMessage: (...args: unknown[]) => unknown;
6
+ }
7
+ /** Every message the stubbed window was asked to show. */
8
+ export interface UiStubLog {
9
+ readonly infoMessages: string[];
10
+ readonly warningMessages: string[];
11
+ readonly errorMessages: string[];
12
+ }
13
+ /** The installed stub controller. */
14
+ export interface UiStubs {
15
+ readonly log: UiStubLog;
16
+ /** Queue the value the next showInformationMessage resolves to. */
17
+ queueInfo: (...values: (string | undefined)[]) => UiStubs;
18
+ /** Queue the value the next showWarningMessage resolves to. */
19
+ queueWarning: (...values: (string | undefined)[]) => UiStubs;
20
+ /** Queue the value the next showErrorMessage resolves to. */
21
+ queueError: (...values: (string | undefined)[]) => UiStubs;
22
+ /** Restore the original window methods. */
23
+ restore: () => void;
24
+ }
25
+ /** Install the stubs onto `window`, returning a controller. Call restore(). */
26
+ export declare function installUiStubs(window: WindowLike): UiStubs;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ // Queue-backed stubs for VS Code's modal `window.show*Message` dialogs, so an
3
+ // integration test can supply FIFO answers and assert what was prompted without
4
+ // blocking on real UI. Generalized from SharpLsp's installUiStubs; the window
5
+ // object is injected, so it patches the real `vscode.window` in a test host and
6
+ // a plain object under unit test.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.installUiStubs = installUiStubs;
9
+ /** The text a `show*Message` call logged: its first argument, as a string. */
10
+ function firstStringArg(args) {
11
+ const [first] = args;
12
+ if (typeof first === "string") {
13
+ return first;
14
+ }
15
+ if (typeof first === "number" ||
16
+ typeof first === "boolean" ||
17
+ typeof first === "bigint") {
18
+ return String(first);
19
+ }
20
+ return "";
21
+ }
22
+ /** Append queued answers to the queue one prompt will draw from. */
23
+ function pushAnswers(queue, values) {
24
+ queue.push(...values);
25
+ }
26
+ /** One patched window method: log its message, resolve the next queued answer. */
27
+ function makeStub(queue, sink) {
28
+ return (...args) => {
29
+ sink.push(firstStringArg(args));
30
+ return Promise.resolve(queue.shift());
31
+ };
32
+ }
33
+ /** Snapshot the three window methods so {@link UiStubs.restore} can put them back. */
34
+ function snapshotWindow(window) {
35
+ return {
36
+ showInformationMessage: window.showInformationMessage,
37
+ showWarningMessage: window.showWarningMessage,
38
+ showErrorMessage: window.showErrorMessage,
39
+ };
40
+ }
41
+ /** Put the snapshotted methods back onto the window. */
42
+ function restoreWindow(window, originals) {
43
+ window.showInformationMessage = originals.showInformationMessage;
44
+ window.showWarningMessage = originals.showWarningMessage;
45
+ window.showErrorMessage = originals.showErrorMessage;
46
+ }
47
+ /** Replace the three window methods with queue-backed stubs. */
48
+ function patchWindow(state) {
49
+ state.window.showInformationMessage = makeStub(state.queues.showInformationMessage, state.log.infoMessages);
50
+ state.window.showWarningMessage = makeStub(state.queues.showWarningMessage, state.log.warningMessages);
51
+ state.window.showErrorMessage = makeStub(state.queues.showErrorMessage, state.log.errorMessages);
52
+ }
53
+ /** Build the controller the caller queues answers through. */
54
+ function makeController(state) {
55
+ const controller = {
56
+ log: state.log,
57
+ queueInfo(...values) {
58
+ pushAnswers(state.queues.showInformationMessage, values);
59
+ return controller;
60
+ },
61
+ queueWarning(...values) {
62
+ pushAnswers(state.queues.showWarningMessage, values);
63
+ return controller;
64
+ },
65
+ queueError(...values) {
66
+ pushAnswers(state.queues.showErrorMessage, values);
67
+ return controller;
68
+ },
69
+ restore: () => { restoreWindow(state.window, state.originals); },
70
+ };
71
+ return controller;
72
+ }
73
+ /** Install the stubs onto `window`, returning a controller. Call restore(). */
74
+ function installUiStubs(window) {
75
+ const state = {
76
+ window,
77
+ originals: snapshotWindow(window),
78
+ queues: {
79
+ showInformationMessage: [],
80
+ showWarningMessage: [],
81
+ showErrorMessage: [],
82
+ },
83
+ log: { infoMessages: [], warningMessages: [], errorMessages: [] },
84
+ };
85
+ patchWindow(state);
86
+ return makeController(state);
87
+ }
88
+ //# sourceMappingURL=ui-stubs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-stubs.js","sourceRoot":"","sources":["../../../src/debug/ui-stubs.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,kCAAkC;;;AA0ClC,8EAA8E;AAC9E,SAAS,cAAc,CAAC,IAAwB;IAC9C,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAA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AAC/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type * as vscode from "vscode";
2
+ import type { ProfilerStore } from "./store";
3
+ /** Register the debugger "inspect type" link against the profiler store. */
4
+ export declare function registerDebugProfilerSetup(store: ProfilerStore, debugType: string): vscode.Disposable[];
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerDebugProfilerSetup = registerDebugProfilerSetup;
4
+ const debug_link_1 = require("./debug-link");
5
+ const memory_ref_picker_1 = require("./memory-ref-picker");
6
+ /** A debugger variable's type retainers, from the memory session tracking that same debug session. */
7
+ function typeRetainers(store) {
8
+ return async (type, sessionId) => {
9
+ if (store.profiler.value.memoryDebugSessionId !== sessionId) {
10
+ throw new Error("Track this debug session before inspecting type retainers.");
11
+ }
12
+ await (0, memory_ref_picker_1.walkReferences)(store, type);
13
+ };
14
+ }
15
+ /** Register the debugger "inspect type" link against the profiler store. */
16
+ function registerDebugProfilerSetup(store, debugType) {
17
+ return (0, debug_link_1.registerDebugProfilerLink)({ debugType, inspectType: typeRetainers(store) });
18
+ }
19
+ //# sourceMappingURL=debug-link-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-link-setup.js","sourceRoot":"","sources":["../../src/debug-link-setup.ts"],"names":[],"mappings":";;;AAEA,6CAAyD;AACzD,2DAAqD;AAGrD,sGAAsG;AACtG,SAAS,aAAa,CAAC,KAAoB;IACzC,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;QAC/B,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAAC,CAAC;QAC/I,MAAM,IAAA,kCAAc,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,oCAA2C,KAAoB,EAAE,SAAiB;IAChF,OAAO,IAAA,sCAAyB,EAAC,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const DEBUG_LINK_BODY = "<section id=\"debug-variable\" hidden aria-label=\"Debugger variable\">\n <strong id=\"debug-variable-name\"></strong><span id=\"debug-variable-type\"></span>\n <pre id=\"debug-variable-value\"></pre><button id=\"debug-variable-watch\">Add to Watch</button>\n <button id=\"debug-variable-retainers\">Inspect type retainers</button>\n <small>Value captured at the selected debug pause. Type retainers describe the type, not a unique object.</small>\n</section>";
2
+ export declare const DEBUG_LINK_CSS = "#debug-variable { border: 1px solid var(--prof-hot); border-radius: 8px;\n padding: 14px; margin-bottom: 16px; } #debug-variable span { margin-left: 12px; opacity: .7; }\n #debug-variable pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }\n #debug-variable button { background: transparent; color: inherit; border: 1px solid var(--prof-hot);\n padding: 6px 10px; border-radius: 4px; margin-right: 8px; cursor: pointer; }\n #debug-variable small { display: block; margin-top: 8px; opacity: .7; }";
3
+ /** The debug-link section's script, starting from the current selection. */
4
+ export declare function debugLinkScript(): string;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEBUG_LINK_CSS = exports.DEBUG_LINK_BODY = void 0;
4
+ exports.debugLinkScript = debugLinkScript;
5
+ // Implements [PROF-UI-DEBUG-LINK]. Shared watch context in CPU, memory and retention panels.
6
+ const debug_selection_1 = require("./debug-selection");
7
+ exports.DEBUG_LINK_BODY = `<section id="debug-variable" hidden aria-label="Debugger variable">
8
+ <strong id="debug-variable-name"></strong><span id="debug-variable-type"></span>
9
+ <pre id="debug-variable-value"></pre><button id="debug-variable-watch">Add to Watch</button>
10
+ <button id="debug-variable-retainers">Inspect type retainers</button>
11
+ <small>Value captured at the selected debug pause. Type retainers describe the type, not a unique object.</small>
12
+ </section>`;
13
+ exports.DEBUG_LINK_CSS = `#debug-variable { border: 1px solid var(--prof-hot); border-radius: 8px;
14
+ padding: 14px; margin-bottom: 16px; } #debug-variable span { margin-left: 12px; opacity: .7; }
15
+ #debug-variable pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
16
+ #debug-variable button { background: transparent; color: inherit; border: 1px solid var(--prof-hot);
17
+ padding: 6px 10px; border-radius: 4px; margin-right: 8px; cursor: pointer; }
18
+ #debug-variable small { display: block; margin-top: 8px; opacity: .7; }`;
19
+ /** Repaint an open panel when the host palette changes; canvases redraw on resize. */
20
+ const PALETTE_REPAINT = `function repaint(vars) {
21
+ Object.entries(vars).forEach(([name, value]) => document.documentElement.style.setProperty(name, value));
22
+ window.dispatchEvent(new Event('resize'));
23
+ }`;
24
+ /** Show the selected debugger variable, or hide the section when there is none. */
25
+ const VARIABLE_RENDER = `const text = (id, value) => { document.getElementById(id).textContent = value; };
26
+ function render(variable) {
27
+ document.getElementById('debug-variable').hidden = !variable;
28
+ if (!variable) return;
29
+ text('debug-variable-name', variable.expression); text('debug-variable-type', variable.type);
30
+ text('debug-variable-value', variable.value);
31
+ document.getElementById('debug-variable-retainers').hidden = !variable.canInspectType;
32
+ }`;
33
+ /** The debug-link section's script, starting from the current selection. */
34
+ function debugLinkScript() {
35
+ const initial = JSON.stringify(debug_selection_1.selectedProfileVariable.value ?? null).split("<").join(String.raw `\u003c`);
36
+ return `(function () {
37
+ const api = () => globalThis.profilerVsCodeApi || (globalThis.profilerVsCodeApi = acquireVsCodeApi());
38
+ ${VARIABLE_RENDER}
39
+ ${PALETTE_REPAINT}
40
+ render(${initial});
41
+ window.addEventListener('message', event => {
42
+ if (event.data.type === 'profilerVariable') render(event.data.variable);
43
+ if (event.data.type === 'profilerPalette') repaint(event.data.vars);
44
+ });
45
+ document.getElementById('debug-variable-watch').onclick = () => api().postMessage({type:'profileWatch'});
46
+ document.getElementById('debug-variable-retainers').onclick = () => api().postMessage({type:'profileRetainers'});
47
+ })();`;
48
+ }
49
+ //# sourceMappingURL=debug-link-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-link-view.js","sourceRoot":"","sources":["../../src/debug-link-view.ts"],"names":[],"mappings":";;;;AAAA,6FAA6F;AAC7F,uDAA4D;AAE/C,QAAA,eAAe,GAAG;;;;;WAKpB,CAAC;AACC,QAAA,cAAc,GAAG;;;;;0EAK4C,CAAC;AAE3E,sFAAsF;AACtF,MAAM,eAAe,GAAG;;;MAGlB,CAAC;AAEP,mFAAmF;AACnF,MAAM,eAAe,GAAG;;;;;;;MAOlB,CAAC;AAEP,4EAA4E;AAC5E;IACE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,yCAAuB,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAA,QAAQ,CAAC,CAAC;IAC1G,OAAO;;MAEH,eAAe;MACf,eAAe;aACR,OAAO;;;;;;;QAOZ,CAAC;AACT,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as vscode from "vscode";
2
+ export interface DebugLinkHost {
3
+ readonly debugType: string;
4
+ readonly inspectType?: (type: string, sessionId: string) => Promise<void>;
5
+ }
6
+ export declare function registerDebugProfilerLink(host: DebugLinkHost): vscode.Disposable[];