Add initial element inspector for Zed development (#31315)

Open inspector with `dev: toggle inspector` from command palette or
`cmd-alt-i` on mac or `ctrl-alt-i` on linux.

https://github.com/user-attachments/assets/54c43034-d40b-414e-ba9b-190bed2e6d2f

* Picking of elements via the mouse, with scroll wheel to inspect
occluded elements.

* Temporary manipulation of the selected element.

* Layout info and JSON-based style manipulation for `Div`.

* Navigation to code that constructed the element.

Big thanks to @as-cii and @maxdeviant for sorting out how to implement
the core of an inspector.

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Federico Dionisi <code@fdionisi.me>
This commit is contained in:
Michael Sloan 2025-05-23 17:08:59 -06:00 committed by GitHub
parent 685933b5c8
commit ab59982bf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 2631 additions and 406 deletions

24
Cargo.lock generated
View file

@ -112,7 +112,6 @@ dependencies = [
"serde_json",
"serde_json_lenient",
"settings",
"smallvec",
"smol",
"streaming_diff",
"telemetry",
@ -8159,6 +8158,26 @@ dependencies = [
"generic-array",
]
[[package]]
name = "inspector_ui"
version = "0.1.0"
dependencies = [
"anyhow",
"command_palette_hooks",
"editor",
"gpui",
"language",
"project",
"serde_json",
"serde_json_lenient",
"theme",
"ui",
"util",
"workspace",
"workspace-hack",
"zed_actions",
]
[[package]]
name = "install_cli"
version = "0.1.0"
@ -8931,8 +8950,10 @@ dependencies = [
"regex",
"rope",
"rust-embed",
"schemars",
"serde",
"serde_json",
"serde_json_lenient",
"settings",
"smol",
"snippet_provider",
@ -19750,6 +19771,7 @@ dependencies = [
"image_viewer",
"indoc",
"inline_completion_button",
"inspector_ui",
"install_cli",
"jj_ui",
"journal",