remove more commented code

Mikayla created

Change summary

crates/collab/src/tests/channel_tests.rs          |   2 
crates/collab_ui/src/collab_panel.rs              |   9 -
crates/gpui/src/style.rs                          | 104 ++++++++--------
crates/gpui/src/window.rs                         |   7 -
crates/project/src/project.rs                     |  14 --
crates/project_panel/src/project_panel.rs         |  32 ++--
crates/rich_text/src/rich_text.rs                 |  33 -----
crates/rpc/build.rs                               |   1 
crates/search/src/buffer_search.rs                |   1 
crates/semantic_index/src/semantic_index_tests.rs |   2 
10 files changed, 67 insertions(+), 138 deletions(-)

Detailed changes

crates/collab/src/tests/channel_tests.rs 🔗

@@ -1418,8 +1418,6 @@ async fn test_channel_moving(
 ) {
     let mut server = TestServer::start(executor.clone()).await;
     let client_a = server.create_client(cx_a, "user_a").await;
-    // let client_b = server.create_client(cx_b, "user_b").await;
-    // let client_c = server.create_client(cx_c, "user_c").await;
 
     let channels = server
         .make_channel_tree(

crates/collab_ui/src/collab_panel.rs 🔗

@@ -1426,14 +1426,6 @@ impl CollabPanel {
         self.toggle_channel_collapsed(id, cx)
     }
 
-    //     fn toggle_channel_collapsed_action(
-    //         &mut self,
-    //         action: &ToggleCollapse,
-    //         cx: &mut ViewContext<Self>,
-    //     ) {
-    //         self.toggle_channel_collapsed(action.location, cx);
-    //     }
-
     fn toggle_channel_collapsed<'a>(&mut self, channel_id: ChannelId, cx: &mut ViewContext<Self>) {
         match self.collapsed_channels.binary_search(&channel_id) {
             Ok(ix) => {
@@ -1910,7 +1902,6 @@ impl CollabPanel {
         let mut channel_link = None;
         let mut channel_tooltip_text = None;
         let mut channel_icon = None;
-        // let mut is_dragged_over = false;
 
         let text = match section {
             Section::ActiveCall => {

crates/gpui/src/style.rs 🔗

@@ -1,10 +1,10 @@
 use std::{iter, mem, ops::Range};
 
 use crate::{
-    black, phi, point, quad, rems, AbsoluteLength, BorrowWindow, Bounds, ContentMask, Corners,
-    CornersRefinement, CursorStyle, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures,
-    FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size,
-    SizeRefinement, Styled, TextRun, WindowContext,
+    black, phi, point, quad, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds,
+    ContentMask, Corners, CornersRefinement, CursorStyle, DefiniteLength, Edges, EdgesRefinement,
+    Font, FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rgba,
+    SharedString, Size, SizeRefinement, Styled, TextRun, WindowContext,
 };
 use collections::HashSet;
 use refineable::{Cascade, Refineable};
@@ -308,54 +308,54 @@ impl Style {
         }
     }
 
-    // pub fn apply_text_style<C, F, R>(&self, cx: &mut C, f: F) -> R
-    // where
-    //     C: BorrowAppContext,
-    //     F: FnOnce(&mut C) -> R,
-    // {
-    //     if self.text.is_some() {
-    //         cx.with_text_style(Some(self.text.clone()), f)
-    //     } else {
-    //         f(cx)
-    //     }
-    // }
-
-    // /// Apply overflow to content mask
-    // pub fn apply_overflow<C, F, R>(&self, bounds: Bounds<Pixels>, cx: &mut C, f: F) -> R
-    // where
-    //     C: BorrowWindow,
-    //     F: FnOnce(&mut C) -> R,
-    // {
-    //     let current_mask = cx.content_mask();
-
-    //     let min = current_mask.bounds.origin;
-    //     let max = current_mask.bounds.lower_right();
-
-    //     let mask_bounds = match (
-    //         self.overflow.x == Overflow::Visible,
-    //         self.overflow.y == Overflow::Visible,
-    //     ) {
-    //         // x and y both visible
-    //         (true, true) => return f(cx),
-    //         // x visible, y hidden
-    //         (true, false) => Bounds::from_corners(
-    //             point(min.x, bounds.origin.y),
-    //             point(max.x, bounds.lower_right().y),
-    //         ),
-    //         // x hidden, y visible
-    //         (false, true) => Bounds::from_corners(
-    //             point(bounds.origin.x, min.y),
-    //             point(bounds.lower_right().x, max.y),
-    //         ),
-    //         // both hidden
-    //         (false, false) => bounds,
-    //     };
-    //     let mask = ContentMask {
-    //         bounds: mask_bounds,
-    //     };
-
-    //     cx.with_content_mask(Some(mask), f)
-    // }
+    pub fn apply_text_style<C, F, R>(&self, cx: &mut C, f: F) -> R
+    where
+        C: BorrowAppContext,
+        F: FnOnce(&mut C) -> R,
+    {
+        if self.text.is_some() {
+            cx.with_text_style(Some(self.text.clone()), f)
+        } else {
+            f(cx)
+        }
+    }
+
+    /// Apply overflow to content mask
+    pub fn apply_overflow<C, F, R>(&self, bounds: Bounds<Pixels>, cx: &mut C, f: F) -> R
+    where
+        C: BorrowWindow,
+        F: FnOnce(&mut C) -> R,
+    {
+        let current_mask = cx.content_mask();
+
+        let min = current_mask.bounds.origin;
+        let max = current_mask.bounds.lower_right();
+
+        let mask_bounds = match (
+            self.overflow.x == Overflow::Visible,
+            self.overflow.y == Overflow::Visible,
+        ) {
+            // x and y both visible
+            (true, true) => return f(cx),
+            // x visible, y hidden
+            (true, false) => Bounds::from_corners(
+                point(min.x, bounds.origin.y),
+                point(max.x, bounds.lower_right().y),
+            ),
+            // x hidden, y visible
+            (false, true) => Bounds::from_corners(
+                point(bounds.origin.x, min.y),
+                point(bounds.lower_right().x, max.y),
+            ),
+            // both hidden
+            (false, false) => bounds,
+        };
+        let mask = ContentMask {
+            bounds: mask_bounds,
+        };
+
+        cx.with_content_mask(Some(mask), f)
+    }
 
     /// Paints the background of an element styled with this style.
     pub fn paint(

crates/gpui/src/window.rs 🔗

@@ -3137,13 +3137,6 @@ impl AnyWindowHandle {
     }
 }
 
-// #[cfg(any(test, feature = "test-support"))]
-// impl From<SmallVec<[u32; 16]>> for StackingOrder {
-//     fn from(small_vec: SmallVec<[u32; 16]>) -> Self {
-//         StackingOrder(small_vec)
-//     }
-// }
-
 /// An identifier for an [`Element`](crate::Element).
 ///
 /// Can be constructed with a string, a number, or both, as well

crates/project/src/project.rs 🔗

@@ -99,20 +99,6 @@ pub trait Item {
     fn project_path(&self, cx: &AppContext) -> Option<ProjectPath>;
 }
 
-// Language server state is stored across 3 collections:
-//     language_servers =>
-//         a mapping from unique server id to LanguageServerState which can either be a task for a
-//         server in the process of starting, or a running server with adapter and language server arcs
-//     language_server_ids => a mapping from worktreeId and server name to the unique server id
-//     language_server_statuses => a mapping from unique server id to the current server status
-//
-// Multiple worktrees can map to the same language server for example when you jump to the definition
-// of a file in the standard library. So language_server_ids is used to look up which server is active
-// for a given worktree and language server name
-//
-// When starting a language server, first the id map is checked to make sure a server isn't already available
-// for that worktree. If there is one, it finishes early. Otherwise, a new id is allocated and and
-// the Starting variant of LanguageServerState is stored in the language_servers map.
 pub struct Project {
     worktrees: Vec<WorktreeHandle>,
     active_entry: Option<ProjectEntryId>,

crates/project_panel/src/project_panel.rs 🔗

@@ -221,10 +221,10 @@ impl ProjectPanel {
             })
             .detach();
 
-            // cx.observe_global::<FileAssociations, _>(|_, cx| {
-            //     cx.notify();
-            // })
-            // .detach();
+            cx.observe_global::<FileAssociations>(|_, cx| {
+                cx.notify();
+            })
+            .detach();
 
             let mut this = Self {
                 project: project.clone(),
@@ -292,16 +292,16 @@ impl ProjectPanel {
                 }
                 &Event::SplitEntry { entry_id } => {
                     if let Some(worktree) = project.read(cx).worktree_for_entry(entry_id, cx) {
-                        if let Some(_entry) = worktree.read(cx).entry_for_id(entry_id) {
-                            // workspace
-                            //     .split_path(
-                            //         ProjectPath {
-                            //             worktree_id: worktree.read(cx).id(),
-                            //             path: entry.path.clone(),
-                            //         },
-                            //         cx,
-                            //     )
-                            //     .detach_and_log_err(cx);
+                        if let Some(entry) = worktree.read(cx).entry_for_id(entry_id) {
+                            workspace
+                                .split_path(
+                                    ProjectPath {
+                                        worktree_id: worktree.read(cx).id(),
+                                        path: entry.path.clone(),
+                                    },
+                                    cx,
+                                )
+                                .detach_and_log_err(cx);
                         }
                     }
                 }
@@ -788,10 +788,6 @@ impl ProjectPanel {
                     cx.notify();
                 }
             }
-
-            // cx.update_global(|drag_and_drop: &mut DragAndDrop<Workspace>, cx| {
-            //     drag_and_drop.cancel_dragging::<ProjectEntryId>(cx);
-            // })
         }
     }
 

crates/rich_text/src/rich_text.rs 🔗

@@ -1,3 +1,4 @@
+use anyhow::bail;
 use futures::FutureExt;
 use gpui::{
     AnyElement, ElementId, FontStyle, FontWeight, HighlightStyle, InteractiveText, IntoElement,
@@ -85,31 +86,6 @@ impl RichText {
         })
         .into_any_element()
     }
-
-    // pub fn add_mention(
-    //     &mut self,
-    //     range: Range<usize>,
-    //     is_current_user: bool,
-    //     mention_style: HighlightStyle,
-    // ) -> anyhow::Result<()> {
-    //     if range.end > self.text.len() {
-    //         bail!(
-    //             "Mention in range {range:?} is outside of bounds for a message of length {}",
-    //             self.text.len()
-    //         );
-    //     }
-
-    //     if is_current_user {
-    //         self.region_ranges.push(range.clone());
-    //         self.regions.push(RenderedRegion {
-    //             background_kind: Some(BackgroundKind::Mention),
-    //             link_url: None,
-    //         });
-    //     }
-    //     self.highlights
-    //         .push((range, Highlight::Highlight(mention_style)));
-    //     Ok(())
-    // }
 }
 
 pub fn render_markdown_mut(
@@ -272,13 +248,6 @@ pub fn render_markdown(
     language_registry: &Arc<LanguageRegistry>,
     language: Option<&Arc<Language>>,
 ) -> RichText {
-    // let mut data = RichText {
-    //     text: Default::default(),
-    //     highlights: Default::default(),
-    //     region_ranges: Default::default(),
-    //     regions: Default::default(),
-    // };
-
     let mut text = String::new();
     let mut highlights = Vec::new();
     let mut link_ranges = Vec::new();

crates/rpc/build.rs 🔗

@@ -1,6 +1,5 @@
 fn main() {
     let mut build = prost_build::Config::new();
-    // build.protoc_arg("--experimental_allow_proto3_optional");
     build
         .type_attribute(".", "#[derive(serde::Serialize)]")
         .compile_protos(&["proto/zed.proto"], &["proto"])

crates/search/src/buffer_search.rs 🔗

@@ -1648,7 +1648,6 @@ mod tests {
 
     #[gpui::test]
     async fn test_search_query_history(cx: &mut TestAppContext) {
-        //crate::project_search::tests::init_test(cx);
         init_globals(cx);
         let buffer_text = r#"
         A regular expression (shortened as regex or regexp;[1] also referred to as

crates/semantic_index/src/semantic_index_tests.rs 🔗

@@ -1677,8 +1677,6 @@ fn elixir_lang() -> Arc<Language> {
 
 #[gpui::test]
 fn test_subtract_ranges() {
-    // collapsed_ranges: Vec<Range<usize>>, keep_ranges: Vec<Range<usize>>
-
     assert_eq!(
         subtract_ranges(&[0..5, 10..21], &[0..1, 4..5]),
         vec![1..4, 10..21]