Zephyr Build LensHover a C macro definition name, or select part of its body and right-click Inspect Build Output. The primary preview is a native source-adjacent VS Code hover. It shows the selected build snapshot's device/config/data objects, linked references and DTS identity. It creates no editor tab, floating window or native helper process. Values come from saved ELF/DWARF. Data is the ELF initializer, not live RAM. Function bodies and macro expressions are current-source preprocessing, labelled separately from saved ELF evidence. Unverified historical artifacts remain candidates; they are not presented as proof of a current build. Inspect response stagesExplicit Inspect first shows saved build identity. Repeated queries for the same source, selection and snapshot can show the previous output immediately, labelled as pending revalidation. The current compiler/input/review checks still run; the final result replaces that card. Previous function text is labelled as previous preprocessing. Details links become available after validation. Closing the card or changing source/selection discards late results. Macro tracing reuses token-validated output only after both current ordinary and directives-only
preprocessing inputs match, along with compiler/context/implementation identity. This skips the
instrumented third pass on a cache hit. Build freshness checks remain unchanged. Disposable trace
files live under Windows build discoverySource, build and snapshot comparisons normalize the Windows drive letter, so paths
such as Independent Details scrollingThe Devicetree and details panes scroll independently. The tree heading and scope buttons stay visible while browsing nodes. Narrow windows stack the two panes and retain separate scrolling. Expanded build metadata has its own bounded area, and compiler evidence stays reachable in the details pane. Windows macro tracingNormalize compiler text output before tracking source lines and running the second preprocessing pass. With CRLF source files, Windows GCC can emit doubled carriage returns in directives-only output; these previously shifted macro definition lines and caused Inspect to report zero invocations. Token equality checks remain required. Existing snapshots can be reused; this correction does not require a rebuild. One installer, three desktop platforms (26.0.0)Install
Each host needs Python 3.12+ with pyelftools, its Zephyr source/build metadata, and a compatible GCC
preprocessor/Ninja environment. On Windows choose the build venv's The core now accepts From the repository root, build the optional helper for reproducible release packaging on macOS with
Use
Automatic hover only runs on a macro definition name. It never opens a picker or notification,
starts a build, or guesses which snapshot to use. With no saved/configured snapshot it offers a
snapshot-selection link. Set The public Hover API supports Markdown and command links, but has no arbitrary Webview, per-hover
pin state, source overlay positioning or visibility event. The focus action uses the existing
Public references:
The first selection runs only that translation unit's preprocessor using DTS containment comes from built node paths. Supply and C config parent references remain object references; they do not change tree nesting. A node with no ELF object is labelled explicitly, and its absence does not identify the reason. Ancestors synthesized from a path are labelled as context when no node properties are present in the snapshot. Evidence and limitsThe GCC preprocessor marks the selected active definition in a temporary directives-only stream. No workspace source or header is edited. Each emitted occurrence records its arguments and exact expanded tokens. Removing the markers must reproduce the ordinary preprocessor token stream; otherwise the query fails without broad candidate matching. Explicit initializer designators locate fields. Values still come from the saved ELF, not evaluation of the expression by the tool. Macro output and device identity are separate. A PWM helper can produce a field expression without creating a device; uses inside static assertions remain separate from field initialization. Object declarations retain each instance's own config/data/device symbols even when a higher macro expands multiple instances on one source line. View all selected macro expansions also shows uses outside linked initializers, including static assertions. Tracing covers emitted C tokens, not uses confined to conditional directives. Variadic definitions, repeated include definitions, positional/array field attribution and compiler-specific constructs may be unsupported. Token differences such as contextual BASE_FILE changes produce an explicit error. GCC is the validated macro-tracing compiler; other compilers may reject this mode. For a legacy ELF with no matching build receipt, current preprocessing cannot retroactively prove its source. The panel labels these relations as candidates and keeps the linked values intact. Unsaved editor content must be saved before compiler expansion. Unsupported compilers/wrappers and missing compile commands produce an error rather than guessing instances. Header selections need a matching DevelopmentNo JavaScript runtime dependencies are required. The Extension Host supplies The CLI and HTML report remain available for automation and export. The editor selection command is the primary interactive preview entry point. Integer config/data fields are displayed in hexadecimal, padded to their ELF type width.
Negative integers with a known width use two's-complement hexadecimal and retain a signed-value
annotation. Finite floating point values, source line numbers and counts keep their numeric
representation. Nonfinite floats use JSON strings Multiple anonymous struct/union members are retained separately in declaration order. Re-extract existing snapshots to recover fields omitted by an older parser. For integrated builds, enable Build Integration again for that build to install the updated runtime, then run a normal build. Updating the VSIX alone does not rewrite immutable snapshots or workspace runtime copies. Final DTS node overviewIn The selected source is used only to locate a path or label in the saved build. It is not reparsed as a new build. Macro-generated names and ambiguous source blocks prompt for an explicit node from the selected snapshot. Source mismatch, missing nodes and missing baseline remain visible. Old snapshots work; re-extract an existing build to add final per-property source locations. No firmware rebuild is necessary for this metadata update. Overwritten/deleted assignment history is not saved. References such as supplies, clocks and pinctrl are navigable separately from DTS children. The actual config/data/device/API fields come from ELF/DWARF, not a guessed transformation of DTS. Virtual historical diff documents show an explanation; baseline-side integration remains future work. Ordered macro review and cursor trackingMacro previews group output by complete source fragments and preserve compiler emission order. Function definitions are included alongside linked objects. Function bodies are current source expansions; a linked function reference is shown separately when the saved snapshot has evidence. Every object card includes its related DTS labels and paths, including device ordinal symbols. After opening a preview, move the cursor or select lines in the same source document. Confirmed source fragments/declarations highlight and scroll into view. This does not rerun preprocessing. A later edit invalidates that mapping; refresh Preview to analyze the new source. Fine-grained source mapping is enabled only when injected markers leave compiler output tokens unchanged. Reduced-motion preferences disable the pulse animation. Field-level causal attribution is not inferred. The visible build card includes snapshot path, snapshot generation time, application/sample, board, build directory and recorded build completion time. Missing times stay missing; ELF file time is labelled as filesystem metadata. Details include config/toolchain, command, Git, ELF hashes and Python. For old snapshots, application/toolchain metadata is supplemented only from an unchanged CMake cache whose content hash matches the saved input manifest. Python discovery checks the saved build interpreter first, then python3.12/python3, unless explicitly configured. It validates Python 3.12+ and pyelftools before importing the core. Xcode Python 3.9 produces an actionable message. Choose Python Interpreter validates an explicit interpreter too. Quick Look review preview (macOS)The explicit full-details command uses the portable VS Code floating window by default, falling
back to an adjacent editor when the host has no floating-window command. The optional setting
Press Escape with focus in the preview or source editor, click 关闭预览 ×, or run Zephyr Build Lens: Close Preview to dismiss it. Escape in the source editor yields to suggestions and snippet mode. The diff selection and scroll position stay in place. Move/resize the panel using its native title bar/frame. It stays above ordinary windows while reviewing and can be closed without closing the source. Clicking back into the source intentionally keeps it visible for selection highlighting; clicking outside does not dismiss it automatically. This is a custom quick-view panel, not the system Finder Quick Look service or a DOM overlay inside VS Code. It uses public AppKit/WebKit APIs and local stdin/stdout IPC, with no HTTP server. The same rendering, exact ELF values and core selection query are reused. The renderer denies navigation and uses a nonpersistent WebKit store plus the existing restrictive Content Security Policy. Source links still pass through the extension's allowed-path checks. Extension disposal or closed IPC shuts down the helper. The helper does not compile firmware or interpret config values. The single universal VSIX installs on Windows, Linux and macOS. It bundles an ad-hoc signed
arm64/x86_64 native helper for the optional macOS 13-or-newer feature built from
The package must retain the helper's executable permission. Do not run the source build command
from an installed extension; use the packaged VSIX. The native helper is macOS-only and is loaded only for explicit VS Code's Floating mode uses the public For an Agents window that does not list the command, enable the extension in Agent Customizations, or use the documented setting and reload that window:
This is the host's extension enablement setting, separate from preview presentation. Hover in Changes and other multi-file diffsOn the modified workspace side, automatic Hover uses the document and position supplied by
VS Code's The editor context menu supplies a document URI but no selection. Inspect Built Output asks the focused native editor to invoke Hover and captures its document and position before querying. The final result returns through that same provider invocation, preserving the embedded editor anchor without hiding and reopening the card. This path waits for query validation before returning the card; ordinary editor Inspect can show provisional results while validation runs. If the host supplies no matching provider context, Inspect reports that limitation rather than using another active editor. Command Palette invocation uses the active editor when available. For diagnostics, open Output → Zephyr Build Lens. Local JSON lines include host/extension
versions and Regression tests cover embedded diffs with no exposed editor and with an unrelated active editor.
Structure and languageThe test package is Zephyr Build Lens 26.0.0 with extension ID
Hover uses the native editor theme and restrained Markdown. A compact evidence line shows stale, unverified-source and missing-baseline states. The DTS outline uses only saved node containment. A separate typed C object tree follows actual device/config/data/API pointers and struct members. Parent/supply references identify their target DTS path and do not become DTS children. Descriptor and other secondary references show identity/type; full fields remain available in Details. Union variants are overlapping interpretations, never a guessed active member. Long symbols are visibly abbreviated; full symbols and raw fields remain in Details. Arrays, depth, object branches and the first expansion are bounded explicitly. The emission-order outline retains functions and other generated declarations; current function bodies remain separate from linked ELF evidence. Commands, Hover, inspector controls and owned diagnostics follow The full inspector uses theme colors, thin dividers and collapsed build/evidence sections. It keeps
keyboard focus outlines and reduced-motion support. Native Quick Look falls back to the public
active theme's light/dark kind. Build integrationEnable Build Integration preserves existing west CMake arguments and extra modules, installs a stable
workspace-local runtime, and adds build-graph input capture and final-ELF extraction. The editor need
not be running during builds. Snapshots are stored under When connecting an existing build, choose the directory passed to Disable Build Integration removes only the registered module paths and reconfigures known builds. Other arguments and saved snapshots are retained. Uninstalling the VSIX alone does not disable the workspace integration. Re-enable with an existing build selected to refresh its cached runtime. Python must have west and pyelftools. Fixed snapshot settings still override automatic routing. |