Refresh diagnostics inside the tab

This commit is contained in:
Kirill Bulatov 2023-11-03 18:33:17 +02:00
parent c529343ba1
commit 9cb8ce172d
5 changed files with 10 additions and 3 deletions

1
Cargo.lock generated
View file

@ -2461,6 +2461,7 @@ dependencies = [
"editor", "editor",
"gpui", "gpui",
"language", "language",
"log",
"lsp", "lsp",
"postage", "postage",
"project", "project",

View file

@ -20,6 +20,7 @@ theme = { path = "../theme" }
util = { path = "../util" } util = { path = "../util" }
workspace = { path = "../workspace" } workspace = { path = "../workspace" }
log.workspace = true
anyhow.workspace = true anyhow.workspace = true
schemars.workspace = true schemars.workspace = true
serde.workspace = true serde.workspace = true

View file

@ -151,6 +151,7 @@ impl ProjectDiagnosticsEditor {
) -> Self { ) -> Self {
cx.subscribe(&project_handle, |this, _, event, cx| match event { cx.subscribe(&project_handle, |this, _, event, cx| match event {
project::Event::DiskBasedDiagnosticsFinished { language_server_id } => { project::Event::DiskBasedDiagnosticsFinished { language_server_id } => {
log::debug!("Disk based diagnostics finished for server {language_server_id}");
this.update_excerpts(Some(*language_server_id), cx); this.update_excerpts(Some(*language_server_id), cx);
this.update_title(cx); this.update_title(cx);
} }
@ -158,8 +159,11 @@ impl ProjectDiagnosticsEditor {
language_server_id, language_server_id,
path, path,
} => { } => {
log::debug!("Adding path {path:?} to update for server {language_server_id}");
this.paths_to_update this.paths_to_update
.insert((path.clone(), *language_server_id)); .insert((path.clone(), *language_server_id));
this.update_excerpts(Some(*language_server_id), cx);
this.update_title(cx);
} }
_ => {} _ => {}
}) })
@ -229,6 +233,7 @@ impl ProjectDiagnosticsEditor {
language_server_id: Option<LanguageServerId>, language_server_id: Option<LanguageServerId>,
cx: &mut ViewContext<Self>, cx: &mut ViewContext<Self>,
) { ) {
log::debug!("Updating excerpts for server {language_server_id:?}");
let mut paths = Vec::new(); let mut paths = Vec::new();
self.paths_to_update.retain(|(path, server_id)| { self.paths_to_update.retain(|(path, server_id)| {
if language_server_id if language_server_id

View file

@ -34,7 +34,7 @@ use util::{
test::{marked_text_ranges, marked_text_ranges_by, sample_text, TextRangeMarker}, test::{marked_text_ranges, marked_text_ranges_by, sample_text, TextRangeMarker},
}; };
use workspace::{ use workspace::{
item::{FollowableItem, Item, ItemHandle}, item::{FollowableItem, Item},
NavigationEntry, ViewId, NavigationEntry, ViewId,
}; };

View file

@ -33,9 +33,9 @@ use util::{
paths::{PathExt, FILE_ROW_COLUMN_DELIMITER}, paths::{PathExt, FILE_ROW_COLUMN_DELIMITER},
ResultExt, TryFutureExt, ResultExt, TryFutureExt,
}; };
use workspace::item::{BreadcrumbText, FollowableItemHandle}; use workspace::item::{BreadcrumbText, FollowableItemHandle, ItemHandle};
use workspace::{ use workspace::{
item::{FollowableItem, Item, ItemEvent, ItemHandle, ProjectItem}, item::{FollowableItem, Item, ItemEvent, ProjectItem},
searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle},
ItemId, ItemNavHistory, Pane, StatusItemView, ToolbarItemLocation, ViewId, Workspace, ItemId, ItemNavHistory, Pane, StatusItemView, ToolbarItemLocation, ViewId, Workspace,
WorkspaceId, WorkspaceId,