@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,70 @@
|
|
|
1
|
+
export interface ProfilerPalette {
|
|
2
|
+
readonly critical: string;
|
|
3
|
+
readonly hot: string;
|
|
4
|
+
readonly warm: string;
|
|
5
|
+
readonly memory: string;
|
|
6
|
+
readonly memoryHot: string;
|
|
7
|
+
readonly memoryWarm?: string;
|
|
8
|
+
readonly memoryCool?: string;
|
|
9
|
+
readonly leak: string;
|
|
10
|
+
readonly success: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_PALETTE: ProfilerPalette;
|
|
13
|
+
/** Bind host configuration; each render reads the current palette. */
|
|
14
|
+
export declare function configurePalette(read: () => ProfilerPalette): void;
|
|
15
|
+
export declare function profilerPalette(): ProfilerPalette;
|
|
16
|
+
/** Reject CSS injection and invalid overrides, retaining the host default. */
|
|
17
|
+
export declare function resolvePalette(base: ProfilerPalette, overrides: unknown): ProfilerPalette;
|
|
18
|
+
/**
|
|
19
|
+
* Every palette CSS variable with its value, and `--prof-hot-ink`, the text
|
|
20
|
+
* colour readable on the hot accent. A palette without a memory ramp ramps
|
|
21
|
+
* from its own memory accent, never the default's.
|
|
22
|
+
*/
|
|
23
|
+
export declare function paletteVars(palette?: ProfilerPalette): Record<string, string>;
|
|
24
|
+
/** The palette as CSS variables, with the same names in every profiler view. */
|
|
25
|
+
export declare function paletteCss(palette?: ProfilerPalette): string;
|
|
26
|
+
/**
|
|
27
|
+
* Text that stays readable on `fill`, a six-digit hex colour: dark ink on a
|
|
28
|
+
* light fill, light ink on a dark one. Embedded in the flame webview, so it
|
|
29
|
+
* calls nothing else.
|
|
30
|
+
*/
|
|
31
|
+
export declare function inkFor(fill: string): string;
|
|
32
|
+
/** The source classification a host that supplies none gets: a frame with a file is source. */
|
|
33
|
+
export declare function hasSourceFile(file: string): boolean;
|
|
34
|
+
/** A frame reduced to what decides its rank: its key, and where it came from. */
|
|
35
|
+
export interface FrameRank {
|
|
36
|
+
key: string;
|
|
37
|
+
i: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The frame ordering policy: by key, then by original index.
|
|
41
|
+
*
|
|
42
|
+
* The index term is not decoration. Two frames can share a file AND a name --
|
|
43
|
+
* one function inlined at two sites, or two runtime frames with no file at all
|
|
44
|
+
* -- and a comparator that answers 0 for those hands their order to whatever
|
|
45
|
+
* the engine does with elements it was told are equal. Rank is what picks a
|
|
46
|
+
* frame's colour, so an order the engine decides is a colour the engine
|
|
47
|
+
* decides, and the same profile stops looking the same twice.
|
|
48
|
+
*
|
|
49
|
+
* Exported because a sort's OUTPUT cannot tell this apart from a comparator
|
|
50
|
+
* with no tie-break at all: `Array.prototype.sort` is required to be stable,
|
|
51
|
+
* so equal elements come back in input order either way. The policy has to be
|
|
52
|
+
* asserted directly or it is not pinned.
|
|
53
|
+
*/
|
|
54
|
+
export declare function byFrameKeyThenIndex(left: FrameRank, right: FrameRank): number;
|
|
55
|
+
/** Each frame's rank by (file, name): frame identity, never array order, picks its colour. */
|
|
56
|
+
export declare function frameRanks(frames: readonly {
|
|
57
|
+
file?: string;
|
|
58
|
+
name: string;
|
|
59
|
+
}[]): number[];
|
|
60
|
+
/** Stable frame ranks choose from the host ramp; unknown frames stay neutral. */
|
|
61
|
+
export declare function framePaletteColor(index: number, source: boolean, palette: ProfilerPalette): string;
|
|
62
|
+
/** CPU heat thresholds shared by canvas and source annotations. */
|
|
63
|
+
export declare function cpuHeatColor(pct: number, palette?: ProfilerPalette): string;
|
|
64
|
+
/** Every frame coloured from the host ramp by its rank. */
|
|
65
|
+
export declare function paletteFrames<Frame extends {
|
|
66
|
+
file: string;
|
|
67
|
+
name: string;
|
|
68
|
+
color: string;
|
|
69
|
+
source?: boolean;
|
|
70
|
+
}>(frames: Frame[], palette: ProfilerPalette): Frame[];
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_PALETTE = void 0;
|
|
4
|
+
exports.configurePalette = configurePalette;
|
|
5
|
+
exports.profilerPalette = profilerPalette;
|
|
6
|
+
exports.resolvePalette = resolvePalette;
|
|
7
|
+
exports.paletteVars = paletteVars;
|
|
8
|
+
exports.paletteCss = paletteCss;
|
|
9
|
+
exports.inkFor = inkFor;
|
|
10
|
+
exports.hasSourceFile = hasSourceFile;
|
|
11
|
+
exports.byFrameKeyThenIndex = byFrameKeyThenIndex;
|
|
12
|
+
exports.frameRanks = frameRanks;
|
|
13
|
+
exports.framePaletteColor = framePaletteColor;
|
|
14
|
+
exports.cpuHeatColor = cpuHeatColor;
|
|
15
|
+
exports.paletteFrames = paletteFrames;
|
|
16
|
+
// Implements [PROF-UI-PALETTE]. Pure, validated host palette shared by every surface.
|
|
17
|
+
// framePaletteColor, paletteFrames and everything they call are embedded in
|
|
18
|
+
// the flame webview by Function.prototype.toString (flame-script.ts), so they
|
|
19
|
+
// stay self-contained declarations that call only each other.
|
|
20
|
+
const unknown_shape_1 = require("./unknown-shape");
|
|
21
|
+
exports.DEFAULT_PALETTE = {
|
|
22
|
+
critical: "#e8500a", hot: "#f97316", warm: "#fbbf24",
|
|
23
|
+
memory: "#c084fc", memoryHot: "#a78bfa", memoryWarm: "#8b5cf6", memoryCool: "#7c3aed", leak: "#f87171", success: "#34d399",
|
|
24
|
+
};
|
|
25
|
+
/** The CSS variable each palette colour sets, in every profiler view and on every live repaint. */
|
|
26
|
+
const PALETTE_CSS_VARS = [
|
|
27
|
+
["critical", "--prof-critical"], ["hot", "--prof-hot"], ["warm", "--prof-warm"], ["memory", "--prof-mem-critical"],
|
|
28
|
+
["memoryHot", "--prof-mem-hot"], ["memoryWarm", "--prof-mem-warm"], ["memoryCool", "--prof-mem-cool"],
|
|
29
|
+
["leak", "--prof-mem-leak"], ["success", "--prof-success"],
|
|
30
|
+
];
|
|
31
|
+
/** A six-digit hex colour: the only override CSS can never be injected through. */
|
|
32
|
+
const HEX_COLOR = /^#[0-9a-f]{6}$/iu;
|
|
33
|
+
let readPalette = () => exports.DEFAULT_PALETTE;
|
|
34
|
+
/** Bind host configuration; each render reads the current palette. */
|
|
35
|
+
function configurePalette(read) { readPalette = read; }
|
|
36
|
+
function profilerPalette() { return readPalette(); }
|
|
37
|
+
/** Reject CSS injection and invalid overrides, retaining the host default. */
|
|
38
|
+
function resolvePalette(base, overrides) {
|
|
39
|
+
if (!(0, unknown_shape_1.isRecord)(overrides)) {
|
|
40
|
+
return base;
|
|
41
|
+
}
|
|
42
|
+
const pick = (key, fallback) => {
|
|
43
|
+
const value = overrides[key];
|
|
44
|
+
return typeof value === "string" && HEX_COLOR.test(value) ? value : fallback;
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
critical: pick("critical", base.critical), hot: pick("hot", base.hot), warm: pick("warm", base.warm),
|
|
48
|
+
memory: pick("memory", base.memory), memoryHot: pick("memoryHot", base.memoryHot),
|
|
49
|
+
memoryWarm: pick("memoryWarm", base.memoryWarm ?? base.memoryHot), memoryCool: pick("memoryCool", base.memoryCool ?? base.memoryHot),
|
|
50
|
+
leak: pick("leak", base.leak), success: pick("success", base.success),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Every palette CSS variable with its value, and `--prof-hot-ink`, the text
|
|
55
|
+
* colour readable on the hot accent. A palette without a memory ramp ramps
|
|
56
|
+
* from its own memory accent, never the default's.
|
|
57
|
+
*/
|
|
58
|
+
function paletteVars(palette = profilerPalette()) {
|
|
59
|
+
const valid = resolvePalette(exports.DEFAULT_PALETTE, { ...palette,
|
|
60
|
+
memoryWarm: palette.memoryWarm ?? palette.memoryHot, memoryCool: palette.memoryCool ?? palette.memoryHot });
|
|
61
|
+
const vars = PALETTE_CSS_VARS.map(([key, name]) => [name, valid[key] ?? valid.memoryHot]);
|
|
62
|
+
return { ...Object.fromEntries(vars), "--prof-hot-ink": inkFor(valid.hot) };
|
|
63
|
+
}
|
|
64
|
+
/** The palette as CSS variables, with the same names in every profiler view. */
|
|
65
|
+
function paletteCss(palette = profilerPalette()) {
|
|
66
|
+
return `:root { ${Object.entries(paletteVars(palette)).map(([name, value]) => `${name}: ${value};`).join(" ")} }`;
|
|
67
|
+
}
|
|
68
|
+
const COLOR_CHANNEL_MAX = 255;
|
|
69
|
+
const LUMA_RED = 0.2126;
|
|
70
|
+
const LUMA_GREEN = 0.7152;
|
|
71
|
+
const LUMA_BLUE = 0.0722;
|
|
72
|
+
const LUMA_THRESHOLD = 0.5;
|
|
73
|
+
const RED_CHANNEL_OFFSET = 1;
|
|
74
|
+
const GREEN_CHANNEL_OFFSET = 3;
|
|
75
|
+
const BLUE_CHANNEL_OFFSET = 5;
|
|
76
|
+
/**
|
|
77
|
+
* Text that stays readable on `fill`, a six-digit hex colour: dark ink on a
|
|
78
|
+
* light fill, light ink on a dark one. Embedded in the flame webview, so it
|
|
79
|
+
* calls nothing else.
|
|
80
|
+
*/
|
|
81
|
+
function inkFor(fill) {
|
|
82
|
+
const channel = (at) => Number.parseInt(fill.slice(at, at + 2), 16) / COLOR_CHANNEL_MAX;
|
|
83
|
+
const luma = LUMA_RED * channel(RED_CHANNEL_OFFSET) + LUMA_GREEN * channel(GREEN_CHANNEL_OFFSET) + LUMA_BLUE * channel(BLUE_CHANNEL_OFFSET);
|
|
84
|
+
return luma < LUMA_THRESHOLD ? "rgba(245, 245, 245, 0.95)" : "rgba(15, 15, 15, 0.9)";
|
|
85
|
+
}
|
|
86
|
+
/** The source classification a host that supplies none gets: a frame with a file is source. */
|
|
87
|
+
function hasSourceFile(file) {
|
|
88
|
+
return file !== "";
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The frame ordering policy: by key, then by original index.
|
|
92
|
+
*
|
|
93
|
+
* The index term is not decoration. Two frames can share a file AND a name --
|
|
94
|
+
* one function inlined at two sites, or two runtime frames with no file at all
|
|
95
|
+
* -- and a comparator that answers 0 for those hands their order to whatever
|
|
96
|
+
* the engine does with elements it was told are equal. Rank is what picks a
|
|
97
|
+
* frame's colour, so an order the engine decides is a colour the engine
|
|
98
|
+
* decides, and the same profile stops looking the same twice.
|
|
99
|
+
*
|
|
100
|
+
* Exported because a sort's OUTPUT cannot tell this apart from a comparator
|
|
101
|
+
* with no tie-break at all: `Array.prototype.sort` is required to be stable,
|
|
102
|
+
* so equal elements come back in input order either way. The policy has to be
|
|
103
|
+
* asserted directly or it is not pinned.
|
|
104
|
+
*/
|
|
105
|
+
function byFrameKeyThenIndex(left, right) {
|
|
106
|
+
if (left.key < right.key) {
|
|
107
|
+
return -1;
|
|
108
|
+
}
|
|
109
|
+
if (left.key > right.key) {
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
return left.i - right.i;
|
|
113
|
+
}
|
|
114
|
+
/** Each frame's rank by (file, name): frame identity, never array order, picks its colour. */
|
|
115
|
+
function frameRanks(frames) {
|
|
116
|
+
const ranks = Array.from({ length: frames.length }, () => 0);
|
|
117
|
+
const keyed = frames.map((frame, index) => ({ key: `${frame.file ?? ""}\u0000${frame.name}`, i: index }));
|
|
118
|
+
for (const [rank, entry] of keyed.toSorted(byFrameKeyThenIndex).entries()) {
|
|
119
|
+
ranks[entry.i] = rank;
|
|
120
|
+
}
|
|
121
|
+
return ranks;
|
|
122
|
+
}
|
|
123
|
+
const RAMP_SIZE = 3;
|
|
124
|
+
/** Stable frame ranks choose from the host ramp; unknown frames stay neutral. */
|
|
125
|
+
function framePaletteColor(index, source, palette) {
|
|
126
|
+
return source ? [palette.critical, palette.hot, palette.warm][index % RAMP_SIZE] : "#78818b";
|
|
127
|
+
}
|
|
128
|
+
const CPU_HEAT_HIGH = 20;
|
|
129
|
+
const CPU_HEAT_MEDIUM = 10;
|
|
130
|
+
const CPU_HEAT_LOW = 5;
|
|
131
|
+
/** CPU heat thresholds shared by canvas and source annotations. */
|
|
132
|
+
function cpuHeatColor(pct, palette = profilerPalette()) {
|
|
133
|
+
if (pct >= CPU_HEAT_HIGH) {
|
|
134
|
+
return palette.critical;
|
|
135
|
+
}
|
|
136
|
+
if (pct >= CPU_HEAT_MEDIUM) {
|
|
137
|
+
return palette.hot;
|
|
138
|
+
}
|
|
139
|
+
if (pct >= CPU_HEAT_LOW) {
|
|
140
|
+
return palette.warm;
|
|
141
|
+
}
|
|
142
|
+
return "#88888899";
|
|
143
|
+
}
|
|
144
|
+
/** Every frame coloured from the host ramp by its rank. */
|
|
145
|
+
function paletteFrames(frames, palette) {
|
|
146
|
+
const ranks = frameRanks(frames);
|
|
147
|
+
return frames.map((frame, index) => ({ ...frame,
|
|
148
|
+
color: framePaletteColor(ranks[index] ?? index, frame.source ?? hasSourceFile(frame.file), palette) }));
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../src/palette.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sFAAsF;AACtF,4EAA4E;AAC5E,8EAA8E;AAC9E,8DAA8D;AAC9D,mDAA2C;AAc9B,QAAA,eAAe,GAAoB;IAC9C,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS;IACpD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS;CAC3H,CAAC;AAEF,mGAAmG;AACnG,MAAM,gBAAgB,GAA0D;IAC9E,CAAC,UAAU,EAAE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAClH,CAAC,WAAW,EAAE,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACrG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAAE,CAAC,SAAS,EA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MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK;QAC7C,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,KAAK,CAAC,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import type { ProcessesProvider } from "./process-explorer";
|
|
3
|
+
import type { TreeItem } from "./process-explorer-rows";
|
|
4
|
+
import type { ProfilerStore as Store } from "./store";
|
|
5
|
+
/**
|
|
6
|
+
* The panel is a pure projection of centralised state (#148): the store-side
|
|
7
|
+
* poll feeds `store.processes` while the view is visible, the revision
|
|
8
|
+
* subscription repaints on every store change, and the context-key mirror
|
|
9
|
+
* keeps the welcome's loading/error/empty copy honest (#147).
|
|
10
|
+
*/
|
|
11
|
+
export declare function bindPanel(store: Store, treeView: vscode.TreeView<TreeItem>, provider: ProcessesProvider): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.bindPanel = bindPanel;
|
|
37
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
38
|
+
const vscode = __importStar(require("vscode"));
|
|
39
|
+
const process_poll_1 = require("./process-poll");
|
|
40
|
+
const process_reactivity_1 = require("./process-reactivity");
|
|
41
|
+
const reactive_refresh_1 = require("./reactive-refresh");
|
|
42
|
+
const process_decoration_1 = require("./process-decoration");
|
|
43
|
+
/**
|
|
44
|
+
* The panel is a pure projection of centralised state (#148): the store-side
|
|
45
|
+
* poll feeds `store.processes` while the view is visible, the revision
|
|
46
|
+
* subscription repaints on every store change, and the context-key mirror
|
|
47
|
+
* keeps the welcome's loading/error/empty copy honest (#147).
|
|
48
|
+
*/
|
|
49
|
+
function bindPanel(store, treeView, provider) {
|
|
50
|
+
provider.disposables.push((0, process_poll_1.bindProcessPolling)(store, treeView), (0, process_poll_1.bindProcessesContextKey)(store), (0, process_poll_1.bindServerStateContextKey)(store));
|
|
51
|
+
(0, reactive_refresh_1.subscribeRevision)(store.processesRevision, provider);
|
|
52
|
+
// React to the store's profiling state: live chrome, button-gating context
|
|
53
|
+
// keys, and the active-row repaint ([PROF-UI-PROCESSES]).
|
|
54
|
+
provider.disposables.push(
|
|
55
|
+
// React to the store's profiling state: live chrome, button-gating context
|
|
56
|
+
// keys, and the active-row repaint ([PROF-UI-PROCESSES]).
|
|
57
|
+
(0, process_reactivity_1.bindProcessPanelReactivity)(store, treeView, provider),
|
|
58
|
+
// Reveal the inline Track Memory action only on the active debuggee row
|
|
59
|
+
// ([PROF-UI-PROCESSES]) — memory tracking can't target external processes.
|
|
60
|
+
(0, process_reactivity_1.bindDebuggeeTracking)(store));
|
|
61
|
+
// Colour workspace rows green and non-debuggable rows grey ([PROF-UI-PROCESSES]).
|
|
62
|
+
const decorations = new process_decoration_1.ProcessDecorationProvider(provider);
|
|
63
|
+
provider.disposables.push(decorations, vscode.window.registerFileDecorationProvider(decorations));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=process-bind-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-bind-panel.js","sourceRoot":"","sources":["../../src/process-bind-panel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AAGjC,iDAAwG;AACxG,6DAAwF;AACxF,yDAAuD;AACvD,6DAAiE;AAGjE;;;;;GAKG;AACH,mBAA0B,KAAY,EAAE,QAAmC,EAAE,QAA2B;IACtG,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAA,iCAAkB,EAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,IAAA,sCAAuB,EAAC,KAAK,CAAC,EAAE,IAAA,wCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC;IACjI,IAAA,oCAAiB,EAAC,KAAK,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACrD,2EAA2E;IAC3E,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,CAAC,IAAI;IACvB,2EAA2E;IAC3E,0DAA0D;IAC1D,IAAA,+CAA0B,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC;IACrD,wEAAwE;IACxE,2EAA2E;IAC3E,IAAA,yCAAoB,EAAC,KAAK,CAAC,CAC5B,CAAC;IACF,kFAAkF;IAClF,MAAM,WAAW,GAAG,IAAI,8CAAyB,CAAC,QAAQ,CAAC,CAAC;IAC5D,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import type { ProcessesProvider } from "./process-explorer";
|
|
3
|
+
import type { ProfilerStore as Store } from "./store";
|
|
4
|
+
/** The view's toolbar commands and the per-row actions. */
|
|
5
|
+
export declare function registerViewCommands(store: Store, provider: ProcessesProvider): vscode.Disposable[];
|
|
@@ -0,0 +1,112 @@
|
|
|
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.registerViewCommands = registerViewCommands;
|
|
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 failure_1 = require("./failure");
|
|
41
|
+
const server_command_1 = require("./server-command");
|
|
42
|
+
const process_poll_1 = require("./process-poll");
|
|
43
|
+
const progress_ops_1 = require("./progress-ops");
|
|
44
|
+
/** The view's toolbar commands and the per-row actions. */
|
|
45
|
+
function registerViewCommands(store, provider) {
|
|
46
|
+
return [
|
|
47
|
+
// Manual refresh runs under the view's progress bar so the click visibly
|
|
48
|
+
// does something; returns the promise so callers/tests can await it.
|
|
49
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("refreshProcesses"), async () => { await (0, progress_ops_1.withViewProgress)((0, ids_1.viewId)(), "Refresh processes", async () => { await provider.refreshNow(); }); }),
|
|
50
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("sortProcesses"), () => { provider.cycleSortMode(); }),
|
|
51
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("groupProcesses"), () => { provider.cycleGroupMode(); }),
|
|
52
|
+
...registerRowCommands(store, provider),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
/** The filter and the per-row actions: kill, copy PID, reveal the entry script. */
|
|
56
|
+
function registerRowCommands(store, provider) {
|
|
57
|
+
return [
|
|
58
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("filterProcesses"), async () => {
|
|
59
|
+
const input = await vscode.window.showInputBox({ prompt: "Filter processes by name, script, or PID", placeHolder: "e.g. uvicorn" });
|
|
60
|
+
provider.setFilter(input ?? "");
|
|
61
|
+
}),
|
|
62
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("killProcess"), async (item) => { await killProcess(store, item); }),
|
|
63
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("copyProcessPid"), (item) => {
|
|
64
|
+
if (item !== undefined) {
|
|
65
|
+
void vscode.env.clipboard.writeText(String(item.process.pid));
|
|
66
|
+
vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: Copied PID ${String(item.process.pid)}`);
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
vscode.commands.registerCommand((0, ids_1.cmd)("revealProcessScript"), (item) => { revealProcessScript(store, item); }),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
function revealProcessScript(store, item) {
|
|
73
|
+
const scriptPath = item?.process.script;
|
|
74
|
+
if (typeof scriptPath === "string" && store.sourceEntries(item?.process.runtime ?? "")) {
|
|
75
|
+
void vscode.window.showTextDocument(vscode.Uri.file(scriptPath));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: This process has no entry file to reveal.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Kill a row's process after a modal confirmation; the server refuses PIDs it
|
|
83
|
+
* does not recognise as profilable, so this can never hit the editor itself.
|
|
84
|
+
*/
|
|
85
|
+
async function killProcess(store, item) {
|
|
86
|
+
const client = store.client.value;
|
|
87
|
+
if (item === undefined || client?.isRunning() !== true) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!await confirmKill(item)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await performKill(store, client, item);
|
|
94
|
+
}
|
|
95
|
+
/** Ask the user to confirm terminating the row's process. */
|
|
96
|
+
async function confirmKill(item) {
|
|
97
|
+
const question = `${(0, ids_1.brand)()}: Kill process ${item.process.name} (PID ${String(item.process.pid)})? It will be terminated immediately.`;
|
|
98
|
+
const choice = await vscode.window.showWarningMessage(question, { modal: true }, "Kill");
|
|
99
|
+
return choice === "Kill";
|
|
100
|
+
}
|
|
101
|
+
/** Send the kill command and refresh the panel, surfacing any server refusal. */
|
|
102
|
+
async function performKill(store, client, item) {
|
|
103
|
+
try {
|
|
104
|
+
await (0, server_command_1.executeServerCommand)(client, (0, ids_1.lsp)("kill"), { pid: item.process.pid });
|
|
105
|
+
vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: Killed PID ${String(item.process.pid)}.`);
|
|
106
|
+
await (0, process_poll_1.fetchProcessesIntoStore)(store);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
vscode.window.showErrorMessage(`${(0, ids_1.brand)()}: ${(0, failure_1.errorText)(error)}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=process-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-commands.js","sourceRoot":"","sources":["../../src/process-commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AACjC,+BAAgD;AAIhD,uCAAsC;AACt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CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,IAAA,WAAK,GAAE,KAAK,IAAA,mBAAS,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as vscode from "vscode";
|
|
2
|
+
import type { ProfilerStore as Store } from "./store";
|
|
3
|
+
/** Mirror the language client's state to `<prefix>.profiler.serverState` so the welcome copy is honest. */
|
|
4
|
+
export declare function bindServerStateContextKey(store: Store): vscode.Disposable;
|
|
5
|
+
/**
|
|
6
|
+
* Mirror the store's fetch state to the `<prefix>.profiler.processesState` context key
|
|
7
|
+
* that gates the welcome's loading/error/empty copy (#147). Reactive: the
|
|
8
|
+
* effect re-fires whenever the store's process state changes, including the
|
|
9
|
+
* initial "loading" seed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function bindProcessesContextKey(store: Store): vscode.Disposable;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bindServerStateContextKey = bindServerStateContextKey;
|
|
4
|
+
exports.bindProcessesContextKey = bindProcessesContextKey;
|
|
5
|
+
const context_keys_1 = require("./context-keys");
|
|
6
|
+
const signals_core_1 = require("@preact/signals-core");
|
|
7
|
+
const node_1 = require("vscode-languageclient/node");
|
|
8
|
+
/** Mirror the language client's state to `<prefix>.profiler.serverState` so the welcome copy is honest. */
|
|
9
|
+
function bindServerStateContextKey(store) {
|
|
10
|
+
let subscription = undefined;
|
|
11
|
+
const disposeEffect = (0, signals_core_1.effect)(() => {
|
|
12
|
+
const client = store.client.value;
|
|
13
|
+
subscription?.dispose();
|
|
14
|
+
subscription = client?.onDidChangeState(() => { publishClientState(client); });
|
|
15
|
+
publishClientState(client);
|
|
16
|
+
});
|
|
17
|
+
return { dispose() { disposeEffect(); subscription?.dispose(); } };
|
|
18
|
+
}
|
|
19
|
+
/** Mirror one client's connection state to the `<prefix>.profiler.serverState` context key. */
|
|
20
|
+
function publishClientState(client) {
|
|
21
|
+
(0, context_keys_1.setContextKey)("serverState", clientStateLabel(client));
|
|
22
|
+
}
|
|
23
|
+
/** The welcome copy's label for a language client's connection state. */
|
|
24
|
+
function clientStateLabel(client) {
|
|
25
|
+
if (client === undefined) {
|
|
26
|
+
return "starting";
|
|
27
|
+
}
|
|
28
|
+
if (client.state === node_1.State.Running) {
|
|
29
|
+
return "running";
|
|
30
|
+
}
|
|
31
|
+
if (client.state === node_1.State.Stopped) {
|
|
32
|
+
return "stopped";
|
|
33
|
+
}
|
|
34
|
+
return "starting";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Mirror the store's fetch state to the `<prefix>.profiler.processesState` context key
|
|
38
|
+
* that gates the welcome's loading/error/empty copy (#147). Reactive: the
|
|
39
|
+
* effect re-fires whenever the store's process state changes, including the
|
|
40
|
+
* initial "loading" seed.
|
|
41
|
+
*/
|
|
42
|
+
function bindProcessesContextKey(store) {
|
|
43
|
+
const dispose = (0, signals_core_1.effect)(() => {
|
|
44
|
+
(0, context_keys_1.setContextKey)("processesState", store.processes.value.fetch);
|
|
45
|
+
});
|
|
46
|
+
return { dispose };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=process-context-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-context-keys.js","sourceRoot":"","sources":["../../src/process-context-keys.ts"],"names":[],"mappings":";;;;AAEA,iDAA+C;AAC/C,uDAA8C;AAC9C,qDAAmD;AAInD,2GAA2G;AAC3G,mCAA0C,KAAY;IACpD,IAAI,YAAY,GAAkC,SAAS,CAAC;IAC5D,MAAM,aAAa,GAAG,IAAA,qBAAM,EAAC,GAAG,EAAE;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QAClC,YAAY,EAAE,OAAO,EAAE,CAAC;QACxB,YAAY,GAAG,MAAM,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/E,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,KAAW,aAAa,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,+FAA+F;AAC/F,SAAS,kBAAkB,CAAC,MAAkC;IAC5D,IAAA,4BAAa,EAAC,aAAa,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,yEAAyE;AACzE,SAAS,gBAAgB,CAAC,MAAkC;IAC1D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,UAAU,CAAC;IAAC,CAAC;IAChD,IAAI,MAAM,CAAC,KAAK,KAAK,YAAK,CAAC,OAAO,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IACzD,IAAI,MAAM,CAAC,KAAK,KAAK,YAAK,CAAC,OAAO,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IACzD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,iCAAwC,KAAY;IAClD,MAAM,OAAO,GAAG,IAAA,qBAAM,EAAC,GAAG,EAAE;QAC1B,IAAA,4BAAa,EAAC,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import type { ProcessesProvider } from "./process-explorer";
|
|
3
|
+
/**
|
|
4
|
+
* Colours whole process-row labels green (workspace) or grey (non-debuggable),
|
|
5
|
+
* keyed on the synthetic `<prefix>-process:` URI each row carries — the only way
|
|
6
|
+
* to tint a tree item's full label. Implements [PROF-UI-PROCESSES].
|
|
7
|
+
*
|
|
8
|
+
* Greying wins over green: a process you cannot debug is never shown as an
|
|
9
|
+
* actionable workspace row.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ProcessDecorationProvider implements vscode.FileDecorationProvider, vscode.Disposable {
|
|
12
|
+
private readonly emitter;
|
|
13
|
+
readonly onDidChangeFileDecorations: vscode.Event<undefined>;
|
|
14
|
+
private readonly subscription;
|
|
15
|
+
constructor(provider: ProcessesProvider);
|
|
16
|
+
provideFileDecoration(uri: vscode.Uri): vscode.FileDecoration | undefined;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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.ProcessDecorationProvider = 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
|
+
/**
|
|
41
|
+
* Colours whole process-row labels green (workspace) or grey (non-debuggable),
|
|
42
|
+
* keyed on the synthetic `<prefix>-process:` URI each row carries — the only way
|
|
43
|
+
* to tint a tree item's full label. Implements [PROF-UI-PROCESSES].
|
|
44
|
+
*
|
|
45
|
+
* Greying wins over green: a process you cannot debug is never shown as an
|
|
46
|
+
* actionable workspace row.
|
|
47
|
+
*/
|
|
48
|
+
class ProcessDecorationProvider {
|
|
49
|
+
emitter = new vscode.EventEmitter();
|
|
50
|
+
onDidChangeFileDecorations = this.emitter.event;
|
|
51
|
+
subscription;
|
|
52
|
+
constructor(provider) {
|
|
53
|
+
// Rows are recreated on every refresh with state baked into their URI query;
|
|
54
|
+
// re-query decorations whenever the tree repaints so colours never go stale.
|
|
55
|
+
this.subscription = provider.onDidChangeTreeData(() => { this.emitter.fire(undefined); });
|
|
56
|
+
}
|
|
57
|
+
provideFileDecoration(uri) {
|
|
58
|
+
if (uri.scheme !== (0, ids_1.processUriScheme)()) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const params = new URLSearchParams(uri.query);
|
|
62
|
+
if (params.get("dbg") === "0") {
|
|
63
|
+
return { color: new vscode.ThemeColor("disabledForeground"), tooltip: "Can't profile" };
|
|
64
|
+
}
|
|
65
|
+
if (params.get("ws") === "1") {
|
|
66
|
+
return { color: new vscode.ThemeColor("charts.green"), tooltip: "Workspace process" };
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
dispose() {
|
|
71
|
+
this.subscription.dispose();
|
|
72
|
+
this.emitter.dispose();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.ProcessDecorationProvider = ProcessDecorationProvider;
|
|
76
|
+
//# sourceMappingURL=process-decoration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-decoration.js","sourceRoot":"","sources":["../../src/process-decoration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AACjC,+BAAyC;AAGzC;;;;;;;GAOG;AACH;IACmB,OAAO,GAAG,IAAI,MAAM,CAAC,YAAY,EAAa,CAAC;IAChD,0BAA0B,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/C,YAAY,CAAoB;IAEjD,YAAmB,QAA2B;QAC5C,6EAA6E;QAC7E,6EAA6E;QAC7E,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,CAAC;IAEM,qBAAqB,CAAC,GAAe;QAC1C,IAAI,GAAG,CAAC,MAAM,KAAK,IAAA,sBAAgB,GAAE,EAAE,CAAC;YAAC,OAAO,SAAS,CAAC;QAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI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