@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.
- 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,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Makes the Processes panel react to the store's profiling state.
|
|
5
|
+
*
|
|
6
|
+
* One `effect` over `store.profiler` drives three things whenever a session
|
|
7
|
+
* starts, streams samples, or stops:
|
|
8
|
+
* 1. the view's native chrome โ a live message ("๐ฅ Profiling PID 1234 ยท
|
|
9
|
+
* 12.3K samples (4s)") and a badge dot;
|
|
10
|
+
* 2. the per-activity gating context keys (`<prefix>.profiler.cpuBusy` / `.memoryBusy`,
|
|
11
|
+
* plus the aggregate `.profilerBusy` and `.profiling` / `.memoryTracking` /
|
|
12
|
+
* `.profilerStarting`) that hide the matching "Run & Profile" launch and
|
|
13
|
+
* reveal the Stop affordances in package.json;
|
|
14
|
+
* 3. a tree repaint, so the actively-profiled row swaps its inline Profile
|
|
15
|
+
* button for a Stop button (the marker itself derives from the store's
|
|
16
|
+
* profiler signal inside the provider โ no pushed field, #148).
|
|
17
|
+
*
|
|
18
|
+
* The message/badge update on every change (cheap), but the context keys and
|
|
19
|
+
* the tree rebuild only fire when the *gating* state changes โ a per-second
|
|
20
|
+
* sample-count tick must not rebuild the whole tree.
|
|
21
|
+
*/
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.bindProcessPanelReactivity = bindProcessPanelReactivity;
|
|
57
|
+
exports.bindDebuggeeTracking = bindDebuggeeTracking;
|
|
58
|
+
exports.panelMessage = panelMessage;
|
|
59
|
+
exports.panelBadge = panelBadge;
|
|
60
|
+
exports.processesViewState = processesViewState;
|
|
61
|
+
const vscode = __importStar(require("vscode"));
|
|
62
|
+
const context_keys_1 = require("./context-keys");
|
|
63
|
+
const ids_1 = require("./ids");
|
|
64
|
+
const signals_core_1 = require("@preact/signals-core");
|
|
65
|
+
const profiler_format_1 = require("./profiler-format");
|
|
66
|
+
/** The live tree view, exposed read-only for the e2e seam below. */
|
|
67
|
+
const boundProcessPanel = { view: undefined };
|
|
68
|
+
/**
|
|
69
|
+
* Bind the panel to the store's profiling state. Returns a disposable that
|
|
70
|
+
* stops the effect and drops the seam reference.
|
|
71
|
+
*/
|
|
72
|
+
function bindProcessPanelReactivity(store, treeView, provider) {
|
|
73
|
+
boundProcessPanel.view = treeView;
|
|
74
|
+
const regate = onGateChange(provider);
|
|
75
|
+
const disposeEffect = (0, signals_core_1.effect)(() => {
|
|
76
|
+
const session = store.profiler.value;
|
|
77
|
+
// Cheap, every change: the live readout above the tree.
|
|
78
|
+
treeView.message = panelMessage(session);
|
|
79
|
+
treeView.badge = panelBadge(session);
|
|
80
|
+
regate(session);
|
|
81
|
+
});
|
|
82
|
+
return { dispose() { disposeEffect(); boundProcessPanel.view = undefined; } };
|
|
83
|
+
}
|
|
84
|
+
/** The expensive leg (context keys + tree rebuild), run only on gating transitions. */
|
|
85
|
+
function onGateChange(provider) {
|
|
86
|
+
let lastGate = "";
|
|
87
|
+
return (session) => {
|
|
88
|
+
const gate = `${session.cpu}|${String(session.cpuPid ?? "")}|${session.memory}`;
|
|
89
|
+
if (gate === lastGate) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
lastGate = gate;
|
|
93
|
+
applyContextKeys(session);
|
|
94
|
+
provider.refresh();
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Keep the store's "which PID is the active debuggee" marker in sync, so only
|
|
99
|
+
* that row exposes the inline Track Memory action ([PROF-UI-PROCESSES]).
|
|
100
|
+
* Memory tracking rides the DAP courier ([PROF-UI-MEMORY]), so it can only
|
|
101
|
+
* ever target the process of the active host-debug-type session โ never an
|
|
102
|
+
* external process in the list. The debuggee changes when the active session
|
|
103
|
+
* changes or when the DAP `process` event resolves its PID into the store's
|
|
104
|
+
* `sessionIdToPid` map, so react to both. Writing the store signal bumps
|
|
105
|
+
* `processesRevision`, which repaints every subscribed panel (#148).
|
|
106
|
+
*/
|
|
107
|
+
function bindDebuggeeTracking(store) {
|
|
108
|
+
function update() {
|
|
109
|
+
// Read on every pass, so the effect re-runs when a debuggee PID resolves or clears.
|
|
110
|
+
const pids = store.sessionIdToPid.value;
|
|
111
|
+
const session = vscode.debug.activeDebugSession;
|
|
112
|
+
store.setActiveDebuggeePid(session?.type === (0, ids_1.debugType)() ? pids.get(session.id) : undefined);
|
|
113
|
+
}
|
|
114
|
+
const disposeEffect = (0, signals_core_1.effect)(() => {
|
|
115
|
+
update();
|
|
116
|
+
});
|
|
117
|
+
const subscriptions = [
|
|
118
|
+
vscode.debug.onDidChangeActiveDebugSession(update),
|
|
119
|
+
vscode.debug.onDidStartDebugSession(update),
|
|
120
|
+
vscode.debug.onDidTerminateDebugSession(update),
|
|
121
|
+
];
|
|
122
|
+
return { dispose() { disposeEffect(); for (const sub of subscriptions) {
|
|
123
|
+
sub.dispose();
|
|
124
|
+
} } };
|
|
125
|
+
}
|
|
126
|
+
/** Push the gating context keys every profiling `when` clause keys off. */
|
|
127
|
+
function applyContextKeys(session) {
|
|
128
|
+
const cpuBusy = session.cpu !== "idle";
|
|
129
|
+
const memoryBusy = session.memory !== "idle";
|
|
130
|
+
// Per-activity gates: CPU starts hide on cpuBusy, memory starts on memoryBusy,
|
|
131
|
+
// so the two metrics can run concurrently while a second SAME-metric start
|
|
132
|
+
// stays blocked ([PROF-UI-PROCESSES]).
|
|
133
|
+
(0, context_keys_1.setContextKey)("cpuBusy", cpuBusy);
|
|
134
|
+
(0, context_keys_1.setContextKey)("memoryBusy", memoryBusy);
|
|
135
|
+
// Aggregate, kept as a convenience key for any "anything running?" consumer.
|
|
136
|
+
(0, context_keys_1.setContextKey)("profilerBusy", cpuBusy || memoryBusy);
|
|
137
|
+
(0, context_keys_1.setContextKey)("profiling", session.cpu === "active");
|
|
138
|
+
(0, context_keys_1.setContextKey)("memoryTracking", session.memory === "active");
|
|
139
|
+
(0, context_keys_1.setContextKey)("profilerStarting", session.cpu === "starting" || session.memory === "starting");
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The live message shown above the tree, or undefined when idle. Pure so it can
|
|
143
|
+
* be asserted directly; the live view value is read via [`processesViewState`].
|
|
144
|
+
*/
|
|
145
|
+
function panelMessage(session) {
|
|
146
|
+
if (session.cpu === "starting") {
|
|
147
|
+
return "โณ Starting CPU profilerโฆ";
|
|
148
|
+
}
|
|
149
|
+
if (session.cpu === "active") {
|
|
150
|
+
return activeCpuMessage(session);
|
|
151
|
+
}
|
|
152
|
+
if (session.memory === "starting") {
|
|
153
|
+
return "โณ Starting memory trackingโฆ";
|
|
154
|
+
}
|
|
155
|
+
if (session.memory === "active") {
|
|
156
|
+
return "๐๏ธ Tracking memory allocationsโฆ";
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
/** The live CPU readout while a session is active. */
|
|
161
|
+
function activeCpuMessage(session) {
|
|
162
|
+
const head = `๐ฅ Profiling PID ${String(session.cpuPid ?? "?")}`;
|
|
163
|
+
if (session.sampleCount > 0) {
|
|
164
|
+
const live = `${(0, profiler_format_1.formatSampleCount)(session.sampleCount)} samples (${(0, profiler_format_1.formatProfileDuration)(session.durationSecs)})`;
|
|
165
|
+
const top = session.topFunction !== undefined && session.topFunction !== ""
|
|
166
|
+
? ` ยท ${session.topFunction}`
|
|
167
|
+
: "";
|
|
168
|
+
return `${head} ยท ${live}${top}`;
|
|
169
|
+
}
|
|
170
|
+
return `${head}โฆ`;
|
|
171
|
+
}
|
|
172
|
+
/** A badge dot while busy (its tooltip mirrors the message), else none. */
|
|
173
|
+
function panelBadge(session) {
|
|
174
|
+
const message = panelMessage(session);
|
|
175
|
+
if (message === undefined) {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
return { value: 1, tooltip: message };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The panel's live chrome, or `undefined`s when idle. E2e seam for
|
|
182
|
+
* [PROF-UI-PROCESSES]: TreeView message/badge are not otherwise
|
|
183
|
+
* readable once the view is owned by VS Code.
|
|
184
|
+
*/
|
|
185
|
+
function processesViewState() {
|
|
186
|
+
return { message: boundProcessPanel.view?.message, badge: boundProcessPanel.view?.badge?.value };
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=process-reactivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-reactivity.js","sourceRoot":"","sources":["../../src/process-reactivity.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AACjC,iDAA+C;AAC/C,+BAAkC;AAClC,uDAA8C;AAI9C,uDAA6E;AAE7E,oEAAoE;AACpE,MAAM,iBAAiB,GAAmD,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAE9F;;;GAGG;AACH,oCACE,KAAY,EACZ,QAAkC,EAClC,QAA2B;IAE3B,iBAAiB,CAAC,IAAI,GAAG,QAAQ,CAAC;IAClC,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,IAAA,qBAAM,EAAC,GAAG,EAAE;QAChC,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QACrC,wDAAwD;QACxD,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACzC,QAAQ,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,KAAK,aAAa,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AAChF,CAAC;AAED,uFAAuF;AACvF,SAAS,YAAY,CAAC,QAA2B;IAC/C,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC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AE,CAAC;QAC5B,MAAM,IAAI,GAAG,GAAG,IAAA,mCAAiB,EAAC,OAAO,CAAC,WAAW,CAAC,aAAa,IAAA,uCAAqB,EAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;QAClH,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,WAAW,KAAK,EAAE;YACzE,CAAC,CAAC,MAAM,OAAO,CAAC,WAAW,EAAE;YAC7B,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,GAAG,IAAI,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC;IACnC,CAAC;IACD,OAAO,GAAG,IAAI,GAAG,CAAC;AACpB,CAAC;AAED,2EAA2E;AAC3E,oBAA2B,OAAwB;IACjD,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IAChD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH;IACE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import { ProcessesProvider } from "./process-explorer";
|
|
3
|
+
import type { ProfilerStore as Store } from "./store";
|
|
4
|
+
/**
|
|
5
|
+
* Register the Processes panel. Returns command disposables for
|
|
6
|
+
* `singletonDisposables`; the tree view and provider go to subscriptions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerProcessesView(context: vscode.ExtensionContext, store: Store): {
|
|
9
|
+
provider: ProcessesProvider;
|
|
10
|
+
disposables: vscode.Disposable[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerProcessesView = registerProcessesView;
|
|
37
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
38
|
+
const vscode = __importStar(require("vscode"));
|
|
39
|
+
const ids_1 = require("./ids");
|
|
40
|
+
const process_explorer_1 = require("./process-explorer");
|
|
41
|
+
const process_launch_1 = require("./process-launch");
|
|
42
|
+
const process_commands_1 = require("./process-commands");
|
|
43
|
+
const process_bind_panel_1 = require("./process-bind-panel");
|
|
44
|
+
/**
|
|
45
|
+
* Register the Processes panel. Returns command disposables for
|
|
46
|
+
* `singletonDisposables`; the tree view and provider go to subscriptions.
|
|
47
|
+
*/
|
|
48
|
+
function registerProcessesView(context, store) {
|
|
49
|
+
const provider = new process_explorer_1.ProcessesProvider(store);
|
|
50
|
+
const treeView = vscode.window.createTreeView((0, ids_1.viewId)(), { treeDataProvider: provider });
|
|
51
|
+
context.subscriptions.push(treeView, provider);
|
|
52
|
+
(0, process_bind_panel_1.bindPanel)(store, treeView, provider);
|
|
53
|
+
return { provider, disposables: [...(0, process_launch_1.registerLaunchCommands)(store, treeView), ...(0, process_commands_1.registerViewCommands)(store, provider)] };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=process-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-registration.js","sourceRoot":"","sources":["../../src/process-registration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AACjC,+BAA+B;AAC/B,yDAAuD;AACvD,qDAA0D;AAC1D,yDAA0D;AAC1D,6DAAiD;AAGjD;;;GAGG;AACH,+BACE,OAAgC,EAChC,KAAY;IAEZ,MAAM,QAAQ,GAAG,IAAI,oCAAiB,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,IAAA,YAAM,GAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxF,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,IAAA,8BAAS,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,GAAG,IAAA,uCAAsB,EAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,GAAG,IAAA,uCAAoB,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;AAC3H,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import type { ProcessInfo, RowRuntime } from "./process-explorer-rows";
|
|
3
|
+
/** The live state one process row is constructed from. */
|
|
4
|
+
export interface ProcessTreeItemOptions {
|
|
5
|
+
readonly activeProfilingPid?: number;
|
|
6
|
+
readonly activeDebuggeePid?: number;
|
|
7
|
+
readonly runtime?: RowRuntime;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A single process row. Carries the visual cues for [PROF-UI-PROCESSES]:
|
|
11
|
+
* a ๐ซ-prefixed, greyed, sunk row when not `debuggable`; a green row when
|
|
12
|
+
* `inWorkspace`; a launcher chip; and the flame for the actively-profiled row.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ProcessTreeItem extends vscode.TreeItem {
|
|
15
|
+
readonly process: ProcessInfo;
|
|
16
|
+
constructor(process: ProcessInfo, options?: ProcessTreeItemOptions);
|
|
17
|
+
private applyCues;
|
|
18
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ProcessTreeItem = void 0;
|
|
37
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
38
|
+
const vscode = __importStar(require("vscode"));
|
|
39
|
+
const ids_1 = require("./ids");
|
|
40
|
+
const BYTES_PER_UNIT = 1024;
|
|
41
|
+
const MEMORY_UNITS = ["B", "KB", "MB", "GB", "TB"];
|
|
42
|
+
const SECONDS_PER_MINUTE = 60;
|
|
43
|
+
const SECONDS_PER_HOUR = 3600;
|
|
44
|
+
/** Human-readable memory size, e.g. `88 MB`. */
|
|
45
|
+
function formatBytes(bytes) {
|
|
46
|
+
if (bytes <= 0) {
|
|
47
|
+
return "0 B";
|
|
48
|
+
}
|
|
49
|
+
const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(BYTES_PER_UNIT)), MEMORY_UNITS.length - 1);
|
|
50
|
+
const value = bytes / BYTES_PER_UNIT ** exponent;
|
|
51
|
+
const rounded = exponent === 0 ? value : Math.round(value);
|
|
52
|
+
return `${String(rounded)} ${MEMORY_UNITS[exponent]}`;
|
|
53
|
+
}
|
|
54
|
+
/** Human-readable elapsed runtime, e.g. `3m`, `2h 14m`. */
|
|
55
|
+
function formatRuntime(seconds) {
|
|
56
|
+
if (seconds < SECONDS_PER_MINUTE) {
|
|
57
|
+
return `${String(seconds)}s`;
|
|
58
|
+
}
|
|
59
|
+
if (seconds < SECONDS_PER_HOUR) {
|
|
60
|
+
return `${String(Math.floor(seconds / SECONDS_PER_MINUTE))}m`;
|
|
61
|
+
}
|
|
62
|
+
const hours = Math.floor(seconds / SECONDS_PER_HOUR);
|
|
63
|
+
const minutes = Math.floor((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
|
|
64
|
+
return `${String(hours)}h ${String(minutes)}m`;
|
|
65
|
+
}
|
|
66
|
+
/** Final path component, used to render a script's basename. */
|
|
67
|
+
function basename(path) {
|
|
68
|
+
const lastSep = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
69
|
+
return lastSep >= 0 ? path.slice(lastSep + 1) : path;
|
|
70
|
+
}
|
|
71
|
+
/** ๐ซ marker prefixed to the label of a process the profiler can't attach to. */
|
|
72
|
+
const BLOCKED_MARK = "๐ซ ";
|
|
73
|
+
/**
|
|
74
|
+
* A single process row. Carries the visual cues for [PROF-UI-PROCESSES]:
|
|
75
|
+
* a ๐ซ-prefixed, greyed, sunk row when not `debuggable`; a green row when
|
|
76
|
+
* `inWorkspace`; a launcher chip; and the flame for the actively-profiled row.
|
|
77
|
+
*/
|
|
78
|
+
class ProcessTreeItem extends vscode.TreeItem {
|
|
79
|
+
process;
|
|
80
|
+
constructor(process, options = {}) {
|
|
81
|
+
super(rowLabel(process), vscode.TreeItemCollapsibleState.None);
|
|
82
|
+
this.process = process;
|
|
83
|
+
const rowRuntime = options.runtime ?? { directMemory: false, name: process.runtime, sourceEntries: false };
|
|
84
|
+
// Stable identity across the 2s auto-refresh, or VS Code can fail to map an
|
|
85
|
+
// inline-button click to a recreated element and pass no argument (#79).
|
|
86
|
+
this.id = `process:${String(process.pid)}`;
|
|
87
|
+
this.applyCues(process, rowRuntime, { activeProfilingPid: options.activeProfilingPid, activeDebuggeePid: options.activeDebuggeePid });
|
|
88
|
+
}
|
|
89
|
+
applyCues(process, runtime, pids) {
|
|
90
|
+
const { profilingThis, tracksMemory, memoryTrackable } = rowState(process, runtime, pids);
|
|
91
|
+
this.description = rowDescription(process, profilingThis);
|
|
92
|
+
this.tooltip = rowTooltip(process, runtime.name, { profilingThis, memoryNeedsLaunch: tracksMemory && !memoryTrackable });
|
|
93
|
+
this.iconPath = processIcon(process, profilingThis);
|
|
94
|
+
this.contextValue = rowContextValue(process, profilingThis, memoryTrackable);
|
|
95
|
+
// The decoration provider colours the label from this URI ([PROF-UI-PROCESSES]).
|
|
96
|
+
this.resourceUri = processResourceUri(process);
|
|
97
|
+
this.command = entryCommand(process, runtime);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ProcessTreeItem = ProcessTreeItem;
|
|
101
|
+
/** The row's label: name and entry script, ๐ซ-prefixed when it cannot be profiled. */
|
|
102
|
+
function rowLabel(process) {
|
|
103
|
+
const base = process.script === null ? process.name : `${process.name} โ ${basename(process.script)}`;
|
|
104
|
+
return process.debuggable ? base : `${BLOCKED_MARK}${base}`;
|
|
105
|
+
}
|
|
106
|
+
function rowState(process, runtime, pids) {
|
|
107
|
+
const tracksMemory = runtime.memory !== false;
|
|
108
|
+
const debuggee = pids.activeDebuggeePid !== undefined && pids.activeDebuggeePid === process.pid;
|
|
109
|
+
return {
|
|
110
|
+
profilingThis: pids.activeProfilingPid !== undefined && pids.activeProfilingPid === process.pid,
|
|
111
|
+
tracksMemory,
|
|
112
|
+
memoryTrackable: tracksMemory && (debuggee || (runtime.directMemory && process.debuggable)),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Clicking opens the entry only when the runtime says it is source the editor
|
|
117
|
+
* can show โ never a native binary or an assembly ([PROF-UI-CAPABILITIES]).
|
|
118
|
+
*/
|
|
119
|
+
function entryCommand(process, runtime) {
|
|
120
|
+
if (process.script === null || !runtime.sourceEntries) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
return { command: "vscode.open", title: "Reveal Script", arguments: [vscode.Uri.file(process.script)] };
|
|
124
|
+
}
|
|
125
|
+
/** A synthetic URI encoding the row's workspace + debuggability for decoration. */
|
|
126
|
+
function processResourceUri(process) {
|
|
127
|
+
const ws = process.inWorkspace ? "1" : "0";
|
|
128
|
+
const dbg = process.debuggable ? "1" : "0";
|
|
129
|
+
return vscode.Uri.from({ scheme: (0, ids_1.processUriScheme)(), path: `/${String(process.pid)}`, query: `ws=${ws}&dbg=${dbg}` });
|
|
130
|
+
}
|
|
131
|
+
/** The launcher chip (`[uvicorn] `) for a row's description, or empty. */
|
|
132
|
+
function launcherChip(process) {
|
|
133
|
+
return process.launcher === null ? "" : `[${process.launcher}] `;
|
|
134
|
+
}
|
|
135
|
+
/** The description line: launcher chip, then the key live metrics. */
|
|
136
|
+
function rowDescription(process, profilingThis) {
|
|
137
|
+
const version = process.runtimeVersion ?? "โ";
|
|
138
|
+
const profilingSuffix = profilingThis ? " ยท profiling" : "";
|
|
139
|
+
return `${launcherChip(process)}PID ${String(process.pid)} ยท ${version} ยท ${process.cpuPercent.toFixed(1)}% ยท ${formatBytes(process.memoryBytes)}${profilingSuffix}`;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The row's contextValue, which selects its package.json affordances:
|
|
143
|
+
* `blockedProcess` (no Profile/Track actions โ the panel already says
|
|
144
|
+
* "Can't profile", so the menus must not offer an attach that is known to fail,
|
|
145
|
+
* #266), `processProfiling` (Stop), `processDebuggee` (Track Memory
|
|
146
|
+
* enabled), `processElevated` (lock), or plain `process`. The
|
|
147
|
+
* profiling clauses match `/^process/`, which `blockedProcess`
|
|
148
|
+
* deliberately does not.
|
|
149
|
+
*/
|
|
150
|
+
function rowContextValue(process, profilingThis, memoryTrackable) {
|
|
151
|
+
if (!process.debuggable) {
|
|
152
|
+
return "blockedProcess";
|
|
153
|
+
}
|
|
154
|
+
if (profilingThis) {
|
|
155
|
+
return "processProfiling";
|
|
156
|
+
}
|
|
157
|
+
if (memoryTrackable) {
|
|
158
|
+
return "processDebuggee";
|
|
159
|
+
}
|
|
160
|
+
return process.requiresElevation ? "processElevated" : "process";
|
|
161
|
+
}
|
|
162
|
+
/** Multi-line hover tooltip surfacing every resolved detail for a process row. */
|
|
163
|
+
function rowTooltip(process, runtimeName, notices) {
|
|
164
|
+
return [...rowFacts(process, runtimeName), ...rowNotices(process, notices.profilingThis, notices.memoryNeedsLaunch)]
|
|
165
|
+
.filter(Boolean).join("\n");
|
|
166
|
+
}
|
|
167
|
+
/** The process as resolved: identity, runtime, load and owner. */
|
|
168
|
+
function rowFacts(process, runtimeName) {
|
|
169
|
+
return [
|
|
170
|
+
`${process.name} (PID ${String(process.pid)})`,
|
|
171
|
+
process.interpreterPath === null ? "" : `Executable: ${process.interpreterPath}`,
|
|
172
|
+
process.script === null ? "" : `Entry: ${process.script}`,
|
|
173
|
+
`${runtimeName}: ${process.runtimeVersion ?? "unknown"}`,
|
|
174
|
+
`CPU: ${process.cpuPercent.toFixed(1)}% ยท Memory: ${formatBytes(process.memoryBytes)}`,
|
|
175
|
+
`Runtime: ${formatRuntime(process.runtimeSecs)}`,
|
|
176
|
+
process.user === null ? "" : `User: ${process.user}`,
|
|
177
|
+
process.launcher === null ? "" : `Launcher: ${process.launcher}`,
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* What the profiler can do with the process. An external process is profilable
|
|
182
|
+
* only with elevation. A courier runtime tracks memory only on a process the
|
|
183
|
+
* host launched ([PROF-UI-MEMORY]), so elsewhere the row points at the
|
|
184
|
+
* current-file launch; a runtime with no memory backend suggests nothing
|
|
185
|
+
* ([PROF-UI-CAPABILITIES]).
|
|
186
|
+
*/
|
|
187
|
+
function rowNotices(process, profilingThis, memoryNeedsLaunch) {
|
|
188
|
+
return [
|
|
189
|
+
process.inWorkspace ? "๐ Workspace process" : "",
|
|
190
|
+
profilingThis ? `๐ฅ ${(0, ids_1.brand)()} is profiling this process โ click Stop to finish` : "",
|
|
191
|
+
!process.debuggable && process.undebuggableReason !== null ? `๐ซ Can't profile โ ${process.undebuggableReason}` : "",
|
|
192
|
+
process.debuggable && process.requiresElevation ? "๐ Profiling this process will prompt for elevation" : "",
|
|
193
|
+
process.debuggable && memoryNeedsLaunch
|
|
194
|
+
? `๐ง Memory tracking needs the process under ${(0, ids_1.brand)()} โ use โRun & Track Memory (Current File)โ`
|
|
195
|
+
: "",
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Leading icon for a process row: the flame while profiling, `circle-slash` when
|
|
200
|
+
* not debuggable, a `lock` when it needs elevation, `rocket` for launchers, else
|
|
201
|
+
* a running-VM glyph. In-workspace debuggable rows are tinted green to match the
|
|
202
|
+
* label decoration.
|
|
203
|
+
*/
|
|
204
|
+
function processIcon(process, profilingThis) {
|
|
205
|
+
if (profilingThis) {
|
|
206
|
+
return new vscode.ThemeIcon("flame", new vscode.ThemeColor("statusBarItem.warningBackground"));
|
|
207
|
+
}
|
|
208
|
+
if (!process.debuggable) {
|
|
209
|
+
return new vscode.ThemeIcon("circle-slash", new vscode.ThemeColor("disabledForeground"));
|
|
210
|
+
}
|
|
211
|
+
if (process.requiresElevation) {
|
|
212
|
+
return new vscode.ThemeIcon("lock", new vscode.ThemeColor("list.warningForeground"));
|
|
213
|
+
}
|
|
214
|
+
const glyph = process.launcher === null ? "vm-running" : "rocket";
|
|
215
|
+
return process.inWorkspace
|
|
216
|
+
? new vscode.ThemeIcon(glyph, new vscode.ThemeColor("charts.green"))
|
|
217
|
+
: new vscode.ThemeIcon(glyph);
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=process-tree-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tree-item.js","sourceRoot":"","sources":["../../src/process-tree-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AACjC,+BAAgD;AAGhD,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,YAAY,GAAsB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,gDAAgD;AAChD,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EACtD,YAAY,CAAC,MAAM,GAAG,CAAC,CACxB,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,GAAG,cAAc,IAAI,QAAQ,CAAC;IACjD,MAAM,OAAO,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;AACxD,CAAC;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;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IAClE,OAAO,OAAO,CAAC,WAAW;QACxB,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACpE,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The centralised, reactive state of the Processes panel (#148).
|
|
3
|
+
*
|
|
4
|
+
* The panel used to own its data privately โ `this.processes`, `this.fetched`,
|
|
5
|
+
* sort/group/filter fields โ and refresh itself on a panel-local timer. Per the
|
|
6
|
+
* architecture (CLAUDE.md: all mutable state lives in the single store as
|
|
7
|
+
* Signals; no panel polls itself), that state is hoisted here: the store owns
|
|
8
|
+
* one `ProcessPanelState` Signal, the store-side poll (process-poll.ts) feeds
|
|
9
|
+
* it, and the tree provider renders it as a pure projection, subscribing via
|
|
10
|
+
* `subscribeRevision` exactly like the Modules panel.
|
|
11
|
+
*
|
|
12
|
+
* Defined outside store.ts so the store file only grows by the signal wiring,
|
|
13
|
+
* not the type surface and action bodies (the profiler-state.ts pattern).
|
|
14
|
+
*/
|
|
15
|
+
import type { Signal } from "@preact/signals-core";
|
|
16
|
+
import type { GroupMode, ProcessInfo, SortMode } from "./process-explorer-rows";
|
|
17
|
+
/**
|
|
18
|
+
* The process-fetch lifecycle, mirrored to the `<prefix>.profiler.processesState` context
|
|
19
|
+
* key so the empty-state welcome never lies: "No processes running" shows
|
|
20
|
+
* only after a fetch actually succeeded (`loaded`), while a still-loading or
|
|
21
|
+
* errored fetch says so honestly ([PROF-UI-PROCESSES], #147).
|
|
22
|
+
*/
|
|
23
|
+
export type ProcessesFetchState = "loading" | "loaded" | "error";
|
|
24
|
+
/**
|
|
25
|
+
* Reactive snapshot of everything the Processes panel renders from.
|
|
26
|
+
* Copy-on-write: actions replace the whole object (bumping `revision`) so the
|
|
27
|
+
* backing Signal notifies subscribers.
|
|
28
|
+
*/
|
|
29
|
+
export interface ProcessPanelState {
|
|
30
|
+
/** The last process table fetched from the LSP (empty until a fetch lands). */
|
|
31
|
+
readonly list: readonly ProcessInfo[];
|
|
32
|
+
/** Fetch lifecycle behind the welcome's empty/loading/error honesty (#147). */
|
|
33
|
+
readonly fetch: ProcessesFetchState;
|
|
34
|
+
/** Active sort mode (cycled from the title bar). */
|
|
35
|
+
readonly sortMode: SortMode;
|
|
36
|
+
/** Active grouping mode (cycled from the title bar). */
|
|
37
|
+
readonly groupMode: GroupMode;
|
|
38
|
+
/** The user's search filter, pre-normalised (trimmed, lowercased). */
|
|
39
|
+
readonly filterText: string;
|
|
40
|
+
/** PID of the active host debuggee โ the only row that can be memory-tracked. */
|
|
41
|
+
readonly activeDebuggeePid: number | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Monotonic change counter, bumped by every action. Panels subscribe to it via
|
|
44
|
+
* `subscribeRevision` ([PROF-UI-STATE]) and re-render on each bump.
|
|
45
|
+
*/
|
|
46
|
+
readonly revision: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The initial state: nothing fetched yet, so the welcome honestly says "loading".
|
|
50
|
+
* Rows open grouped by runtime version ([PROF-UI-PROCESSES]).
|
|
51
|
+
*/
|
|
52
|
+
export declare const IDLE_PROCESS_PANEL: ProcessPanelState;
|
|
53
|
+
/** The only way to mutate the process-panel state โ exposed on the Store. */
|
|
54
|
+
export interface ProcessPanelActions {
|
|
55
|
+
/**
|
|
56
|
+
* A fetch could not run (LSP not running yet). Stays honestly "loading" โ
|
|
57
|
+
* never asserting the definitive "no processes" (#147) โ and clears any rows
|
|
58
|
+
* from a previous server session so the tree never shows stale processes.
|
|
59
|
+
*/
|
|
60
|
+
processesLoading: () => void;
|
|
61
|
+
/** A fetch succeeded; only now is an empty list a genuine "no processes" (#147). */
|
|
62
|
+
processesLoaded: (list: readonly ProcessInfo[]) => void;
|
|
63
|
+
/** A fetch failed โ the welcome says "couldn't load", not "no processes" (#147). */
|
|
64
|
+
processesFetchFailed: () => void;
|
|
65
|
+
/** Advance to the next sort mode and return it (for the status-bar hint). */
|
|
66
|
+
cycleProcessSort: () => SortMode;
|
|
67
|
+
/** Advance to the next grouping mode and return it (for the status-bar hint). */
|
|
68
|
+
cycleProcessGroup: () => GroupMode;
|
|
69
|
+
/** Set the search filter (normalised here so every reader sees one form). */
|
|
70
|
+
setProcessFilter: (text: string) => void;
|
|
71
|
+
/** Mark which PID is the active host debuggee; `undefined` clears it. */
|
|
72
|
+
setActiveDebuggeePid: (pid: number | undefined) => void;
|
|
73
|
+
}
|
|
74
|
+
/** Build the process-panel actions over the store's backing Signal. */
|
|
75
|
+
export declare function createProcessPanelActions(panel: Signal<ProcessPanelState>): ProcessPanelActions;
|