From fe35695b138e1d86706f23fa07904c01c6971409 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Wed, 8 Jan 2025 13:53:52 -0700 Subject: [PATCH] Release syntax aware heuristic expansion of diagnostic excerpts (#22858) Implementation PR was #21942 Release Notes: - Improved diagnostic excerpts by using syntactic info to determine the context lines to show. --- Cargo.lock | 1 - crates/diagnostics/Cargo.toml | 1 - crates/diagnostics/src/diagnostics.rs | 23 ++++++++++------------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c06090c6df..f3a8100a9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3690,7 +3690,6 @@ dependencies = [ "ctor", "editor", "env_logger 0.11.6", - "feature_flags", "gpui", "language", "log", diff --git a/crates/diagnostics/Cargo.toml b/crates/diagnostics/Cargo.toml index f15792cdbe..b851a2733f 100644 --- a/crates/diagnostics/Cargo.toml +++ b/crates/diagnostics/Cargo.toml @@ -18,7 +18,6 @@ collections.workspace = true ctor.workspace = true editor.workspace = true env_logger.workspace = true -feature_flags.workspace = true gpui.workspace = true language.workspace = true log.workspace = true diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 4e76da63b6..43464310ed 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -14,7 +14,6 @@ use editor::{ scroll::Autoscroll, Editor, EditorEvent, ExcerptId, ExcerptRange, MultiBuffer, ToOffset, }; -use feature_flags::FeatureFlagAppExt; use gpui::{ actions, div, svg, AnyElement, AnyView, AppContext, Context, EventEmitter, FocusHandle, FocusableView, Global, HighlightStyle, InteractiveElement, IntoElement, Model, ParentElement, @@ -933,18 +932,16 @@ fn context_range_for_entry( snapshot: &BufferSnapshot, cx: &AppContext, ) -> Range { - if cx.is_staff() { - if let Some(rows) = heuristic_syntactic_expand( - entry.range.clone(), - DIAGNOSTIC_EXPANSION_ROW_LIMIT, - snapshot, - cx, - ) { - return Range { - start: Point::new(*rows.start(), 0), - end: snapshot.clip_point(Point::new(*rows.end(), u32::MAX), Bias::Left), - }; - } + if let Some(rows) = heuristic_syntactic_expand( + entry.range.clone(), + DIAGNOSTIC_EXPANSION_ROW_LIMIT, + snapshot, + cx, + ) { + return Range { + start: Point::new(*rows.start(), 0), + end: snapshot.clip_point(Point::new(*rows.end(), u32::MAX), Bias::Left), + }; } Range { start: Point::new(entry.range.start.row.saturating_sub(context), 0),