@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,73 @@
1
+ "use strict";
2
+ // Launch-configuration synthesis and normalization, language-neutral.
3
+ //
4
+ // Pressing F5 with no .vscode/launch.json hands the debug provider an EMPTY
5
+ // configuration; every LspKit editor must fill it from the active document so a
6
+ // zero-config debug works. This file owns that pure transform (Osprey's
7
+ // applyDefaultOspreyDebugConfig, Basilisk's applyDebugConfigDefaults, and
8
+ // SharpLsp's resolveDebugConfiguration defaulting are all instances of it).
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.isBlankConfig = isBlankConfig;
14
+ exports.applyLaunchConfigDefaults = applyLaunchConfigDefaults;
15
+ exports.defaultLaunchConfigForEditor = defaultLaunchConfigForEditor;
16
+ exports.defaultDebugOutputPath = defaultDebugOutputPath;
17
+ const node_path_1 = __importDefault(require("node:path"));
18
+ /** The request kind used when a policy does not ask for another one. */
19
+ const DEFAULT_REQUEST_KIND = "launch";
20
+ function defaultDerivedFields(program) {
21
+ return { cwd: node_path_1.default.dirname(program) };
22
+ }
23
+ /** True when a config field carries no value at all. */
24
+ function isAbsent(value) {
25
+ return value === undefined || value === null || value === "";
26
+ }
27
+ /** True when a config has none of type/request/name (a blank F5 config). */
28
+ function isBlankConfig(config) {
29
+ return isAbsent(config.type) && isAbsent(config.request) && isAbsent(config.name);
30
+ }
31
+ /** True when the editor holds a document this policy owns. */
32
+ function ownsDocument(activeEditor, policy) {
33
+ return activeEditor !== undefined && policy.isLanguageDocument(activeEditor.document);
34
+ }
35
+ /**
36
+ * Copy the document-derived fields onto `config` and return it. Mutating
37
+ * `config` in place is the contract: the caller gets back what it passed in.
38
+ */
39
+ function fillFromDocument(config, activeEditor, policy) {
40
+ const program = activeEditor.document.fileName;
41
+ const derive = policy.deriveFields ?? defaultDerivedFields;
42
+ return Object.assign(config, {
43
+ type: policy.type,
44
+ name: policy.name,
45
+ request: policy.request ?? DEFAULT_REQUEST_KIND,
46
+ program,
47
+ }, derive(program));
48
+ }
49
+ /**
50
+ * Fill a blank config from the active editor when it holds a document of this
51
+ * language; an already-populated config is returned untouched. Pure: it mutates
52
+ * and returns `config` but reads nothing global.
53
+ */
54
+ function applyLaunchConfigDefaults(config, activeEditor, policy) {
55
+ if (!isBlankConfig(config) || !ownsDocument(activeEditor, policy)) {
56
+ return config;
57
+ }
58
+ return fillFromDocument(config, activeEditor, policy);
59
+ }
60
+ /** Build a complete default config for a given document (or `{}` if foreign). */
61
+ function defaultLaunchConfigForEditor(activeEditor, policy) {
62
+ return applyLaunchConfigDefaults({}, activeEditor, policy);
63
+ }
64
+ /**
65
+ * A stable, per-source output path for a compiled debug artifact, e.g.
66
+ * `<dir>/.lspkit-debug/<basename><exe>`. `subdir` defaults to ".lspkit-debug".
67
+ */
68
+ function defaultDebugOutputPath(program, platform, subdir = ".lspkit-debug") {
69
+ const exe = platform === "win32" ? ".exe" : "";
70
+ const base = node_path_1.default.basename(program, node_path_1.default.extname(program));
71
+ return node_path_1.default.join(node_path_1.default.dirname(program), subdir, `${base}${exe}`);
72
+ }
73
+ //# sourceMappingURL=launch-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-config.js","sourceRoot":"","sources":["../../../src/debug/launch-config.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,wEAAwE;AACxE,0EAA0E;AAC1E,4EAA4E;;;;;;;;;AAE5E,0DAA6B;AAE7B,wEAAwE;AACxE,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAiCtC,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO,EAAE,GAAG,EAAE,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;AACxC,CAAC;AAED,wDAAwD;AACxD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;AAC/D,CAAC;AAED,4EAA4E;AAC5E,uBAA8B,MAAuB;IACnD,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC;AAED,8DAA8D;AAC9D,SAAS,YAAY,CACnB,YAA0C,EAC1C,MAA0B;IAE1B,OAAO,YAAY,KAAK,SAAS,IAAI,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,QAAQ,C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MAAM,EAAE,GAAG,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** The dirty-buffer surface the save-or-reject step needs. */
2
+ export interface SaveableDocument {
3
+ isDirty: boolean;
4
+ save: () => PromiseLike<boolean>;
5
+ }
6
+ /**
7
+ * Save a dirty document before launching. Returns true when the buffer is clean
8
+ * (either already saved or saved successfully); on a failed save it invokes
9
+ * `onReject` with a message and returns false so the provider aborts the launch.
10
+ * A missing document is treated as clean.
11
+ */
12
+ export declare function saveDirtyOrReject(document: SaveableDocument | undefined, onReject: (message: string) => void, rejectMessage?: string): Promise<boolean>;
13
+ /** Arguments handed to a pre-launch native build. */
14
+ export interface PreLaunchBuildArgs {
15
+ /** Resolved source program path. */
16
+ sourceProgram: string;
17
+ /** Output path for the compiled debug artifact. */
18
+ debugOutput: string;
19
+ /** Working directory for the build. */
20
+ cwd: string;
21
+ }
22
+ /** A pre-launch native build step (e.g. `osprey <src> --debug --compile`). */
23
+ export type PreLaunchBuild = (args: PreLaunchBuildArgs) => Promise<void>;
24
+ /**
25
+ * Run the pre-launch build, mapping any failure to a single user-facing error
26
+ * via `onError` and resolving false; a clean build resolves true. Keeps the
27
+ * try/catch shape out of every provider.
28
+ */
29
+ export declare function runPreLaunchBuild(build: PreLaunchBuild, args: PreLaunchBuildArgs, onError: (message: string) => void): Promise<boolean>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // Pre-launch lifecycle: save dirty buffers (or reject) and run the native build
3
+ // hook before the adapter is handed the artifact. Language-neutral and fully
4
+ // injectable so it unit-tests without VS Code.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.saveDirtyOrReject = saveDirtyOrReject;
7
+ exports.runPreLaunchBuild = runPreLaunchBuild;
8
+ /**
9
+ * Save a dirty document before launching. Returns true when the buffer is clean
10
+ * (either already saved or saved successfully); on a failed save it invokes
11
+ * `onReject` with a message and returns false so the provider aborts the launch.
12
+ * A missing document is treated as clean.
13
+ */
14
+ async function saveDirtyOrReject(document, onReject, rejectMessage = "Save the source file before debugging.") {
15
+ if (!document || !document.isDirty) {
16
+ return true;
17
+ }
18
+ const saved = await document.save();
19
+ if (!saved) {
20
+ onReject(rejectMessage);
21
+ return false;
22
+ }
23
+ return true;
24
+ }
25
+ /**
26
+ * Run the pre-launch build, mapping any failure to a single user-facing error
27
+ * via `onError` and resolving false; a clean build resolves true. Keeps the
28
+ * try/catch shape out of every provider.
29
+ */
30
+ async function runPreLaunchBuild(build, args, onError) {
31
+ try {
32
+ await build(args);
33
+ return true;
34
+ }
35
+ catch (error) {
36
+ onError(error instanceof Error ? error.message : String(error));
37
+ return false;
38
+ }
39
+ }
40
+ //# sourceMappingURL=launch-lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-lifecycle.js","sourceRoot":"","sources":["../../../src/debug/launch-lifecycle.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,6EAA6E;AAC7E,+CAA+C;;;;AAQ/C;;;;;GAKG;AACI,KAAK,4BACV,QAAsC,EACtC,QAAmC,EACnC,aAAa,GAAG,wCAAwC;IAExD,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,QAAQ,CAAC,aAAa,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAeD;;;;GAIG;AACI,KAAK,4BACV,KAAqB,EACrB,IAAwB,EACxB,OAAkC;IAElC,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /** Options for {@link pollUntilResult} and {@link waitForCondition}. */
2
+ export interface PollOptions<TResult> {
3
+ /** The probe to run each interval. */
4
+ fn: () => PromiseLike<TResult>;
5
+ /** Returns true once the probed value is acceptable (default: accept the first). */
6
+ predicate?: (result: TResult) => boolean;
7
+ /** Total budget in milliseconds (default 15000). */
8
+ timeoutMs?: number;
9
+ /** Delay between probes in milliseconds (default 100). */
10
+ intervalMs?: number;
11
+ }
12
+ export declare const DEFAULT_POLL_TIMEOUT_MS = 15000;
13
+ export declare const DEFAULT_POLL_INTERVAL_MS = 100;
14
+ /** Resolve after `milliseconds`. */
15
+ export declare function sleep(milliseconds: number): Promise<void>;
16
+ /**
17
+ * Poll `fn` until `predicate` accepts its result or the timeout elapses,
18
+ * returning the last observed value either way.
19
+ */
20
+ export declare function pollUntilResult<TResult>(options: PollOptions<TResult>): Promise<TResult>;
21
+ /**
22
+ * Like {@link pollUntilResult} but THROWS a labelled error if the predicate is
23
+ * never satisfied. Use when a missing condition must fail the test loudly.
24
+ */
25
+ export declare function waitForCondition<TResult>(label: string, options: PollOptions<TResult>): Promise<TResult>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // Async polling helper shared by every LspKit debugger integration test.
3
+ //
4
+ // Call shape: pollUntilResult({ fn, predicate, timeoutMs, intervalMs }).
5
+ //
6
+ // It resolves with the LAST observed value (it never throws on timeout) so the
7
+ // caller can assert on what was actually seen and produce a useful message.
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DEFAULT_POLL_INTERVAL_MS = exports.DEFAULT_POLL_TIMEOUT_MS = void 0;
10
+ exports.sleep = sleep;
11
+ exports.pollUntilResult = pollUntilResult;
12
+ exports.waitForCondition = waitForCondition;
13
+ const promises_1 = require("node:timers/promises");
14
+ exports.DEFAULT_POLL_TIMEOUT_MS = 15_000;
15
+ exports.DEFAULT_POLL_INTERVAL_MS = 100;
16
+ /** The default predicate: accept the first value seen. */
17
+ function alwaysAccept() {
18
+ return true;
19
+ }
20
+ /** Resolve after `milliseconds`. */
21
+ async function sleep(milliseconds) {
22
+ await (0, promises_1.setTimeout)(milliseconds);
23
+ }
24
+ function withDefaults(options) {
25
+ return {
26
+ fn: options.fn,
27
+ predicate: options.predicate ?? alwaysAccept,
28
+ timeoutMs: options.timeoutMs ?? exports.DEFAULT_POLL_TIMEOUT_MS,
29
+ intervalMs: options.intervalMs ?? exports.DEFAULT_POLL_INTERVAL_MS,
30
+ };
31
+ }
32
+ /** Sleep one interval, re-probe, and continue polling. */
33
+ async function pollAgain(opts, deadline, last) {
34
+ if (opts.predicate(last) || Date.now() >= deadline) {
35
+ return last;
36
+ }
37
+ await sleep(opts.intervalMs);
38
+ const next = await opts.fn();
39
+ return pollAgain(opts, deadline, next);
40
+ }
41
+ /**
42
+ * Poll `fn` until `predicate` accepts its result or the timeout elapses,
43
+ * returning the last observed value either way.
44
+ */
45
+ async function pollUntilResult(options) {
46
+ const opts = withDefaults(options);
47
+ const first = await opts.fn();
48
+ return pollAgain(opts, Date.now() + opts.timeoutMs, first);
49
+ }
50
+ /**
51
+ * Like {@link pollUntilResult} but THROWS a labelled error if the predicate is
52
+ * never satisfied. Use when a missing condition must fail the test loudly.
53
+ */
54
+ async function waitForCondition(label, options) {
55
+ const opts = withDefaults(options);
56
+ const last = await pollUntilResult(opts);
57
+ if (!opts.predicate(last)) {
58
+ throw new Error(`Timed out after ${opts.timeoutMs}ms waiting for ${label}; last value: ${safeStringify(last)}`);
59
+ }
60
+ return last;
61
+ }
62
+ function safeStringify(value) {
63
+ try {
64
+ return JSON.stringify(value);
65
+ }
66
+ catch {
67
+ return String(value);
68
+ }
69
+ }
70
+ //# sourceMappingURL=poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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,CAAC;IAC9B,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACI,KAAK,2BACV,KAAa,EACb,OAA6B;IAE7B,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,mBAAmB,IAAI,CAAC,SAAS,kBAAkB,KAAK,iBAAiB,aAAa,CAAC,IAAI,CAAC,EAAE,CAC/F,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { DapMessage } from "./dap-messages";
2
+ import type { DebugConfigLike } from "./launch-config";
3
+ /** Which extra signal a launch should collect, beyond plain debugging. */
4
+ export type LaunchMetric = "debug" | "cpu" | "memory";
5
+ /** Launch flags that select a profiling/tracking mode. */
6
+ export interface ProfilingFlags {
7
+ /** Collect a CPU profile across this run. */
8
+ profileOnLaunch?: boolean;
9
+ /** Track allocations across this run (usually implies stopOnEntry). */
10
+ memoryTrackOnLaunch?: boolean;
11
+ }
12
+ /** Options for {@link buildMetricLaunchConfig}. */
13
+ export interface MetricLaunchOptions {
14
+ platform: NodeJS.Platform;
15
+ darwinCpuStopOnEntry?: boolean;
16
+ }
17
+ /** True when the config requests any profiling/tracking mode. */
18
+ export declare function isProfilingLaunch(config: ProfilingFlags): boolean;
19
+ /** The metric a config selects (memory takes precedence over cpu). */
20
+ export declare function launchMetric(config: ProfilingFlags): LaunchMetric;
21
+ /**
22
+ * Strip breakpoint-setting requests when a profiling launch is in flight, so the
23
+ * profiler/sampler runs uninterrupted. Non-breakpoint messages and ordinary
24
+ * (non-profiling) launches pass through unchanged. Pure: returns a new message,
25
+ * never mutates the input.
26
+ */
27
+ export declare function suppressBreakpointsForProfiling(msg: DapMessage, profilingLaunch: boolean): DapMessage;
28
+ /**
29
+ * Derive a profiling/memory launch config from a base debug config. Memory
30
+ * tracking forces stopOnEntry (an allocator must attach before user code runs);
31
+ * `darwinCpuStopOnEntry` opts CPU runs into stop-on-entry on macOS, where a
32
+ * cooperative sampler needs the paused debuggee first.
33
+ */
34
+ export declare function buildMetricLaunchConfig(base: DebugConfigLike, metric: LaunchMetric, options?: MetricLaunchOptions): DebugConfigLike;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ // Profiling / memory-tracking extension points.
3
+ //
4
+ // A top-tier debugger leaves room to run the SAME launch as a profiling or
5
+ // memory-tracking session. These pure helpers (modelled on Basilisk's
6
+ // profileOnLaunch / memoryTrackOnLaunch / suppressBreakpointsForProfiling) let
7
+ // an editor add CPU/memory modes without re-plumbing the adapter: a profiling
8
+ // launch reuses the debug build but suppresses breakpoints so sampling is not
9
+ // perturbed.
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.isProfilingLaunch = isProfilingLaunch;
12
+ exports.launchMetric = launchMetric;
13
+ exports.suppressBreakpointsForProfiling = suppressBreakpointsForProfiling;
14
+ exports.buildMetricLaunchConfig = buildMetricLaunchConfig;
15
+ /** Defaults used when a caller passes no options. */
16
+ const DEFAULT_METRIC_OPTIONS = { platform: "linux" };
17
+ /** Commands whose breakpoint list is emptied during a profiling launch. */
18
+ const BREAKPOINT_COMMANDS = ["setBreakpoints", "setFunctionBreakpoints"];
19
+ /** Fresh, empty breakpoint arguments (a new array per call, never shared). */
20
+ function emptyBreakpointArguments() {
21
+ return { breakpoints: [] };
22
+ }
23
+ /** Fresh, empty exception-breakpoint filters, all three DAP forms. */
24
+ function emptyExceptionArguments() {
25
+ return { filters: [], filterOptions: [], exceptionOptions: [] };
26
+ }
27
+ /** True when the config requests any profiling/tracking mode. */
28
+ function isProfilingLaunch(config) {
29
+ return config.profileOnLaunch === true || config.memoryTrackOnLaunch === true;
30
+ }
31
+ /** The metric a config selects (memory takes precedence over cpu). */
32
+ function launchMetric(config) {
33
+ if (config.memoryTrackOnLaunch === true) {
34
+ return "memory";
35
+ }
36
+ if (config.profileOnLaunch === true) {
37
+ return "cpu";
38
+ }
39
+ return "debug";
40
+ }
41
+ /** True for a request that sets breakpoints of some kind. */
42
+ function isBreakpointRequest(command) {
43
+ return BREAKPOINT_COMMANDS.some((candidate) => candidate === command);
44
+ }
45
+ /**
46
+ * Strip breakpoint-setting requests when a profiling launch is in flight, so the
47
+ * profiler/sampler runs uninterrupted. Non-breakpoint messages and ordinary
48
+ * (non-profiling) launches pass through unchanged. Pure: returns a new message,
49
+ * never mutates the input.
50
+ */
51
+ function suppressBreakpointsForProfiling(msg, profilingLaunch) {
52
+ if (!profilingLaunch || msg.type !== "request") {
53
+ return msg;
54
+ }
55
+ if (isBreakpointRequest(msg.command)) {
56
+ return { ...msg, arguments: { ...msg.arguments, ...emptyBreakpointArguments() } };
57
+ }
58
+ if (msg.command === "setExceptionBreakpoints") {
59
+ return { ...msg, arguments: { ...msg.arguments, ...emptyExceptionArguments() } };
60
+ }
61
+ return msg;
62
+ }
63
+ /**
64
+ * Derive a profiling/memory launch config from a base debug config. Memory
65
+ * tracking forces stopOnEntry (an allocator must attach before user code runs);
66
+ * `darwinCpuStopOnEntry` opts CPU runs into stop-on-entry on macOS, where a
67
+ * cooperative sampler needs the paused debuggee first.
68
+ */
69
+ function buildMetricLaunchConfig(base, metric, options = DEFAULT_METRIC_OPTIONS) {
70
+ if (metric === "memory") {
71
+ return { ...base, memoryTrackOnLaunch: true, stopOnEntry: true };
72
+ }
73
+ if (metric === "cpu") {
74
+ const stopOnEntry = options.platform === "darwin" && options.darwinCpuStopOnEntry === true;
75
+ return stopOnEntry
76
+ ? { ...base, profileOnLaunch: true, stopOnEntry: true }
77
+ : { ...base, profileOnLaunch: true };
78
+ }
79
+ return { ...base };
80
+ }
81
+ //# sourceMappingURL=profiling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiling.js","sourceRoot":"","sources":["../../../src/debug/profiling.ts"],"names":[],"mappings":";AAAA,gDAAgD;AAChD,EAAE;AACF,2EAA2E;AAC3E,sEAAsE;AACtE,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,aAAa;;;;;;AAsBb,qDAAqD;AACrD,MAAM,sBAAsB,GAAwB,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAE1E,2EAA2E;AAC3E,MAAM,mBAAmB,GAAG,CAAC,gBAAgB,EAAE,wBAAwB,CAAU,CAAC;AAElF,8EAA8E;AAC9E,SAAS,wBAAwB;IAC/B,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AAC7B,CAAC;AAED,sEAAsE;AACtE,SAAS,uBAAuB;IAK9B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC;AAClE,CAAC;AAED,iEAAiE;AACjE,2BAAkC,MAAsB;IACtD,OAAO,MAAM,CAAC,eAAe,KAAK,IAAI,IAAI,MAAM,CAAC,mBAAmB,KAAK,IAAI,CAAC;AAChF,CAAC;AAED,sEAAsE;AACtE,sBAA6B,MAAsB;IACjD,IAAI,MAAM,CAAC,mBAAmB,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,MAAM,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6DAA6D;AAC7D,SAA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E,IAAI,EAAE,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { DapSessionLike, DapStackFrame, DapVariable } from "./dap-client";
2
+ /** Accepts a substring, a RegExp, or a predicate to match a rendered value. */
3
+ export type ValueMatcher = string | RegExp | ((value: string) => boolean);
4
+ /** True when `value` satisfies `matcher`. */
5
+ export declare function matchValue(value: string, matcher: ValueMatcher): boolean;
6
+ /** A named local to find, plus the matcher its rendered value must satisfy. */
7
+ export interface LocalAssertion {
8
+ name: string;
9
+ matcher: ValueMatcher;
10
+ }
11
+ /** A watch expression to evaluate, plus the matcher its result must satisfy. */
12
+ export interface WatchAssertion {
13
+ expression: string;
14
+ matcher: ValueMatcher;
15
+ }
16
+ /** Assert a named local/argument exists in `frameId` and matches. Returns it. */
17
+ export declare function assertLocalVariable(session: DapSessionLike, frameId: number, spec: LocalAssertion): Promise<DapVariable>;
18
+ /** Assert an evaluated watch expression matches. Returns the result string. */
19
+ export declare function assertWatch(session: DapSessionLike, frameId: number, spec: WatchAssertion): Promise<string>;
20
+ /** Assert the top frame is on `expectedLine` (and, optionally, in `sourcePath`). */
21
+ export declare function assertCurrentLine(stack: {
22
+ stackFrames: DapStackFrame[];
23
+ }, expectedLine: number, sourcePath?: string): DapStackFrame;
24
+ /** Assert a frame named `name` is somewhere on the stack. Returns it. */
25
+ export declare function assertFunctionOnStack(stack: {
26
+ stackFrames: DapStackFrame[];
27
+ }, name: string): DapStackFrame;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ // High-level DAP assertions built on the dap-client. These turn "inspect a
3
+ // local", "evaluate a watch", "we are on line N" into one call with a clear
4
+ // failure message — the assertions Osprey/Basilisk/SharpLsp e2e suites repeat.
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.matchValue = matchValue;
40
+ exports.assertLocalVariable = assertLocalVariable;
41
+ exports.assertWatch = assertWatch;
42
+ exports.assertCurrentLine = assertCurrentLine;
43
+ exports.assertFunctionOnStack = assertFunctionOnStack;
44
+ const assert = __importStar(require("node:assert"));
45
+ const dap_client_1 = require("./dap-client");
46
+ /** True when `value` satisfies `matcher`. */
47
+ function matchValue(value, matcher) {
48
+ if (typeof matcher === "string") {
49
+ return value.includes(matcher);
50
+ }
51
+ if (matcher instanceof RegExp) {
52
+ return matcher.test(value);
53
+ }
54
+ return matcher(value);
55
+ }
56
+ function describeMatcher(matcher) {
57
+ if (typeof matcher === "function") {
58
+ return "predicate";
59
+ }
60
+ return String(matcher);
61
+ }
62
+ /** Assert a named local/argument exists in `frameId` and matches. Returns it. */
63
+ async function assertLocalVariable(session, frameId, spec) {
64
+ const variable = await (0, dap_client_1.findVariable)(session, frameId, spec.name);
65
+ assert.ok(variable, `expected a local named "${spec.name}" in frame ${frameId}, found none`);
66
+ assert.ok(matchValue(variable.value, spec.matcher), `local "${spec.name}" = ${JSON.stringify(variable.value)} did not match ${describeMatcher(spec.matcher)}`);
67
+ return variable;
68
+ }
69
+ /** Assert an evaluated watch expression matches. Returns the result string. */
70
+ async function assertWatch(session, frameId, spec) {
71
+ const result = await (0, dap_client_1.evaluate)(session, {
72
+ expression: spec.expression,
73
+ frameId,
74
+ context: "watch",
75
+ });
76
+ assert.ok(matchValue(result.result, spec.matcher), `watch "${spec.expression}" = ${JSON.stringify(result.result)} did not match ${describeMatcher(spec.matcher)}`);
77
+ return result.result;
78
+ }
79
+ /** A path in a comparable form: forward slashes, lower case. */
80
+ function normalizePath(filePath) {
81
+ return filePath.replaceAll("\\", "/").toLowerCase();
82
+ }
83
+ function sameFile(left, right) {
84
+ return normalizePath(left) === normalizePath(right);
85
+ }
86
+ /** Assert the top frame's source is `sourcePath`, matching either separator. */
87
+ function assertSourcePath(frame, sourcePath) {
88
+ const actualPath = frame.source?.path;
89
+ assert.ok(actualPath !== undefined && sameFile(actualPath, sourcePath), `expected top frame in ${sourcePath}, was ${actualPath}`);
90
+ }
91
+ /** Assert the top frame is on `expectedLine` (and, optionally, in `sourcePath`). */
92
+ function assertCurrentLine(stack, expectedLine, sourcePath) {
93
+ const [top] = stack.stackFrames;
94
+ assert.ok(stack.stackFrames.length > 0, "expected at least one stack frame");
95
+ assert.strictEqual(top.line, expectedLine, `expected to stop on line ${expectedLine}`);
96
+ if (sourcePath !== undefined) {
97
+ assertSourcePath(top, sourcePath);
98
+ }
99
+ return top;
100
+ }
101
+ /** The frame names of a stack, for a "saw …" failure message. */
102
+ function frameNames(stack) {
103
+ return stack.stackFrames.map((frame) => frame.name).join(", ");
104
+ }
105
+ /** Assert a frame named `name` is somewhere on the stack. Returns it. */
106
+ function assertFunctionOnStack(stack, name) {
107
+ const frame = stack.stackFrames.find((candidate) => candidate.name.includes(name));
108
+ assert.ok(frame, `expected a frame named "${name}" on the stack, saw ${frameNames(stack)}`);
109
+ return frame;
110
+ }
111
+ //# sourceMappingURL=assertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../../../src/debug/testing/assertions.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,+EAA+E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/E,MAAY,MAAM,wCAAoB;AACtC,6CAAsD;AAMtD,6CAA6C;AAC7C,oBAA2B,KAAa,EAAE,OAAqB;IAC7D,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,OAAO,YAAY,MAAM,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,eAAe,CAAC,OAAqB;IAC5C,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAcD,iFAAiF;AAC1E,KAAK,8BACV,OAAuB,EACvB,OAAe,EACf,IAAoB;IAEpB,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAY,EAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE,CACP,QAAQ,EACR,2BAA2B,IAAI,CAAC,IAAI,cAAc,OAAO,cAAc,CACxE,CAAC;IACF,MAAM,CAAC,EAAE,CACP,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC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J,CAAC;AAED,oFAAoF;AACpF,2BACE,KAAuC,EACvC,YAAoB,EACpB,UAAmB;IAEnB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,mCAAmC,CAAC,CAAC;IAC7E,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,4BAA4B,YAAY,EAAE,CAAC,CAAC;IACvF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,gBAAgB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,iEAAiE;AACjE,SAAS,UAAU,CAAC,KAAuC;IACzD,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,yEAAyE;AACzE,+BACE,KAAuC,EACvC,IAAY;IAEZ,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACnF,MAAM,CAAC,EAAE,CACP,KAAK,EACL,2BAA2B,IAAI,uBAAuB,UAAU,CAAC,KAAK,CAAC,EAAE,CAC1E,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,86 @@
1
+ /** The single capability the DAP client needs from a debug session. */
2
+ export interface DapSessionLike {
3
+ customRequest: (command: string, args?: unknown) => Promise<unknown>;
4
+ }
5
+ /** A DAP stack frame (the fields tests assert on). */
6
+ export interface DapStackFrame {
7
+ id: number;
8
+ name: string;
9
+ source?: {
10
+ path?: string;
11
+ name?: string;
12
+ };
13
+ line: number;
14
+ column: number;
15
+ }
16
+ /** A DAP variable/scope entry. */
17
+ export interface DapVariable {
18
+ name: string;
19
+ value: string;
20
+ type?: string;
21
+ variablesReference: number;
22
+ }
23
+ /** A DAP scope. */
24
+ export interface DapScope {
25
+ name: string;
26
+ variablesReference: number;
27
+ expensive?: boolean;
28
+ }
29
+ /** Result of an `evaluate` request (watch/repl/hover). */
30
+ export interface DapEvaluateResult {
31
+ result: string;
32
+ type?: string;
33
+ variablesReference: number;
34
+ }
35
+ /** A stopped debuggee: the thread and its current stack. */
36
+ export interface DapStop {
37
+ threadId: number;
38
+ stack: {
39
+ stackFrames: DapStackFrame[];
40
+ };
41
+ }
42
+ /** All threads currently known to the adapter. */
43
+ export declare function threads(session: DapSessionLike): Promise<{
44
+ id: number;
45
+ name: string;
46
+ }[]>;
47
+ /** The stack trace for a thread. */
48
+ export declare function stackTrace(session: DapSessionLike, threadId: number, levels?: number): Promise<{
49
+ stackFrames: DapStackFrame[];
50
+ }>;
51
+ /** The scopes of a stack frame. */
52
+ export declare function scopes(session: DapSessionLike, frameId: number): Promise<{
53
+ scopes: DapScope[];
54
+ }>;
55
+ /** The variables under a variablesReference. */
56
+ export declare function variables(session: DapSessionLike, variablesReference: number): Promise<{
57
+ variables: DapVariable[];
58
+ }>;
59
+ /** The DAP contexts an `evaluate` request may run in. */
60
+ export type EvaluateContext = "watch" | "repl" | "hover";
61
+ /** The fields of a DAP `evaluate` request. */
62
+ export interface EvaluateRequest {
63
+ expression: string;
64
+ frameId: number;
65
+ context?: EvaluateContext;
66
+ }
67
+ /** Evaluate an expression in a frame (watch/repl/hover context). */
68
+ export declare function evaluate(session: DapSessionLike, request: EvaluateRequest): Promise<DapEvaluateResult>;
69
+ /** Step over (DAP `next`). */
70
+ export declare function stepOver(session: DapSessionLike, threadId: number): Promise<unknown>;
71
+ /** Step into (DAP `stepIn`). */
72
+ export declare function stepIn(session: DapSessionLike, threadId: number): Promise<unknown>;
73
+ /** Step out (DAP `stepOut`). */
74
+ export declare function stepOut(session: DapSessionLike, threadId: number): Promise<unknown>;
75
+ /** Resume (DAP `continue`). */
76
+ export declare function continueExecution(session: DapSessionLike, threadId: number): Promise<unknown>;
77
+ /** Flatten every concrete (referenceable) scope's variables for a frame. */
78
+ export declare function readFrameVariables(session: DapSessionLike, frameId: number): Promise<DapVariable[]>;
79
+ /** Find a named local/argument in a frame, or undefined. */
80
+ export declare function findVariable(session: DapSessionLike, frameId: number, name: string): Promise<DapVariable | undefined>;
81
+ /**
82
+ * Poll until the debuggee is stopped with at least one stack frame, returning
83
+ * the stopped thread and its stack. Resolves the first thread that reports a
84
+ * frame. Throws a labelled error on timeout.
85
+ */
86
+ export declare function waitForStop(session: DapSessionLike, timeoutMs?: number): Promise<DapStop>;