@@ -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(
|
||||
|
||||
@@ -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 => {
|
||||
@@ -2052,7 +2043,7 @@ impl CollabPanel {
|
||||
}),
|
||||
)
|
||||
.start_slot(
|
||||
// todo!() handle contacts with no avatar
|
||||
// todo handle contacts with no avatar
|
||||
Avatar::new(contact.user.avatar_uri.clone())
|
||||
.availability_indicator(if online { Some(!busy) } else { None }),
|
||||
)
|
||||
|
||||
@@ -41,10 +41,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||
chat_panel::init(cx);
|
||||
notification_panel::init(cx);
|
||||
notifications::init(&app_state, cx);
|
||||
|
||||
// cx.add_global_action(toggle_screen_sharing);
|
||||
// cx.add_global_action(toggle_mute);
|
||||
// cx.add_global_action(toggle_deafen);
|
||||
}
|
||||
|
||||
pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
|
||||
@@ -131,34 +127,6 @@ fn notification_window_options(
|
||||
}
|
||||
}
|
||||
|
||||
// fn render_avatar<T: 'static>(
|
||||
// avatar: Option<Arc<ImageData>>,
|
||||
// avatar_style: &AvatarStyle,
|
||||
// container: ContainerStyle,
|
||||
// ) -> AnyElement<T> {
|
||||
// avatar
|
||||
// .map(|avatar| {
|
||||
// Image::from_data(avatar)
|
||||
// .with_style(avatar_style.image)
|
||||
// .aligned()
|
||||
// .contained()
|
||||
// .with_corner_radius(avatar_style.outer_corner_radius)
|
||||
// .constrained()
|
||||
// .with_width(avatar_style.outer_width)
|
||||
// .with_height(avatar_style.outer_width)
|
||||
// .into_any()
|
||||
// })
|
||||
// .unwrap_or_else(|| {
|
||||
// Empty::new()
|
||||
// .constrained()
|
||||
// .with_width(avatar_style.outer_width)
|
||||
// .into_any()
|
||||
// })
|
||||
// .contained()
|
||||
// .with_style(container)
|
||||
// .into_any()
|
||||
// }
|
||||
|
||||
fn is_channels_feature_enabled(cx: &gpui::WindowContext<'_>) -> bool {
|
||||
cx.is_staff() || cx.has_flag::<ChannelsAlpha>()
|
||||
}
|
||||
|
||||
+14
-19
@@ -1955,17 +1955,21 @@ impl Editor {
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn language_at<'a, T: ToOffset>(
|
||||
// &self,
|
||||
// point: T,
|
||||
// cx: &'a AppContext,
|
||||
// ) -> Option<Arc<Language>> {
|
||||
// self.buffer.read(cx).language_at(point, cx)
|
||||
// }
|
||||
pub fn language_at<'a, T: ToOffset>(
|
||||
&self,
|
||||
point: T,
|
||||
cx: &'a AppContext,
|
||||
) -> Option<Arc<Language>> {
|
||||
self.buffer.read(cx).language_at(point, cx)
|
||||
}
|
||||
|
||||
// pub fn file_at<'a, T: ToOffset>(&self, point: T, cx: &'a AppContext) -> Option<Arc<dyn File>> {
|
||||
// self.buffer.read(cx).read(cx).file_at(point).cloned()
|
||||
// }
|
||||
pub fn file_at<'a, T: ToOffset>(
|
||||
&self,
|
||||
point: T,
|
||||
cx: &'a AppContext,
|
||||
) -> Option<Arc<dyn language::File>> {
|
||||
self.buffer.read(cx).read(cx).file_at(point).cloned()
|
||||
}
|
||||
|
||||
pub fn active_excerpt(
|
||||
&self,
|
||||
@@ -1976,15 +1980,6 @@ impl Editor {
|
||||
.excerpt_containing(self.selections.newest_anchor().head(), cx)
|
||||
}
|
||||
|
||||
// pub fn style(&self, cx: &AppContext) -> EditorStyle {
|
||||
// build_style(
|
||||
// settings::get::<ThemeSettings>(cx),
|
||||
// self.get_field_editor_theme.as_deref(),
|
||||
// self.override_text_style.as_deref(),
|
||||
// cx,
|
||||
// )
|
||||
// }
|
||||
|
||||
pub fn mode(&self) -> EditorMode {
|
||||
self.mode
|
||||
}
|
||||
|
||||
@@ -355,16 +355,6 @@ impl Hsla {
|
||||
}
|
||||
}
|
||||
|
||||
// impl From<Hsla> for Rgba {
|
||||
// fn from(value: Hsla) -> Self {
|
||||
// let h = value.h;
|
||||
// let s = value.s;
|
||||
// let l = value.l;
|
||||
|
||||
// let c = (1 - |2L - 1|) X s
|
||||
// }
|
||||
// }
|
||||
|
||||
impl From<Rgba> for Hsla {
|
||||
fn from(color: Rgba) -> Self {
|
||||
let r = color.r;
|
||||
|
||||
+48
-48
@@ -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)
|
||||
// }
|
||||
// }
|
||||
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();
|
||||
/// 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 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,
|
||||
// };
|
||||
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)
|
||||
// }
|
||||
cx.with_content_mask(Some(mask), f)
|
||||
}
|
||||
|
||||
/// Paints the background of an element styled with this style.
|
||||
pub fn paint(
|
||||
|
||||
@@ -271,20 +271,6 @@ impl ToTaffy<taffy::style::Style> for Style {
|
||||
}
|
||||
}
|
||||
|
||||
// impl ToTaffy for Bounds<Length> {
|
||||
// type Output = taffy::prelude::Bounds<taffy::prelude::LengthPercentageAuto>;
|
||||
|
||||
// fn to_taffy(
|
||||
// &self,
|
||||
// rem_size: Pixels,
|
||||
// ) -> taffy::prelude::Bounds<taffy::prelude::LengthPercentageAuto> {
|
||||
// taffy::prelude::Bounds {
|
||||
// origin: self.origin.to_taffy(rem_size),
|
||||
// size: self.size.to_taffy(rem_size),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
impl ToTaffy<taffy::style::LengthPercentageAuto> for Length {
|
||||
fn to_taffy(&self, rem_size: Pixels) -> taffy::prelude::LengthPercentageAuto {
|
||||
match self {
|
||||
|
||||
@@ -60,16 +60,6 @@ impl<V: 'static> View<V> {
|
||||
self.model.read(cx)
|
||||
}
|
||||
|
||||
// pub fn render_with<E>(&self, component: E) -> RenderViewWith<E, V>
|
||||
// where
|
||||
// E: 'static + Element,
|
||||
// {
|
||||
// RenderViewWith {
|
||||
// view: self.clone(),
|
||||
// element: Some(component),
|
||||
// }
|
||||
// }
|
||||
|
||||
pub fn focus_handle(&self, cx: &AppContext) -> FocusHandle
|
||||
where
|
||||
V: FocusableView,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
// Input:
|
||||
//
|
||||
// struct FooBar {}
|
||||
|
||||
// Output:
|
||||
//
|
||||
// struct FooBar {}
|
||||
//
|
||||
// #[allow(non_snake_case)]
|
||||
// #[gpui2::ctor]
|
||||
// fn register_foobar_builder() {
|
||||
// gpui2::register_action_builder::<Foo>()
|
||||
// }
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::Ident;
|
||||
use quote::{format_ident, quote};
|
||||
|
||||
@@ -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>,
|
||||
|
||||
@@ -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);
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,13 +69,6 @@ pub fn derive_refineable(input: TokenStream) -> TokenStream {
|
||||
path: parse_quote!(Clone),
|
||||
}));
|
||||
|
||||
// punctuated.push_punct(syn::token::Add::default());
|
||||
// punctuated.push_value(TypeParamBound::Trait(TraitBound {
|
||||
// paren_token: None,
|
||||
// modifier: syn::TraitBoundModifier::None,
|
||||
// lifetimes: None,
|
||||
// path: parse_quote!(Default),
|
||||
// }));
|
||||
punctuated
|
||||
},
|
||||
})
|
||||
@@ -94,10 +87,6 @@ pub fn derive_refineable(input: TokenStream) -> TokenStream {
|
||||
},
|
||||
};
|
||||
|
||||
// refinable_refine_assignments
|
||||
// refinable_refined_assignments
|
||||
// refinement_refine_assignments
|
||||
|
||||
let refineable_refine_assignments: Vec<TokenStream2> = fields
|
||||
.iter()
|
||||
.map(|field| {
|
||||
|
||||
@@ -85,31 +85,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 +247,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();
|
||||
|
||||
@@ -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"])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -21,11 +21,6 @@ use crate::assets::Assets;
|
||||
use crate::story_selector::{ComponentStory, StorySelector};
|
||||
pub use indoc::indoc;
|
||||
|
||||
// gpui::actions! {
|
||||
// storybook,
|
||||
// [ToggleInspector]
|
||||
// }
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
|
||||
@@ -117,55 +117,5 @@ impl Render for IconButtonStory {
|
||||
)
|
||||
.children(vec![StorySection::new().children(buttons)])
|
||||
.into_element()
|
||||
|
||||
// Story::container()
|
||||
// .child(Story::title_for::<IconButton>())
|
||||
// .child(Story::label("Default"))
|
||||
// .child(div().w_8().child(IconButton::new("icon_a", Icon::Hash)))
|
||||
// .child(Story::label("Selected"))
|
||||
// .child(
|
||||
// div()
|
||||
// .w_8()
|
||||
// .child(IconButton::new("icon_a", Icon::Hash).selected(true)),
|
||||
// )
|
||||
// .child(Story::label("Selected with `selected_icon`"))
|
||||
// .child(
|
||||
// div().w_8().child(
|
||||
// IconButton::new("icon_a", Icon::AudioOn)
|
||||
// .selected(true)
|
||||
// .selected_icon(Icon::AudioOff),
|
||||
// ),
|
||||
// )
|
||||
// .child(Story::label("Disabled"))
|
||||
// .child(
|
||||
// div()
|
||||
// .w_8()
|
||||
// .child(IconButton::new("icon_a", Icon::Hash).disabled(true)),
|
||||
// )
|
||||
// .child(Story::label("With `on_click`"))
|
||||
// .child(
|
||||
// div()
|
||||
// .w_8()
|
||||
// .child(
|
||||
// IconButton::new("with_on_click", Icon::Ai).on_click(|_event, _cx| {
|
||||
// println!("Clicked!");
|
||||
// }),
|
||||
// ),
|
||||
// )
|
||||
// .child(Story::label("With `tooltip`"))
|
||||
// .child(
|
||||
// div().w_8().child(
|
||||
// IconButton::new("with_tooltip", Icon::MessageBubbles)
|
||||
// .tooltip(|cx| Tooltip::text("Open messages", cx)),
|
||||
// ),
|
||||
// )
|
||||
// .child(Story::label("Selected with `tooltip`"))
|
||||
// .child(
|
||||
// div().w_8().child(
|
||||
// IconButton::new("selected_with_tooltip", Icon::InlayHint)
|
||||
// .selected(true)
|
||||
// .tooltip(|cx| Tooltip::text("Toggle inlay hints", cx)),
|
||||
// ),
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,27 +809,6 @@ pub mod test {
|
||||
Edit,
|
||||
}
|
||||
|
||||
// impl Clone for TestItem {
|
||||
// fn clone(&self) -> Self {
|
||||
// Self {
|
||||
// state: self.state.clone(),
|
||||
// label: self.label.clone(),
|
||||
// save_count: self.save_count,
|
||||
// save_as_count: self.save_as_count,
|
||||
// reload_count: self.reload_count,
|
||||
// is_dirty: self.is_dirty,
|
||||
// is_singleton: self.is_singleton,
|
||||
// has_conflict: self.has_conflict,
|
||||
// project_items: self.project_items.clone(),
|
||||
// nav_history: None,
|
||||
// tab_descriptions: None,
|
||||
// tab_detail: Default::default(),
|
||||
// workspace_id: self.workspace_id,
|
||||
// focus_handle: self.focus_handle.clone(),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
impl TestProjectItem {
|
||||
pub fn new(id: u64, path: &str, cx: &mut AppContext) -> Model<Self> {
|
||||
let entry_id = Some(ProjectEntryId::from_proto(id));
|
||||
|
||||
@@ -60,24 +60,6 @@ pub enum SaveIntent {
|
||||
#[derive(Clone, Deserialize, PartialEq, Debug)]
|
||||
pub struct ActivateItem(pub usize);
|
||||
|
||||
// #[derive(Clone, PartialEq)]
|
||||
// pub struct CloseItemById {
|
||||
// pub item_id: usize,
|
||||
// pub pane: WeakView<Pane>,
|
||||
// }
|
||||
|
||||
// #[derive(Clone, PartialEq)]
|
||||
// pub struct CloseItemsToTheLeftById {
|
||||
// pub item_id: usize,
|
||||
// pub pane: WeakView<Pane>,
|
||||
// }
|
||||
|
||||
// #[derive(Clone, PartialEq)]
|
||||
// pub struct CloseItemsToTheRightById {
|
||||
// pub item_id: usize,
|
||||
// pub pane: WeakView<Pane>,
|
||||
// }
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CloseActiveItem {
|
||||
@@ -1226,125 +1208,6 @@ impl Pane {
|
||||
cx.emit(Event::Split(direction));
|
||||
}
|
||||
|
||||
// fn deploy_split_menu(&mut self, cx: &mut ViewContext<Self>) {
|
||||
// self.tab_bar_context_menu.handle.update(cx, |menu, cx| {
|
||||
// menu.toggle(
|
||||
// Default::default(),
|
||||
// AnchorCorner::TopRight,
|
||||
// vec![
|
||||
// ContextMenuItem::action("Split Right", SplitRight),
|
||||
// ContextMenuItem::action("Split Left", SplitLeft),
|
||||
// ContextMenuItem::action("Split Up", SplitUp),
|
||||
// ContextMenuItem::action("Split Down", SplitDown),
|
||||
// ],
|
||||
// cx,
|
||||
// );
|
||||
// });
|
||||
|
||||
// self.tab_bar_context_menu.kind = TabBarContextMenuKind::Split;
|
||||
// }
|
||||
|
||||
// fn deploy_new_menu(&mut self, cx: &mut ViewContext<Self>) {
|
||||
// self.tab_bar_context_menu.handle.update(cx, |menu, cx| {
|
||||
// menu.toggle(
|
||||
// Default::default(),
|
||||
// AnchorCorner::TopRight,
|
||||
// vec![
|
||||
// ContextMenuItem::action("New File", NewFile),
|
||||
// ContextMenuItem::action("New Terminal", NewCenterTerminal),
|
||||
// ContextMenuItem::action("New Search", NewSearch),
|
||||
// ],
|
||||
// cx,
|
||||
// );
|
||||
// });
|
||||
|
||||
// self.tab_bar_context_menu.kind = TabBarContextMenuKind::New;
|
||||
// }
|
||||
|
||||
// fn deploy_tab_context_menu(
|
||||
// &mut self,
|
||||
// position: Vector2F,
|
||||
// target_item_id: usize,
|
||||
// cx: &mut ViewContext<Self>,
|
||||
// ) {
|
||||
// let active_item_id = self.items[self.active_item_index].id();
|
||||
// let is_active_item = target_item_id == active_item_id;
|
||||
// let target_pane = cx.weak_handle();
|
||||
|
||||
// // The `CloseInactiveItems` action should really be called "CloseOthers" and the behaviour should be dynamically based on the tab the action is ran on. Currently, this is a weird action because you can run it on a non-active tab and it will close everything by the actual active tab
|
||||
|
||||
// self.tab_context_menu.update(cx, |menu, cx| {
|
||||
// menu.show(
|
||||
// position,
|
||||
// AnchorCorner::TopLeft,
|
||||
// if is_active_item {
|
||||
// vec![
|
||||
// ContextMenuItem::action(
|
||||
// "Close Active Item",
|
||||
// CloseActiveItem { save_intent: None },
|
||||
// ),
|
||||
// ContextMenuItem::action("Close Inactive Items", CloseInactiveItems),
|
||||
// ContextMenuItem::action("Close Clean Items", CloseCleanItems),
|
||||
// ContextMenuItem::action("Close Items To The Left", CloseItemsToTheLeft),
|
||||
// ContextMenuItem::action("Close Items To The Right", CloseItemsToTheRight),
|
||||
// ContextMenuItem::action(
|
||||
// "Close All Items",
|
||||
// CloseAllItems { save_intent: None },
|
||||
// ),
|
||||
// ]
|
||||
// } else {
|
||||
// // In the case of the user right clicking on a non-active tab, for some item-closing commands, we need to provide the id of the tab, for the others, we can reuse the existing command.
|
||||
// vec![
|
||||
// ContextMenuItem::handler("Close Inactive Item", {
|
||||
// let pane = target_pane.clone();
|
||||
// move |cx| {
|
||||
// if let Some(pane) = pane.upgrade(cx) {
|
||||
// pane.update(cx, |pane, cx| {
|
||||
// pane.close_item_by_id(
|
||||
// target_item_id,
|
||||
// SaveIntent::Close,
|
||||
// cx,
|
||||
// )
|
||||
// .detach_and_log_err(cx);
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }),
|
||||
// ContextMenuItem::action("Close Inactive Items", CloseInactiveItems),
|
||||
// ContextMenuItem::action("Close Clean Items", CloseCleanItems),
|
||||
// ContextMenuItem::handler("Close Items To The Left", {
|
||||
// let pane = target_pane.clone();
|
||||
// move |cx| {
|
||||
// if let Some(pane) = pane.upgrade(cx) {
|
||||
// pane.update(cx, |pane, cx| {
|
||||
// pane.close_items_to_the_left_by_id(target_item_id, cx)
|
||||
// .detach_and_log_err(cx);
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }),
|
||||
// ContextMenuItem::handler("Close Items To The Right", {
|
||||
// let pane = target_pane.clone();
|
||||
// move |cx| {
|
||||
// if let Some(pane) = pane.upgrade(cx) {
|
||||
// pane.update(cx, |pane, cx| {
|
||||
// pane.close_items_to_the_right_by_id(target_item_id, cx)
|
||||
// .detach_and_log_err(cx);
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }),
|
||||
// ContextMenuItem::action(
|
||||
// "Close All Items",
|
||||
// CloseAllItems { save_intent: None },
|
||||
// ),
|
||||
// ]
|
||||
// },
|
||||
// cx,
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
|
||||
pub fn toolbar(&self) -> &View<Toolbar> {
|
||||
&self.toolbar
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//#![allow(dead_code)]
|
||||
|
||||
pub mod model;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
@@ -3324,36 +3324,6 @@ impl Workspace {
|
||||
workspace
|
||||
}
|
||||
|
||||
// fn render_dock(&self, position: DockPosition, cx: &WindowContext) -> Option<AnyElement<Self>> {
|
||||
// let dock = match position {
|
||||
// DockPosition::Left => &self.left_dock,
|
||||
// DockPosition::Right => &self.right_dock,
|
||||
// DockPosition::Bottom => &self.bottom_dock,
|
||||
// };
|
||||
// let active_panel = dock.read(cx).visible_panel()?;
|
||||
// let element = if Some(active_panel.id()) == self.zoomed.as_ref().map(|zoomed| zoomed.id()) {
|
||||
// dock.read(cx).render_placeholder(cx)
|
||||
// } else {
|
||||
// ChildView::new(dock, cx).into_any()
|
||||
// };
|
||||
|
||||
// Some(
|
||||
// element
|
||||
// .constrained()
|
||||
// .dynamically(move |constraint, _, cx| match position {
|
||||
// DockPosition::Left | DockPosition::Right => SizeConstraint::new(
|
||||
// Vector2F::new(20., constraint.min.y()),
|
||||
// Vector2F::new(cx.window_size().x() * 0.8, constraint.max.y()),
|
||||
// ),
|
||||
// DockPosition::Bottom => SizeConstraint::new(
|
||||
// Vector2F::new(constraint.min.x(), 20.),
|
||||
// Vector2F::new(constraint.max.x(), cx.window_size().y() * 0.8),
|
||||
// ),
|
||||
// })
|
||||
// .into_any(),
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
pub fn register_action<A: Action>(
|
||||
&mut self,
|
||||
callback: impl Fn(&mut Self, &A, &mut ViewContext<Self>) + 'static,
|
||||
|
||||
@@ -184,7 +184,7 @@ mod tests {
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_python_autoindent(cx: &mut TestAppContext) {
|
||||
// cx.executor().set_block_on_ticks(usize::MAX..=usize::MAX);
|
||||
cx.executor().set_block_on_ticks(usize::MAX..=usize::MAX);
|
||||
let language =
|
||||
crate::languages::language("python", tree_sitter_python::language(), None).await;
|
||||
cx.update(|cx| {
|
||||
|
||||
@@ -113,12 +113,6 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||
})
|
||||
.detach();
|
||||
|
||||
// cx.emit(workspace::Event::PaneAdded(workspace.active_pane().clone()));
|
||||
|
||||
// let collab_titlebar_item =
|
||||
// cx.add_view(|cx| CollabTitlebarItem::new(workspace, &workspace_handle, cx));
|
||||
// workspace.set_titlebar_item(collab_titlebar_item.into_any(), cx);
|
||||
|
||||
let copilot = cx.new_view(|cx| copilot_ui::CopilotButton::new(app_state.fs.clone(), cx));
|
||||
let diagnostic_summary =
|
||||
cx.new_view(|cx| diagnostics::items::DiagnosticIndicator::new(workspace, cx));
|
||||
|
||||
Reference in New Issue
Block a user