diagnostics.rs

 1use editor::{Editor, MultiBuffer};
 2use gpui::{elements::*, Entity, ModelHandle, RenderContext, View, ViewContext, ViewHandle};
 3use postage::watch;
 4use project::Project;
 5
 6struct ProjectDiagnostics {
 7    editor: ViewHandle<Editor>,
 8    project: ModelHandle<Project>,
 9}
10
11impl ProjectDiagnostics {
12    fn new(
13        project: ModelHandle<Project>,
14        settings: watch::Receiver<workspace::Settings>,
15        cx: &mut ViewContext<Self>,
16    ) -> Self {
17        let mut buffer = cx.add_model(|cx| MultiBuffer::new(project.read(cx).replica_id(cx)));
18        for (project_path, diagnostic_summary) in project.read(cx).diagnostic_summaries(cx) {
19            //
20        }
21
22        Self {
23            editor: cx.add_view(|cx| {
24                Editor::for_buffer(
25                    buffer.clone(),
26                    editor::settings_builder(buffer.downgrade(), settings),
27                    cx,
28                )
29            }),
30            project,
31        }
32    }
33}
34
35impl Entity for ProjectDiagnostics {
36    type Event = ();
37}
38
39impl View for ProjectDiagnostics {
40    fn ui_name() -> &'static str {
41        "ProjectDiagnostics"
42    }
43
44    fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
45        ChildView::new(self.editor.id()).boxed()
46    }
47}