Fix panic when diagnostics first opens (#28935)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
a7a7335da4
commit
ad25cd09b6
2 changed files with 4 additions and 3 deletions
|
@ -46,6 +46,7 @@ use workspace::{
|
||||||
|
|
||||||
actions!(diagnostics, [Deploy, ToggleWarnings]);
|
actions!(diagnostics, [Deploy, ToggleWarnings]);
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub(crate) struct IncludeWarnings(bool);
|
pub(crate) struct IncludeWarnings(bool);
|
||||||
impl Global for IncludeWarnings {}
|
impl Global for IncludeWarnings {}
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,9 @@ impl Render for DiagnosticIndicator {
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
.on_click(cx.listener(|this, _, window, cx| {
|
||||||
if let Some(workspace) = this.workspace.upgrade() {
|
if let Some(workspace) = this.workspace.upgrade() {
|
||||||
if this.summary.error_count == 0 && this.summary.warning_count > 0 {
|
if this.summary.error_count == 0 && this.summary.warning_count > 0 {
|
||||||
cx.update_global(|show_warnings: &mut IncludeWarnings, _| {
|
cx.update_default_global(
|
||||||
show_warnings.0 = true
|
|show_warnings: &mut IncludeWarnings, _| show_warnings.0 = true,
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
workspace.update(cx, |workspace, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
ProjectDiagnosticsEditor::deploy(
|
ProjectDiagnosticsEditor::deploy(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue