Allow dumping the project diagnostic view's state as JSON

Also, improve DebugElements action so that it shows the JSON in an editor.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-04-11 19:51:46 -07:00
parent 54d49c13d9
commit 949fbe7cd3
9 changed files with 116 additions and 42 deletions

View file

@ -1,6 +1,7 @@
use crate::render_summary;
use gpui::{
elements::*, platform::CursorStyle, Entity, ModelHandle, RenderContext, View, ViewContext,
elements::*, platform::CursorStyle, serde_json, Entity, ModelHandle, RenderContext, View,
ViewContext,
};
use project::Project;
use settings::Settings;
@ -67,6 +68,10 @@ impl View for DiagnosticSummary {
.on_click(|cx| cx.dispatch_action(crate::Deploy))
.boxed()
}
fn debug_json(&self, _: &gpui::AppContext) -> serde_json::Value {
serde_json::json!({ "summary": self.summary })
}
}
impl StatusItemView for DiagnosticSummary {