
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>
24 lines
744 B
Rust
24 lines
744 B
Rust
#[cfg(debug_assertions)]
|
|
mod div_inspector;
|
|
#[cfg(debug_assertions)]
|
|
mod inspector;
|
|
|
|
#[cfg(debug_assertions)]
|
|
pub use inspector::init;
|
|
|
|
#[cfg(not(debug_assertions))]
|
|
pub fn init(_app_state: std::sync::Arc<workspace::AppState>, cx: &mut gpui::App) {
|
|
use std::any::TypeId;
|
|
use workspace::notifications::NotifyResultExt as _;
|
|
|
|
cx.on_action(|_: &zed_actions::dev::ToggleInspector, cx| {
|
|
Err::<(), anyhow::Error>(anyhow::anyhow!(
|
|
"dev::ToggleInspector is only available in debug builds"
|
|
))
|
|
.notify_app_err(cx);
|
|
});
|
|
|
|
command_palette_hooks::CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
filter.hide_action_types(&[TypeId::of::<zed_actions::dev::ToggleInspector>()]);
|
|
});
|
|
}
|