Make tests less noisy (#12463)

When running the tests for linux, I found a lot of benign errors getting
logged. This PR cuts down some of the noise from unnecessary workspace
serialization and SVG renders

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-05-29 18:06:45 -07:00 committed by GitHub
parent bdf627ce07
commit 5a149b970c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 216 additions and 172 deletions

View file

@ -221,7 +221,9 @@ impl TerminalPanel {
let (panel, pane, items) = workspace.update(&mut cx, |workspace, cx| {
let panel = cx.new_view(|cx| TerminalPanel::new(workspace, cx));
let items = if let Some(serialized_panel) = serialized_panel.as_ref() {
let items = if let Some((serialized_panel, database_id)) =
serialized_panel.as_ref().zip(workspace.database_id())
{
panel.update(cx, |panel, cx| {
cx.notify();
panel.height = serialized_panel.height.map(|h| h.round());
@ -234,7 +236,7 @@ impl TerminalPanel {
TerminalView::deserialize(
workspace.project().clone(),
workspace.weak_handle(),
workspace.database_id(),
database_id,
*item_id,
cx,
)

View file

@ -91,7 +91,7 @@ pub struct TerminalView {
blinking_paused: bool,
blink_epoch: usize,
can_navigate_to_selected_word: bool,
workspace_id: WorkspaceId,
workspace_id: Option<WorkspaceId>,
show_title: bool,
_subscriptions: Vec<Subscription>,
_terminal_subscriptions: Vec<Subscription>,
@ -142,7 +142,7 @@ impl TerminalView {
pub fn new(
terminal: Model<Terminal>,
workspace: WeakView<Workspace>,
workspace_id: WorkspaceId,
workspace_id: Option<WorkspaceId>,
cx: &mut ViewContext<Self>,
) -> Self {
let workspace_handle = workspace.clone();
@ -458,15 +458,16 @@ fn subscribe_for_terminal_events(
if terminal.task().is_none() {
if let Some(cwd) = terminal.get_cwd() {
let item_id = cx.entity_id();
let workspace_id = this.workspace_id;
cx.background_executor()
.spawn(async move {
TERMINAL_DB
.save_working_directory(item_id.as_u64(), workspace_id, cwd)
.await
.log_err();
})
.detach();
if let Some(workspace_id) = this.workspace_id {
cx.background_executor()
.spawn(async move {
TERMINAL_DB
.save_working_directory(item_id.as_u64(), workspace_id, cwd)
.await
.log_err();
})
.detach();
}
}
}
}
@ -853,7 +854,7 @@ impl Item for TerminalView {
fn clone_on_split(
&self,
_workspace_id: WorkspaceId,
_workspace_id: Option<WorkspaceId>,
_cx: &mut ViewContext<Self>,
) -> Option<View<Self>> {
//From what I can tell, there's no way to tell the current working
@ -941,20 +942,18 @@ impl Item for TerminalView {
project.create_terminal(cwd, None, window, cx)
})??;
pane.update(&mut cx, |_, cx| {
cx.new_view(|cx| TerminalView::new(terminal, workspace, workspace_id, cx))
cx.new_view(|cx| TerminalView::new(terminal, workspace, Some(workspace_id), cx))
})
})
}
fn added_to_workspace(&mut self, workspace: &mut Workspace, cx: &mut ViewContext<Self>) {
if self.terminal().read(cx).task().is_none() {
cx.background_executor()
.spawn(TERMINAL_DB.update_workspace_id(
workspace.database_id(),
self.workspace_id,
cx.entity_id().as_u64(),
))
.detach();
if let Some((new_id, old_id)) = workspace.database_id().zip(self.workspace_id) {
cx.background_executor()
.spawn(TERMINAL_DB.update_workspace_id(new_id, old_id, cx.entity_id().as_u64()))
.detach();
}
self.workspace_id = workspace.database_id();
}
}