remove more commented code

This commit is contained in:
Mikayla 2024-01-12 11:42:03 -08:00
parent 3a836b8026
commit 5897b18cfd
No known key found for this signature in database
10 changed files with 63 additions and 134 deletions

View file

@ -1418,8 +1418,6 @@ async fn test_channel_moving(
) { ) {
let mut server = TestServer::start(executor.clone()).await; let mut server = TestServer::start(executor.clone()).await;
let client_a = server.create_client(cx_a, "user_a").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 let channels = server
.make_channel_tree( .make_channel_tree(

View file

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

View file

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

View file

@ -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). /// An identifier for an [`Element`](crate::Element).
/// ///
/// Can be constructed with a string, a number, or both, as well /// Can be constructed with a string, a number, or both, as well

View file

@ -99,20 +99,6 @@ pub trait Item {
fn project_path(&self, cx: &AppContext) -> Option<ProjectPath>; 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 { pub struct Project {
worktrees: Vec<WorktreeHandle>, worktrees: Vec<WorktreeHandle>,
active_entry: Option<ProjectEntryId>, active_entry: Option<ProjectEntryId>,

View file

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

View file

@ -1,3 +1,4 @@
use anyhow::bail;
use futures::FutureExt; use futures::FutureExt;
use gpui::{ use gpui::{
AnyElement, ElementId, FontStyle, FontWeight, HighlightStyle, InteractiveText, IntoElement, AnyElement, ElementId, FontStyle, FontWeight, HighlightStyle, InteractiveText, IntoElement,
@ -85,31 +86,6 @@ impl RichText {
}) })
.into_any_element() .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( pub fn render_markdown_mut(
@ -272,13 +248,6 @@ pub fn render_markdown(
language_registry: &Arc<LanguageRegistry>, language_registry: &Arc<LanguageRegistry>,
language: Option<&Arc<Language>>, language: Option<&Arc<Language>>,
) -> RichText { ) -> 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 text = String::new();
let mut highlights = Vec::new(); let mut highlights = Vec::new();
let mut link_ranges = Vec::new(); let mut link_ranges = Vec::new();

View file

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

View file

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

View file

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