@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/out/src/bind-host.d.ts +3 -0
- package/out/src/bind-host.js +52 -0
- package/out/src/bind-host.js.map +1 -0
- package/out/src/context-keys.d.ts +4 -0
- package/out/src/context-keys.js +54 -0
- package/out/src/context-keys.js.map +1 -0
- package/out/src/dap-evaluate.d.ts +84 -0
- package/out/src/dap-evaluate.js +442 -0
- package/out/src/dap-evaluate.js.map +1 -0
- package/out/src/dap-output.d.ts +50 -0
- package/out/src/dap-output.js +177 -0
- package/out/src/dap-output.js.map +1 -0
- package/out/src/debug/adapter-resolution.d.ts +56 -0
- package/out/src/debug/adapter-resolution.js +112 -0
- package/out/src/debug/adapter-resolution.js.map +1 -0
- package/out/src/debug/dap-messages.d.ts +18 -0
- package/out/src/debug/dap-messages.js +71 -0
- package/out/src/debug/dap-messages.js.map +1 -0
- package/out/src/debug/index.d.ts +7 -0
- package/out/src/debug/index.js +27 -0
- package/out/src/debug/index.js.map +1 -0
- package/out/src/debug/launch-config.d.ts +42 -0
- package/out/src/debug/launch-config.js +73 -0
- package/out/src/debug/launch-config.js.map +1 -0
- package/out/src/debug/launch-lifecycle.d.ts +29 -0
- package/out/src/debug/launch-lifecycle.js +40 -0
- package/out/src/debug/launch-lifecycle.js.map +1 -0
- package/out/src/debug/poll.d.ts +25 -0
- package/out/src/debug/poll.js +70 -0
- package/out/src/debug/poll.js.map +1 -0
- package/out/src/debug/profiling.d.ts +34 -0
- package/out/src/debug/profiling.js +81 -0
- package/out/src/debug/profiling.js.map +1 -0
- package/out/src/debug/testing/assertions.d.ts +27 -0
- package/out/src/debug/testing/assertions.js +111 -0
- package/out/src/debug/testing/assertions.js.map +1 -0
- package/out/src/debug/testing/dap-client.d.ts +86 -0
- package/out/src/debug/testing/dap-client.js +204 -0
- package/out/src/debug/testing/dap-client.js.map +1 -0
- package/out/src/debug/testing/index.d.ts +7 -0
- package/out/src/debug/testing/index.js +31 -0
- package/out/src/debug/testing/index.js.map +1 -0
- package/out/src/debug/testing/vscode-harness.d.ts +44 -0
- package/out/src/debug/testing/vscode-harness.js +81 -0
- package/out/src/debug/testing/vscode-harness.js.map +1 -0
- package/out/src/debug/ui-stubs.d.ts +26 -0
- package/out/src/debug/ui-stubs.js +88 -0
- package/out/src/debug/ui-stubs.js.map +1 -0
- package/out/src/debug-link-setup.d.ts +4 -0
- package/out/src/debug-link-setup.js +19 -0
- package/out/src/debug-link-setup.js.map +1 -0
- package/out/src/debug-link-view.d.ts +4 -0
- package/out/src/debug-link-view.js +49 -0
- package/out/src/debug-link-view.js.map +1 -0
- package/out/src/debug-link.d.ts +6 -0
- package/out/src/debug-link.js +95 -0
- package/out/src/debug-link.js.map +1 -0
- package/out/src/debug-selection.d.ts +14 -0
- package/out/src/debug-selection.js +33 -0
- package/out/src/debug-selection.js.map +1 -0
- package/out/src/debuggee-pause.d.ts +11 -0
- package/out/src/debuggee-pause.js +109 -0
- package/out/src/debuggee-pause.js.map +1 -0
- package/out/src/editor-path-key.d.ts +52 -0
- package/out/src/editor-path-key.js +105 -0
- package/out/src/editor-path-key.js.map +1 -0
- package/out/src/failure.d.ts +5 -0
- package/out/src/failure.js +53 -0
- package/out/src/failure.js.map +1 -0
- package/out/src/file-log-sink.d.ts +20 -0
- package/out/src/file-log-sink.js +74 -0
- package/out/src/file-log-sink.js.map +1 -0
- package/out/src/flame-html.d.ts +8 -0
- package/out/src/flame-html.js +104 -0
- package/out/src/flame-html.js.map +1 -0
- package/out/src/flame-model.d.ts +93 -0
- package/out/src/flame-model.js +242 -0
- package/out/src/flame-model.js.map +1 -0
- package/out/src/flame-script-helpers.d.ts +26 -0
- package/out/src/flame-script-helpers.js +71 -0
- package/out/src/flame-script-helpers.js.map +1 -0
- package/out/src/flame-script.d.ts +1 -0
- package/out/src/flame-script.js +332 -0
- package/out/src/flame-script.js.map +1 -0
- package/out/src/flame-time-order.d.ts +14 -0
- package/out/src/flame-time-order.js +112 -0
- package/out/src/flame-time-order.js.map +1 -0
- package/out/src/flamegraph-artifact.d.ts +9 -0
- package/out/src/flamegraph-artifact.js +45 -0
- package/out/src/flamegraph-artifact.js.map +1 -0
- package/out/src/host.d.ts +31 -0
- package/out/src/host.js +6 -0
- package/out/src/host.js.map +1 -0
- package/out/src/ids.d.ts +27 -0
- package/out/src/ids.js +63 -0
- package/out/src/ids.js.map +1 -0
- package/out/src/index.d.ts +42 -0
- package/out/src/index.js +98 -0
- package/out/src/index.js.map +1 -0
- package/out/src/logger.d.ts +50 -0
- package/out/src/logger.js +86 -0
- package/out/src/logger.js.map +1 -0
- package/out/src/memory-autopilot.d.ts +64 -0
- package/out/src/memory-autopilot.js +306 -0
- package/out/src/memory-autopilot.js.map +1 -0
- package/out/src/memory-capture-ids.d.ts +17 -0
- package/out/src/memory-capture-ids.js +45 -0
- package/out/src/memory-capture-ids.js.map +1 -0
- package/out/src/memory-capture-ingest.d.ts +15 -0
- package/out/src/memory-capture-ingest.js +84 -0
- package/out/src/memory-capture-ingest.js.map +1 -0
- package/out/src/memory-capture-legs.d.ts +4 -0
- package/out/src/memory-capture-legs.js +55 -0
- package/out/src/memory-capture-legs.js.map +1 -0
- package/out/src/memory-capture-present.d.ts +32 -0
- package/out/src/memory-capture-present.js +71 -0
- package/out/src/memory-capture-present.js.map +1 -0
- package/out/src/memory-capture-roundtrip.d.ts +17 -0
- package/out/src/memory-capture-roundtrip.js +75 -0
- package/out/src/memory-capture-roundtrip.js.map +1 -0
- package/out/src/memory-capture-state.d.ts +23 -0
- package/out/src/memory-capture-state.js +89 -0
- package/out/src/memory-capture-state.js.map +1 -0
- package/out/src/memory-capture-types.d.ts +28 -0
- package/out/src/memory-capture-types.js +70 -0
- package/out/src/memory-capture-types.js.map +1 -0
- package/out/src/memory-capture.d.ts +24 -0
- package/out/src/memory-capture.js +51 -0
- package/out/src/memory-capture.js.map +1 -0
- package/out/src/memory-dashboard-html.d.ts +3 -0
- package/out/src/memory-dashboard-html.js +327 -0
- package/out/src/memory-dashboard-html.js.map +1 -0
- package/out/src/memory-dashboard-mapping.d.ts +34 -0
- package/out/src/memory-dashboard-mapping.js +135 -0
- package/out/src/memory-dashboard-mapping.js.map +1 -0
- package/out/src/memory-dashboard.d.ts +82 -0
- package/out/src/memory-dashboard.js +142 -0
- package/out/src/memory-dashboard.js.map +1 -0
- package/out/src/memory-decorations.d.ts +61 -0
- package/out/src/memory-decorations.js +247 -0
- package/out/src/memory-decorations.js.map +1 -0
- package/out/src/memory-finalize.d.ts +25 -0
- package/out/src/memory-finalize.js +207 -0
- package/out/src/memory-finalize.js.map +1 -0
- package/out/src/memory-guidance.d.ts +14 -0
- package/out/src/memory-guidance.js +36 -0
- package/out/src/memory-guidance.js.map +1 -0
- package/out/src/memory-inspect-commands.d.ts +20 -0
- package/out/src/memory-inspect-commands.js +114 -0
- package/out/src/memory-inspect-commands.js.map +1 -0
- package/out/src/memory-launch-direct.d.ts +12 -0
- package/out/src/memory-launch-direct.js +74 -0
- package/out/src/memory-launch-direct.js.map +1 -0
- package/out/src/memory-launch.d.ts +4 -0
- package/out/src/memory-launch.js +92 -0
- package/out/src/memory-launch.js.map +1 -0
- package/out/src/memory-leak-offer.d.ts +18 -0
- package/out/src/memory-leak-offer.js +51 -0
- package/out/src/memory-leak-offer.js.map +1 -0
- package/out/src/memory-profiler.d.ts +27 -0
- package/out/src/memory-profiler.js +71 -0
- package/out/src/memory-profiler.js.map +1 -0
- package/out/src/memory-ref-graph.d.ts +62 -0
- package/out/src/memory-ref-graph.js +248 -0
- package/out/src/memory-ref-graph.js.map +1 -0
- package/out/src/memory-ref-picker.d.ts +21 -0
- package/out/src/memory-ref-picker.js +103 -0
- package/out/src/memory-ref-picker.js.map +1 -0
- package/out/src/memory-registration.d.ts +4 -0
- package/out/src/memory-registration.js +63 -0
- package/out/src/memory-registration.js.map +1 -0
- package/out/src/memory-start-core.d.ts +8 -0
- package/out/src/memory-start-core.js +165 -0
- package/out/src/memory-start-core.js.map +1 -0
- package/out/src/memory-start-stop-commands.d.ts +10 -0
- package/out/src/memory-start-stop-commands.js +75 -0
- package/out/src/memory-start-stop-commands.js.map +1 -0
- package/out/src/memory-start.d.ts +6 -0
- package/out/src/memory-start.js +13 -0
- package/out/src/memory-start.js.map +1 -0
- package/out/src/memory-status.d.ts +24 -0
- package/out/src/memory-status.js +135 -0
- package/out/src/memory-status.js.map +1 -0
- package/out/src/palette-vscode.d.ts +2 -0
- package/out/src/palette-vscode.js +50 -0
- package/out/src/palette-vscode.js.map +1 -0
- package/out/src/palette.d.ts +70 -0
- package/out/src/palette.js +150 -0
- package/out/src/palette.js.map +1 -0
- package/out/src/process-bind-panel.d.ts +11 -0
- package/out/src/process-bind-panel.js +65 -0
- package/out/src/process-bind-panel.js.map +1 -0
- package/out/src/process-commands.d.ts +5 -0
- package/out/src/process-commands.js +112 -0
- package/out/src/process-commands.js.map +1 -0
- package/out/src/process-context-keys.d.ts +11 -0
- package/out/src/process-context-keys.js +48 -0
- package/out/src/process-context-keys.js.map +1 -0
- package/out/src/process-decoration.d.ts +18 -0
- package/out/src/process-decoration.js +76 -0
- package/out/src/process-decoration.js.map +1 -0
- package/out/src/process-explorer-rows.d.ts +59 -0
- package/out/src/process-explorer-rows.js +47 -0
- package/out/src/process-explorer-rows.js.map +1 -0
- package/out/src/process-explorer.d.ts +66 -0
- package/out/src/process-explorer.js +241 -0
- package/out/src/process-explorer.js.map +1 -0
- package/out/src/process-group-item.d.ts +8 -0
- package/out/src/process-group-item.js +55 -0
- package/out/src/process-group-item.js.map +1 -0
- package/out/src/process-launch-item.d.ts +12 -0
- package/out/src/process-launch-item.js +57 -0
- package/out/src/process-launch-item.js.map +1 -0
- package/out/src/process-launch.d.ts +47 -0
- package/out/src/process-launch.js +205 -0
- package/out/src/process-launch.js.map +1 -0
- package/out/src/process-message-item.d.ts +10 -0
- package/out/src/process-message-item.js +53 -0
- package/out/src/process-message-item.js.map +1 -0
- package/out/src/process-poll.d.ts +26 -0
- package/out/src/process-poll.js +125 -0
- package/out/src/process-poll.js.map +1 -0
- package/out/src/process-reactivity.d.ts +55 -0
- package/out/src/process-reactivity.js +188 -0
- package/out/src/process-reactivity.js.map +1 -0
- package/out/src/process-registration.d.ts +11 -0
- package/out/src/process-registration.js +55 -0
- package/out/src/process-registration.js.map +1 -0
- package/out/src/process-tree-item.d.ts +18 -0
- package/out/src/process-tree-item.js +219 -0
- package/out/src/process-tree-item.js.map +1 -0
- package/out/src/processes-state.d.ts +75 -0
- package/out/src/processes-state.js +76 -0
- package/out/src/processes-state.js.map +1 -0
- package/out/src/profile-on-launch.d.ts +4 -0
- package/out/src/profile-on-launch.js +16 -0
- package/out/src/profile-on-launch.js.map +1 -0
- package/out/src/profile-server.d.ts +24 -0
- package/out/src/profile-server.js +170 -0
- package/out/src/profile-server.js.map +1 -0
- package/out/src/profiler-attach.d.ts +19 -0
- package/out/src/profiler-attach.js +129 -0
- package/out/src/profiler-attach.js.map +1 -0
- package/out/src/profiler-commands.d.ts +8 -0
- package/out/src/profiler-commands.js +110 -0
- package/out/src/profiler-commands.js.map +1 -0
- package/out/src/profiler-decorations.d.ts +74 -0
- package/out/src/profiler-decorations.js +237 -0
- package/out/src/profiler-decorations.js.map +1 -0
- package/out/src/profiler-dispose.d.ts +6 -0
- package/out/src/profiler-dispose.js +20 -0
- package/out/src/profiler-dispose.js.map +1 -0
- package/out/src/profiler-flamegraph-html.d.ts +61 -0
- package/out/src/profiler-flamegraph-html.js +366 -0
- package/out/src/profiler-flamegraph-html.js.map +1 -0
- package/out/src/profiler-format.d.ts +10 -0
- package/out/src/profiler-format.js +28 -0
- package/out/src/profiler-format.js.map +1 -0
- package/out/src/profiler-launch-cooperative.d.ts +16 -0
- package/out/src/profiler-launch-cooperative.js +167 -0
- package/out/src/profiler-launch-cooperative.js.map +1 -0
- package/out/src/profiler-launch.d.ts +29 -0
- package/out/src/profiler-launch.js +123 -0
- package/out/src/profiler-launch.js.map +1 -0
- package/out/src/profiler-results.d.ts +22 -0
- package/out/src/profiler-results.js +104 -0
- package/out/src/profiler-results.js.map +1 -0
- package/out/src/profiler-session-core.d.ts +42 -0
- package/out/src/profiler-session-core.js +116 -0
- package/out/src/profiler-session-core.js.map +1 -0
- package/out/src/profiler-state.d.ts +87 -0
- package/out/src/profiler-state.js +83 -0
- package/out/src/profiler-state.js.map +1 -0
- package/out/src/profiler-status.d.ts +38 -0
- package/out/src/profiler-status.js +163 -0
- package/out/src/profiler-status.js.map +1 -0
- package/out/src/profiler-styles.d.ts +21 -0
- package/out/src/profiler-styles.js +160 -0
- package/out/src/profiler-styles.js.map +1 -0
- package/out/src/profiler-webview.d.ts +95 -0
- package/out/src/profiler-webview.js +243 -0
- package/out/src/profiler-webview.js.map +1 -0
- package/out/src/profiler.d.ts +23 -0
- package/out/src/profiler.js +113 -0
- package/out/src/profiler.js.map +1 -0
- package/out/src/progress-ops.d.ts +24 -0
- package/out/src/progress-ops.js +135 -0
- package/out/src/progress-ops.js.map +1 -0
- package/out/src/reactive-refresh.d.ts +24 -0
- package/out/src/reactive-refresh.js +33 -0
- package/out/src/reactive-refresh.js.map +1 -0
- package/out/src/sample-summary.d.ts +39 -0
- package/out/src/sample-summary.js +32 -0
- package/out/src/sample-summary.js.map +1 -0
- package/out/src/sampled-view.d.ts +15 -0
- package/out/src/sampled-view.js +56 -0
- package/out/src/sampled-view.js.map +1 -0
- package/out/src/server-command.d.ts +4 -0
- package/out/src/server-command.js +14 -0
- package/out/src/server-command.js.map +1 -0
- package/out/src/settings.d.ts +1 -0
- package/out/src/settings.js +22 -0
- package/out/src/settings.js.map +1 -0
- package/out/src/store.d.ts +34 -0
- package/out/src/store.js +64 -0
- package/out/src/store.js.map +1 -0
- package/out/src/testing/cpu-capture-assertions.d.ts +8 -0
- package/out/src/testing/cpu-capture-assertions.js +71 -0
- package/out/src/testing/cpu-capture-assertions.js.map +1 -0
- package/out/src/testing/cpu-capture-contract.d.ts +8 -0
- package/out/src/testing/cpu-capture-contract.js +123 -0
- package/out/src/testing/cpu-capture-contract.js.map +1 -0
- package/out/src/testing/webview-contract-helpers.d.ts +24 -0
- package/out/src/testing/webview-contract-helpers.js +125 -0
- package/out/src/testing/webview-contract-helpers.js.map +1 -0
- package/out/src/testing/webview-contract-leak.d.ts +2 -0
- package/out/src/testing/webview-contract-leak.js +80 -0
- package/out/src/testing/webview-contract-leak.js.map +1 -0
- package/out/src/testing/webview-contract-memory.d.ts +5 -0
- package/out/src/testing/webview-contract-memory.js +221 -0
- package/out/src/testing/webview-contract-memory.js.map +1 -0
- package/out/src/testing/webview-contract-palette.d.ts +6 -0
- package/out/src/testing/webview-contract-palette.js +121 -0
- package/out/src/testing/webview-contract-palette.js.map +1 -0
- package/out/src/testing/webview-contract-panel.d.ts +7 -0
- package/out/src/testing/webview-contract-panel.js +100 -0
- package/out/src/testing/webview-contract-panel.js.map +1 -0
- package/out/src/testing/webview-contract-results.d.ts +6 -0
- package/out/src/testing/webview-contract-results.js +136 -0
- package/out/src/testing/webview-contract-results.js.map +1 -0
- package/out/src/testing/webview-contract.d.ts +18 -0
- package/out/src/testing/webview-contract.js +23 -0
- package/out/src/testing/webview-contract.js.map +1 -0
- package/out/src/timeouts.d.ts +21 -0
- package/out/src/timeouts.js +30 -0
- package/out/src/timeouts.js.map +1 -0
- package/out/src/trace-actions.d.ts +33 -0
- package/out/src/trace-actions.js +135 -0
- package/out/src/trace-actions.js.map +1 -0
- package/out/src/unknown-shape.d.ts +58 -0
- package/out/src/unknown-shape.js +110 -0
- package/out/src/unknown-shape.js.map +1 -0
- package/out/src/wire-adapters.d.ts +18 -0
- package/out/src/wire-adapters.js +160 -0
- package/out/src/wire-adapters.js.map +1 -0
- package/out/src/wire-generated.d.ts +760 -0
- package/out/src/wire-generated.js +38 -0
- package/out/src/wire-generated.js.map +1 -0
- package/package.json +53 -4
- package/scripts/contributions.mjs +187 -0
- package/README.md +0 -3
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-WEBVIEW]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Shared webview host for every profiler results panel (flamegraph, memory
|
|
5
|
+
* dashboard, retention graph).
|
|
6
|
+
*
|
|
7
|
+
* All three panels share the same lifecycle needs — a singleton panel that is
|
|
8
|
+
* created once and re-revealed after, a message handler that must be registered
|
|
9
|
+
* exactly ONCE per panel instance, a nonce-gated CSP, and safe embedding of
|
|
10
|
+
* profiled-program data into inline scripts. Before this module each panel
|
|
11
|
+
* hand-rolled that stack and two of them re-registered their message handler on
|
|
12
|
+
* every open (so after N snapshots one click navigated N times) and shipped no
|
|
13
|
+
* CSP at all. Hosting the primitives once makes those bugs unrepresentable.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.SingletonWebviewPanel = void 0;
|
|
50
|
+
exports.embedJson = embedJson;
|
|
51
|
+
exports.buildWebviewDocument = buildWebviewDocument;
|
|
52
|
+
exports.webviewMessage = webviewMessage;
|
|
53
|
+
exports.handleSourceNavigation = handleSourceNavigation;
|
|
54
|
+
exports.revealProfileSource = revealProfileSource;
|
|
55
|
+
const debug_link_view_1 = require("./debug-link-view");
|
|
56
|
+
const palette_vscode_1 = require("./palette-vscode");
|
|
57
|
+
const debug_selection_1 = require("./debug-selection");
|
|
58
|
+
const ids_1 = require("./ids");
|
|
59
|
+
const palette_1 = require("./palette");
|
|
60
|
+
const unknown_shape_1 = require("./unknown-shape");
|
|
61
|
+
const node_crypto_1 = require("node:crypto");
|
|
62
|
+
const vscode = __importStar(require("vscode"));
|
|
63
|
+
// ── Safe script embedding ─────────────────────────────────────────────────
|
|
64
|
+
/** Entropy (bytes) for the per-render webview CSP nonce. */
|
|
65
|
+
const CSP_NONCE_BYTES = 16;
|
|
66
|
+
/**
|
|
67
|
+
* Serialize a value for embedding inside an inline `<script>`. `JSON.stringify`
|
|
68
|
+
* does not escape `<`, so profiled-program data containing `</script>` would
|
|
69
|
+
* close the script element early; escaping `<` keeps it an opaque JS string.
|
|
70
|
+
*/
|
|
71
|
+
function embedJson(value) {
|
|
72
|
+
return JSON.stringify(value).split("<").join(String.raw `\u003c`);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build a complete, CSP-locked webview HTML document. A fresh nonce gates the
|
|
76
|
+
* (self-generated) inline script; `default-src 'none'` blocks every external
|
|
77
|
+
* resource; `img-src data:` admits only inline data URIs (the embedded flame
|
|
78
|
+
* graph SVG). Even if profiled-program data slipped an escape, the browser
|
|
79
|
+
* refuses to run any inline script without the nonce.
|
|
80
|
+
*/
|
|
81
|
+
function buildWebviewDocument(doc) {
|
|
82
|
+
const nonce = (0, node_crypto_1.randomBytes)(CSP_NONCE_BYTES).toString("base64");
|
|
83
|
+
const csp = `default-src 'none'; img-src data:; style-src 'nonce-${nonce}'; script-src 'nonce-${nonce}';`;
|
|
84
|
+
return `<!DOCTYPE html>
|
|
85
|
+
<html lang="en">
|
|
86
|
+
<head>
|
|
87
|
+
<meta charset="UTF-8">
|
|
88
|
+
<meta http-equiv="Content-Security-Policy" content="${csp}">
|
|
89
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
90
|
+
<title>${doc.title}</title>
|
|
91
|
+
<style nonce="${nonce}">${doc.css}${(0, palette_1.paletteCss)()}${debug_link_view_1.DEBUG_LINK_CSS}</style>
|
|
92
|
+
</head>
|
|
93
|
+
<body>${debug_link_view_1.DEBUG_LINK_BODY}${doc.body}
|
|
94
|
+
<script nonce="${nonce}">${(0, debug_link_view_1.debugLinkScript)()}${doc.script}</script>
|
|
95
|
+
</body>
|
|
96
|
+
</html>`;
|
|
97
|
+
}
|
|
98
|
+
/** A posted value as a profiler message: an object with a string `type`, a string `file` and a numeric `line` when present. */
|
|
99
|
+
function webviewMessage(raw) {
|
|
100
|
+
if (!(0, unknown_shape_1.isRecord)(raw) || typeof raw.type !== "string") {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const { type, file, line } = raw;
|
|
104
|
+
if ((file !== undefined && typeof file !== "string") || (line !== undefined && typeof line !== "number")) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return { type, ...(file === undefined ? {} : { file }), ...(line === undefined ? {} : { line }) };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Route the message every profiler panel shares: a click on a source location
|
|
111
|
+
* opens that file beside the panel. Returns whether the message was handled so
|
|
112
|
+
* panels can layer their own message types on top.
|
|
113
|
+
*/
|
|
114
|
+
function handleSourceNavigation(msg) {
|
|
115
|
+
if (msg.type === "profileWatch" || msg.type === "profileRetainers") {
|
|
116
|
+
void runProfileWatchCommand(msg);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
if (msg.type !== "navigateToSource" || msg.file === undefined || msg.line === undefined) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
void revealProfileSourceSafely(msg.file, msg.line);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
/** Run the watch/inspect command behind a profile navigation click. */
|
|
126
|
+
async function runProfileWatchCommand(msg) {
|
|
127
|
+
const command = (0, ids_1.cmd)(msg.type === "profileWatch" ? "watchVariable" : "inspectVariableType");
|
|
128
|
+
try {
|
|
129
|
+
await vscode.commands.executeCommand(command);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
void vscode.window.showErrorMessage(String(error));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** Reveal a source line, turning a failed reveal into a warning. */
|
|
136
|
+
async function revealProfileSourceSafely(file, line) {
|
|
137
|
+
try {
|
|
138
|
+
await revealProfileSource({ file, line });
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
void vscode.window.showWarningMessage("Cannot open the selected profile source.");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** Open a measured source line, clamped to the current document (source may have changed). */
|
|
145
|
+
async function revealProfileSource(location) {
|
|
146
|
+
if (!Number.isFinite(location.line)) {
|
|
147
|
+
throw new TypeError("Invalid profile source line");
|
|
148
|
+
}
|
|
149
|
+
const document = await vscode.workspace.openTextDocument(location.file);
|
|
150
|
+
const editor = await vscode.window.showTextDocument(document, vscode.ViewColumn.One);
|
|
151
|
+
const line = Math.min(Math.max(Math.trunc(location.line) - 1, 0), document.lineCount - 1);
|
|
152
|
+
const range = new vscode.Range(line, 0, line, 0);
|
|
153
|
+
editor.revealRange(range, vscode.TextEditorRevealType.InCenter);
|
|
154
|
+
editor.selection = new vscode.Selection(line, 0, line, 0);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A create-once / reveal-after webview panel whose message handler is bound
|
|
158
|
+
* exactly once per panel instance — re-opening with fresh data re-renders the
|
|
159
|
+
* HTML but never stacks a second handler.
|
|
160
|
+
*/
|
|
161
|
+
class SingletonWebviewPanel {
|
|
162
|
+
panel;
|
|
163
|
+
visible = false;
|
|
164
|
+
viewType;
|
|
165
|
+
onMessage;
|
|
166
|
+
options;
|
|
167
|
+
/** `viewType` is read when the panel is created, so it follows the host prefix installed later. */
|
|
168
|
+
constructor(viewType, onMessage, options = {}) {
|
|
169
|
+
this.viewType = viewType;
|
|
170
|
+
this.onMessage = onMessage;
|
|
171
|
+
this.options = options;
|
|
172
|
+
}
|
|
173
|
+
/** Open the panel (or reveal the existing one) and swap in the new document. */
|
|
174
|
+
show(title, html) {
|
|
175
|
+
if (this.panel !== undefined) {
|
|
176
|
+
this.panel.title = title;
|
|
177
|
+
this.panel.reveal(this.options.viewColumn ?? vscode.ViewColumn.Beside);
|
|
178
|
+
}
|
|
179
|
+
(this.panel ??= this.create(title)).webview.html = html;
|
|
180
|
+
}
|
|
181
|
+
create(title) {
|
|
182
|
+
const panel = vscode.window.createWebviewPanel(this.viewType(), title, this.options.viewColumn ?? vscode.ViewColumn.Beside, {
|
|
183
|
+
enableScripts: true,
|
|
184
|
+
retainContextWhenHidden: this.options.retainContextWhenHidden ?? true,
|
|
185
|
+
enableFindWidget: this.options.enableFindWidget ?? false,
|
|
186
|
+
localResourceRoots: [],
|
|
187
|
+
});
|
|
188
|
+
(0, debug_selection_1.bindDebugSelection)(panel);
|
|
189
|
+
(0, palette_vscode_1.bindPanelPalette)(panel);
|
|
190
|
+
this.visible = panel.visible;
|
|
191
|
+
this.bindLifecycle(panel);
|
|
192
|
+
return panel;
|
|
193
|
+
}
|
|
194
|
+
bindLifecycle(panel) {
|
|
195
|
+
panel.onDidDispose(() => {
|
|
196
|
+
this.panel = undefined;
|
|
197
|
+
this.visible = false;
|
|
198
|
+
this.options.onDidDispose?.();
|
|
199
|
+
});
|
|
200
|
+
// Bound once per panel instance — the whole reason this class exists.
|
|
201
|
+
panel.webview.onDidReceiveMessage((raw) => {
|
|
202
|
+
const msg = webviewMessage(raw);
|
|
203
|
+
if (msg !== undefined) {
|
|
204
|
+
this.onMessage(msg);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
panel.onDidChangeViewState((event) => {
|
|
208
|
+
const becameVisible = event.webviewPanel.visible && !this.visible;
|
|
209
|
+
this.visible = event.webviewPanel.visible;
|
|
210
|
+
if (becameVisible) {
|
|
211
|
+
this.options.onDidReveal?.();
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/** Post data to the open panel; false when no panel exists. */
|
|
216
|
+
postMessage(message) {
|
|
217
|
+
return this.panel?.webview.postMessage(message) ?? Promise.resolve(false);
|
|
218
|
+
}
|
|
219
|
+
/** Whether the panel is currently open (e2e seam). */
|
|
220
|
+
isOpen() {
|
|
221
|
+
return this.panel !== undefined;
|
|
222
|
+
}
|
|
223
|
+
/** The panel's view type and title, when open (e2e seam). */
|
|
224
|
+
describe() {
|
|
225
|
+
return this.panel === undefined ? undefined : { viewType: this.panel.viewType, title: this.panel.title };
|
|
226
|
+
}
|
|
227
|
+
/** The HTML currently rendered, when open (e2e seam). */
|
|
228
|
+
html() {
|
|
229
|
+
return this.panel?.webview.html;
|
|
230
|
+
}
|
|
231
|
+
/** Whether the live panel is already frontmost in an editor group. */
|
|
232
|
+
isVisible() {
|
|
233
|
+
return this.visible;
|
|
234
|
+
}
|
|
235
|
+
/** Close and forget the panel (extension teardown). */
|
|
236
|
+
dispose() {
|
|
237
|
+
this.panel?.dispose();
|
|
238
|
+
this.panel = undefined;
|
|
239
|
+
this.visible = false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
exports.SingletonWebviewPanel = SingletonWebviewPanel;
|
|
243
|
+
//# sourceMappingURL=profiler-webview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-webview.js","sourceRoot":"","sources":["../../src/profiler-webview.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uDAAqF;AACrF,qDAAoD;AACpD,uDAAuD;AACvD,+BAA4B;AAC5B,uCAAuC;AACvC,mDAA2C;AAC3C,6CAA0C;AAC1C,MAAY,MAAM,mCAAe;AAEjC,6EAA6E;AAE7E,4DAA4D;AAC5D,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B;;;;GAIG;AACH,mBAA0B,KAAc;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAA,QAAQ,CAAC,CAAC;AACnE,CAAC;AAYD;;;;;;GAMG;AACH,8BAAqC,GAAoB;IACvD,MAAM,KAAK,GAAG,IAAA,yBAAW,EAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,uDAAuD,KAAK,wBAAwB,KAAK,IAAI,CAAC;IAC1G,OAAO;;;;wDAI+C,GAAG;;WAEhD,GAAG,CAAC,KAAK;kBACF,KAAK,KAAK,GAAG,CAAC,GAAG,GAAG,IAAA,oBAAU,GAAE,GAAG,gCAAc;;QAE3D,iCAAe,GAAG,GAAG,CAAC,IAAI;mBACf,KAAK,KAAK,IAAA,iCAAe,GAAE,GAAG,G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AC,YAAY,CAAC,OAAO,CAAC;YAC1C,IAAI,aAAa,EAAE,CAAC;gBAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;YAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,+DAA+D;IACxD,WAAW,CAAC,OAAgB;QACjC,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;IAED,sDAAsD;IAC/C,MAAM;QACX,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAClC,CAAC;IAED,6DAA6D;IACtD,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3G,CAAC;IAED,yDAAyD;IAClD,IAAI;QACT,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,sEAAsE;IAC/D,SAAS;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,uDAAuD;IAChD,OAAO;QACZ,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profiler UI module for the lsp-profiler UI library.
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - Profiler status bar item (pulsing dot while profiling)
|
|
6
|
+
* - Command handlers for start/stop/snapshot/attach-to-debug
|
|
7
|
+
* - Flamegraph webview panel
|
|
8
|
+
* - Progress notification during active profiling
|
|
9
|
+
*
|
|
10
|
+
* All profiling logic lives in the LSP server. This module handles
|
|
11
|
+
* only the client-side UI and command routing; starts live in profiler-attach.ts.
|
|
12
|
+
*/
|
|
13
|
+
import * as vscode from "vscode";
|
|
14
|
+
import type { ProfilerStore as Store } from "./store";
|
|
15
|
+
export { profilerStatusText } from "./profiler-status";
|
|
16
|
+
export { shouldProfileOnLaunch } from "./profiler-launch";
|
|
17
|
+
export { lastProfileResult } from "./profiler-results";
|
|
18
|
+
export { disposeProfiler } from "./profiler-dispose";
|
|
19
|
+
/**
|
|
20
|
+
* Register profiler UI components. Called once during extension activation.
|
|
21
|
+
* Returns disposables for cleanup.
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerProfiler(store: Store): vscode.Disposable[];
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Profiler UI module for the lsp-profiler UI library.
|
|
5
|
+
*
|
|
6
|
+
* Provides:
|
|
7
|
+
* - Profiler status bar item (pulsing dot while profiling)
|
|
8
|
+
* - Command handlers for start/stop/snapshot/attach-to-debug
|
|
9
|
+
* - Flamegraph webview panel
|
|
10
|
+
* - Progress notification during active profiling
|
|
11
|
+
*
|
|
12
|
+
* All profiling logic lives in the LSP server. This module handles
|
|
13
|
+
* only the client-side UI and command routing; starts live in profiler-attach.ts.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.disposeProfiler = exports.lastProfileResult = exports.shouldProfileOnLaunch = exports.profilerStatusText = void 0;
|
|
50
|
+
exports.registerProfiler = registerProfiler;
|
|
51
|
+
const vscode = __importStar(require("vscode"));
|
|
52
|
+
const ids_1 = require("./ids");
|
|
53
|
+
const logger_1 = require("./logger");
|
|
54
|
+
const profiler_decorations_1 = require("./profiler-decorations");
|
|
55
|
+
const profiler_attach_1 = require("./profiler-attach");
|
|
56
|
+
const profiler_status_1 = require("./profiler-status");
|
|
57
|
+
const profiler_results_1 = require("./profiler-results");
|
|
58
|
+
const profiler_commands_1 = require("./profiler-commands");
|
|
59
|
+
// Re-exported so tests keep one import site for the profiler's public seams.
|
|
60
|
+
var profiler_status_2 = require("./profiler-status");
|
|
61
|
+
Object.defineProperty(exports, "profilerStatusText", { enumerable: true, get: function () { return profiler_status_2.profilerStatusText; } });
|
|
62
|
+
var profiler_launch_1 = require("./profiler-launch");
|
|
63
|
+
Object.defineProperty(exports, "shouldProfileOnLaunch", { enumerable: true, get: function () { return profiler_launch_1.shouldProfileOnLaunch; } });
|
|
64
|
+
var profiler_results_2 = require("./profiler-results");
|
|
65
|
+
Object.defineProperty(exports, "lastProfileResult", { enumerable: true, get: function () { return profiler_results_2.lastProfileResult; } });
|
|
66
|
+
var profiler_dispose_1 = require("./profiler-dispose");
|
|
67
|
+
Object.defineProperty(exports, "disposeProfiler", { enumerable: true, get: function () { return profiler_dispose_1.disposeProfiler; } });
|
|
68
|
+
// ── Registration ──────────────────────────────────────────────────────────
|
|
69
|
+
/**
|
|
70
|
+
* Register profiler UI components. Called once during extension activation.
|
|
71
|
+
* Returns disposables for cleanup.
|
|
72
|
+
*/
|
|
73
|
+
function registerProfiler(store) {
|
|
74
|
+
return [
|
|
75
|
+
// The status bar renders reactively from the store's profiler signal
|
|
76
|
+
// ([PROF-UI-STATE] lifecycle lives in profiler-status.ts).
|
|
77
|
+
(0, profiler_status_1.bindProfilerStatusBar)(store),
|
|
78
|
+
...registerProfilerCommands(store),
|
|
79
|
+
(0, profiler_status_1.registerProgressListener)(store),
|
|
80
|
+
// Decorations follow the last result onto every newly visible editor.
|
|
81
|
+
vscode.window.onDidChangeVisibleTextEditors(() => {
|
|
82
|
+
const result = (0, profiler_results_1.lastProfileResult)();
|
|
83
|
+
if (result !== undefined) {
|
|
84
|
+
void (0, profiler_decorations_1.applyProfileDecorations)(result);
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
vscode.debug.onDidStartDebugSession((session) => { (0, profiler_attach_1.profileOnLaunch)(store, session); }),
|
|
88
|
+
vscode.debug.onDidTerminateDebugSession(() => { stopWithDebugSession(store); }),
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
/** The client-side commands that proxy to the LSP. */
|
|
92
|
+
function registerProfilerCommands(store) {
|
|
93
|
+
return [
|
|
94
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("profileStart"), async () => { await (0, profiler_commands_1.handleProfileStart)(); }),
|
|
95
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("profileStop"), async () => { await (0, profiler_commands_1.handleProfileStop)(store); }),
|
|
96
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("profileSnapshot"), async () => { await (0, profiler_commands_1.handleProfileSnapshot)(store); }),
|
|
97
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("profileAttachToDebug"), async () => { await (0, profiler_attach_1.handleProfileAttachToDebug)(store); }),
|
|
98
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("profileShowResults"), profiler_results_1.handleProfileShowResults),
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Auto-stop when the debug session ends. Only an adopted ("active") session has
|
|
103
|
+
* results to collect; a start still in flight is cleaned up by its own `finally`,
|
|
104
|
+
* so no "no session" warning fires.
|
|
105
|
+
*/
|
|
106
|
+
function stopWithDebugSession(store) {
|
|
107
|
+
if (store.profiler.value.cpu !== "active") {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
logger_1.Logger.info("Debug session ended — auto-stopping profiler");
|
|
111
|
+
void (0, profiler_commands_1.handleProfileStop)(store);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=profiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../src/profiler.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AACjC,+BAA4B;AAC5B,qCAAkC;AAElC,iEAAiE;AACjE,uDAAgF;AAChF,uDAAoF;AACpF,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,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAA,SAAG,EAAC,iBAAiB,CAAC,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAA,yCAAqB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5G,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAA,SAAG,EAAC,sBAAsB,CAAC,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAA,4CAA0B,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACtH,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAA,SAAG,EAAC,oBAAoB,CAAC,EAAE,2CAAwB,CAAC;KACrF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,KAAY;IACxC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IACtD,eAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;IAC5D,KAAK,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized user-visible progress for long-running profiler operations.
|
|
3
|
+
*
|
|
4
|
+
* Every multi-second profiling flow (CPU start/stop, memory operations,
|
|
5
|
+
* panel refresh) runs through these wrappers so notification styling,
|
|
6
|
+
* structured logging, and testability stay uniform. VS Code's progress UI is
|
|
7
|
+
* not readable via the public API, so the wrappers also record a
|
|
8
|
+
* begin/step/end **operation log** — the e2e seam tests assert against.
|
|
9
|
+
*/
|
|
10
|
+
/** The operation log (e2e seam): `begin:<title>`, `step:<title>:<msg>`, `end:<title>`. */
|
|
11
|
+
export declare function recordedOperations(): readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* Run `task` under a user-facing progress notification. The task receives a
|
|
14
|
+
* `report` callback for live stage messages ("Attaching…", "Collecting
|
|
15
|
+
* results…"). The notification closes when the task settles — including on
|
|
16
|
+
* throw, so a failed flow never leaves a zombie spinner.
|
|
17
|
+
*/
|
|
18
|
+
export declare function withUserProgress<Value>(title: string, task: (report: (message: string) => void) => Promise<Value>): Promise<Value>;
|
|
19
|
+
/**
|
|
20
|
+
* Run `task` under a tree view's built-in progress bar (the thin indeterminate
|
|
21
|
+
* bar atop the view) — the right surface for an in-panel refresh, where a
|
|
22
|
+
* notification would be heavyweight.
|
|
23
|
+
*/
|
|
24
|
+
export declare function withViewProgress<Value>(viewId: string, title: string, task: () => Promise<Value>): Promise<Value>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-STATE]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Centralized user-visible progress for long-running profiler operations.
|
|
5
|
+
*
|
|
6
|
+
* Every multi-second profiling flow (CPU start/stop, memory operations,
|
|
7
|
+
* panel refresh) runs through these wrappers so notification styling,
|
|
8
|
+
* structured logging, and testability stay uniform. VS Code's progress UI is
|
|
9
|
+
* not readable via the public API, so the wrappers also record a
|
|
10
|
+
* begin/step/end **operation log** — the e2e seam tests assert against.
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.recordedOperations = recordedOperations;
|
|
47
|
+
exports.withUserProgress = withUserProgress;
|
|
48
|
+
exports.withViewProgress = withViewProgress;
|
|
49
|
+
const vscode = __importStar(require("vscode"));
|
|
50
|
+
const logger_1 = require("./logger");
|
|
51
|
+
/**
|
|
52
|
+
* Cap so a long session cannot grow the log unbounded. A host runs all its
|
|
53
|
+
* suites in one extension host, so the cap sits far above what a whole run
|
|
54
|
+
* records: within a run the log is never trimmed and its length stays a cursor.
|
|
55
|
+
*/
|
|
56
|
+
const OPERATION_LOG_CAP = 10_000;
|
|
57
|
+
/** Chronological `begin:`/`step:`/`end:`-prefixed operation entries. */
|
|
58
|
+
const operationLog = [];
|
|
59
|
+
function record(entry) {
|
|
60
|
+
operationLog.push(entry);
|
|
61
|
+
if (operationLog.length > OPERATION_LOG_CAP) {
|
|
62
|
+
operationLog.splice(0, settledPrefix(operationLog.length - OPERATION_LOG_CAP / 2));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The longest prefix of at most `limit` entries that holds only whole
|
|
67
|
+
* operations. Trimming inside one would orphan its `end:` and make the log
|
|
68
|
+
* claim a notification closed that never opened.
|
|
69
|
+
*/
|
|
70
|
+
function settledPrefix(limit) {
|
|
71
|
+
let open = 0;
|
|
72
|
+
let settled = 0;
|
|
73
|
+
for (const [index, entry] of operationLog.slice(0, limit).entries()) {
|
|
74
|
+
open += balanceChange(entry);
|
|
75
|
+
settled = open === 0 ? index + 1 : settled;
|
|
76
|
+
}
|
|
77
|
+
return settled;
|
|
78
|
+
}
|
|
79
|
+
/** +1 for an operation start, -1 for its end, 0 otherwise. */
|
|
80
|
+
function balanceChange(entry) {
|
|
81
|
+
if (entry.startsWith("begin:")) {
|
|
82
|
+
return 1;
|
|
83
|
+
}
|
|
84
|
+
if (entry.startsWith("end:")) {
|
|
85
|
+
return -1;
|
|
86
|
+
}
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
/** The operation log (e2e seam): `begin:<title>`, `step:<title>:<msg>`, `end:<title>`. */
|
|
90
|
+
function recordedOperations() {
|
|
91
|
+
return operationLog;
|
|
92
|
+
}
|
|
93
|
+
/** The `report` a task narrates its stages through: recorded, logged and shown. */
|
|
94
|
+
function stageReporter(title, progress) {
|
|
95
|
+
return (message) => {
|
|
96
|
+
record(`step:${title}:${message}`);
|
|
97
|
+
logger_1.Logger.debug(`[Progress] ${title} — ${message}`);
|
|
98
|
+
progress.report({ message });
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Run `task` under a user-facing progress notification. The task receives a
|
|
103
|
+
* `report` callback for live stage messages ("Attaching…", "Collecting
|
|
104
|
+
* results…"). The notification closes when the task settles — including on
|
|
105
|
+
* throw, so a failed flow never leaves a zombie spinner.
|
|
106
|
+
*/
|
|
107
|
+
async function withUserProgress(title, task) {
|
|
108
|
+
record(`begin:${title}`);
|
|
109
|
+
logger_1.Logger.info(`[Progress] begin: ${title}`);
|
|
110
|
+
try {
|
|
111
|
+
return await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title }, async (progress) => {
|
|
112
|
+
const result = await task(stageReporter(title, progress));
|
|
113
|
+
return result;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
record(`end:${title}`);
|
|
118
|
+
logger_1.Logger.info(`[Progress] end: ${title}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Run `task` under a tree view's built-in progress bar (the thin indeterminate
|
|
123
|
+
* bar atop the view) — the right surface for an in-panel refresh, where a
|
|
124
|
+
* notification would be heavyweight.
|
|
125
|
+
*/
|
|
126
|
+
async function withViewProgress(viewId, title, task) {
|
|
127
|
+
record(`begin:${title}`);
|
|
128
|
+
try {
|
|
129
|
+
return await vscode.window.withProgress({ location: { viewId } }, task);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
record(`end:${title}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=progress-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-ops.js","sourceRoot":"","sources":["../../src/progress-ops.ts"],"names":[],"mappings":";AAAA,kEAAkE;AAClE;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AACjC,qCAAkC;AAElC;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,wEAAwE;AACxE,MAAM,YAAY,GAAa,EAAE,CAAC;AAElC,SAAS,MAAM,CAAC,KAAa;IAC3B,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,IAAI,YAAY,CA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AE,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACI,KAAK,2BACV,KAAa,EACb,IAA2D;IAE3D,MAAM,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC;IACzB,eAAM,CAAC,IAAI,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,YAAY,CACrC,EAAE,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,EAAE,EACzD,KAAK,EAAE,QAAQ,EAAE,EAAE;YACjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;QACvB,eAAM,CAAC,IAAI,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,2BACV,MAAc,EACd,KAAa,EACb,IAA0B;IAE1B,MAAM,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared reactive-refresh wiring for sidebar panels.
|
|
3
|
+
*
|
|
4
|
+
* Every panel is a pure projection of centralized store state: it subscribes to
|
|
5
|
+
* a monotonic revision signal and re-renders on each bump, never owning a timer
|
|
6
|
+
* or refreshing itself directly. The Modules panel keys off `analysisRevision`;
|
|
7
|
+
* the Processes panel keys off `processesRevision` (whose visibility-gated
|
|
8
|
+
* poll bumps the signal, since the OS has no push event for process changes,
|
|
9
|
+
* issue #148). Both share the one subscription primitive below.
|
|
10
|
+
*/
|
|
11
|
+
import type { ReadonlySignal } from "@preact/signals-core";
|
|
12
|
+
import type * as vscode from "vscode";
|
|
13
|
+
/** A panel that can re-render on demand and tracks its own disposables. */
|
|
14
|
+
export interface RefreshablePanel {
|
|
15
|
+
refresh: () => void;
|
|
16
|
+
readonly disposables: vscode.Disposable[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Subscribe `panel` to a centralized revision signal, refreshing on each real
|
|
20
|
+
* bump. The effect runs once on subscription; the captured baseline suppresses
|
|
21
|
+
* that initial no-op so only genuine bumps trigger a refresh. The effect's
|
|
22
|
+
* disposer is tracked on the panel so it is torn down with the panel.
|
|
23
|
+
*/
|
|
24
|
+
export declare function subscribeRevision(revision: ReadonlySignal<number>, panel: RefreshablePanel): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-STATE]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Shared reactive-refresh wiring for sidebar panels.
|
|
5
|
+
*
|
|
6
|
+
* Every panel is a pure projection of centralized store state: it subscribes to
|
|
7
|
+
* a monotonic revision signal and re-renders on each bump, never owning a timer
|
|
8
|
+
* or refreshing itself directly. The Modules panel keys off `analysisRevision`;
|
|
9
|
+
* the Processes panel keys off `processesRevision` (whose visibility-gated
|
|
10
|
+
* poll bumps the signal, since the OS has no push event for process changes,
|
|
11
|
+
* issue #148). Both share the one subscription primitive below.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.subscribeRevision = subscribeRevision;
|
|
15
|
+
const signals_core_1 = require("@preact/signals-core");
|
|
16
|
+
/**
|
|
17
|
+
* Subscribe `panel` to a centralized revision signal, refreshing on each real
|
|
18
|
+
* bump. The effect runs once on subscription; the captured baseline suppresses
|
|
19
|
+
* that initial no-op so only genuine bumps trigger a refresh. The effect's
|
|
20
|
+
* disposer is tracked on the panel so it is torn down with the panel.
|
|
21
|
+
*/
|
|
22
|
+
function subscribeRevision(revision, panel) {
|
|
23
|
+
let lastRevision = revision.value;
|
|
24
|
+
const dispose = (0, signals_core_1.effect)(() => {
|
|
25
|
+
const next = revision.value;
|
|
26
|
+
if (next !== lastRevision) {
|
|
27
|
+
lastRevision = next;
|
|
28
|
+
panel.refresh();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
panel.disposables.push({ dispose });
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=reactive-refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactive-refresh.js","sourceRoot":"","sources":["../../src/reactive-refresh.ts"],"names":[],"mappings":";AAAA,kEAAkE;AAClE;;;;;;;;;GASG;;;AAGH,uDAA8C;AAS9C;;;;;GAKG;AACH,2BACE,QAAgC,EAChC,KAAuB;IAEvB,IAAI,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC;IAClC,MAAM,OAAO,GAAG,IAAA,qBAAM,EAAC,GAAG,EAAE;QAC1B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC5B,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;YAC1B,YAAY,GAAG,IAAI,CAAC;YACpB,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACtC,CAAC"}
|