WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
6645e2820c
commit
85674ba506
11 changed files with 554 additions and 417 deletions
14
crates/diagnostics/Cargo.toml
Normal file
14
crates/diagnostics/Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "diagnostics"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
path = "src/diagnostics.rs"
|
||||
|
||||
[dependencies]
|
||||
editor = { path = "../editor" }
|
||||
gpui = { path = "../gpui" }
|
||||
project = { path = "../project" }
|
||||
workspace = { path = "../workspace" }
|
||||
postage = { version = "0.4", features = ["futures-traits"] }
|
45
crates/diagnostics/src/diagnostics.rs
Normal file
45
crates/diagnostics/src/diagnostics.rs
Normal file
|
@ -0,0 +1,45 @@
|
|||
use editor::{Editor, MultiBuffer};
|
||||
use gpui::{elements::*, Entity, ModelHandle, RenderContext, View, ViewContext, ViewHandle};
|
||||
use postage::watch;
|
||||
use project::Project;
|
||||
|
||||
struct ProjectDiagnostics {
|
||||
editor: ViewHandle<Editor>,
|
||||
project: ModelHandle<Project>,
|
||||
}
|
||||
|
||||
impl ProjectDiagnostics {
|
||||
fn new(
|
||||
project: ModelHandle<Project>,
|
||||
settings: watch::Receiver<workspace::Settings>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Self {
|
||||
let mut buffer = cx.add_model(|cx| MultiBuffer::new(project.read(cx).replica_id(cx)));
|
||||
for (path, diagnostics) in project.read(cx).diagnostics(cx) {}
|
||||
|
||||
Self {
|
||||
editor: cx.add_view(|cx| {
|
||||
Editor::for_buffer(
|
||||
buffer.clone(),
|
||||
editor::settings_builder(buffer.downgrade(), settings),
|
||||
cx,
|
||||
)
|
||||
}),
|
||||
project,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Entity for ProjectDiagnostics {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
impl View for ProjectDiagnostics {
|
||||
fn ui_name() -> &'static str {
|
||||
"ProjectDiagnostics"
|
||||
}
|
||||
|
||||
fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
|
||||
ChildView::new(self.editor.id()).boxed()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue