Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into search2

Piotr Osiewicz6b6a30c3da34
diff --cc crates/workspace2/src/workspace2.rs
index 47b39aa93c1,f28675661de..ca771140e9b
--- a/crates/workspace2/src/workspace2.rs
+++ b/crates/workspace2/src/workspace2.rs
@@@ -67,9 -63,8 +63,9 @@@ use std::
time::Duration,
};
use theme2::{ActiveTheme, ThemeSettings};
-pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
+pub use toolbar::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView};
- use ui::TextColor;
- use ui::{h_stack, Button, ButtonVariant, KeyBinding, Label, TextTooltip};
++
+ pub use ui;
use util::ResultExt;
use uuid::Uuid;
pub use workspace_settings::{AutosaveSetting, WorkspaceSettings};
diff --cc crates/zed2/src/main.rs
index 6bde0b34055,ef65d00fc38..d39a1d79d62
--- a/crates/zed2/src/main.rs
+++ b/crates/zed2/src/main.rs
@@@ -196,10 -194,10 +194,10 @@@ fn main()
project_panel::init(Assets, cx);
// channel::init(&client, user_store.clone(), cx);
// diagnostics::init(cx);
- // search::init(cx);
+ search::init(cx);
// semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx);
// vim::init(cx);
- // terminal_view::init(cx);
+ terminal_view::init(cx);
// journal2::init(app_state.clone(), cx);
// language_selector::init(cx);
diff --cc crates/zed2/src/zed2.rs
index 83f09c8befd,84cacccb5ad..0b6a0b24671
--- a/crates/zed2/src/zed2.rs
+++ b/crates/zed2/src/zed2.rs
@@@ -86,8 -87,147 +87,147 @@@ pub fn build_window_options
}
}
- pub fn init_zed_actions(app_state: Arc<AppState>, cx: &mut AppContext) {
- cx.observe_new_views(move |workspace: &mut Workspace, _cx| {
+ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
+ cx.observe_new_views(move |workspace: &mut Workspace, cx| {
+ let workspace_handle = cx.view().clone();
+ cx.subscribe(&workspace_handle, {
+ move |workspace, _, event, cx| {
+ if let workspace::Event::PaneAdded(pane) = event {
+ pane.update(cx, |pane, cx| {
+ pane.toolbar().update(cx, |toolbar, cx| {
+ // todo!()
+ // let breadcrumbs = cx.add_view(|_| Breadcrumbs::new(workspace));
+ // toolbar.add_item(breadcrumbs, cx);
- // let buffer_search_bar = cx.add_view(BufferSearchBar::new);
- // toolbar.add_item(buffer_search_bar.clone(), cx);
++ let buffer_search_bar = cx.build_view(search::BufferSearchBar::new);
++ toolbar.add_item(buffer_search_bar.clone(), cx);
+ // let quick_action_bar = cx.add_view(|_| {
+ // QuickActionBar::new(buffer_search_bar, workspace)
+ // });
+ // toolbar.add_item(quick_action_bar, cx);
+ // let diagnostic_editor_controls =
+ // cx.add_view(|_| diagnostics2::ToolbarControls::new());
+ // toolbar.add_item(diagnostic_editor_controls, cx);
+ // let project_search_bar = cx.add_view(|_| ProjectSearchBar::new());
+ // toolbar.add_item(project_search_bar, cx);
+ // let submit_feedback_button =
+ // cx.add_view(|_| SubmitFeedbackButton::new());
+ // toolbar.add_item(submit_feedback_button, cx);
+ // let feedback_info_text = cx.add_view(|_| FeedbackInfoText::new());
+ // toolbar.add_item(feedback_info_text, cx);
+ // let lsp_log_item =
+ // cx.add_view(|_| language_tools::LspLogToolbarItemView::new());
+ // toolbar.add_item(lsp_log_item, cx);
+ // let syntax_tree_item = cx
+ // .add_view(|_| language_tools::SyntaxTreeToolbarItemView::new());
+ // toolbar.add_item(syntax_tree_item, cx);
+ })
+ });
+ }
+ }
+ })
+ .detach();
+
+ // cx.emit(workspace2::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.add_view(|cx| copilot_button::CopilotButton::new(app_state.fs.clone(), cx));
+ // let diagnostic_summary =
+ // cx.add_view(|cx| diagnostics::items::DiagnosticIndicator::new(workspace, cx));
+ // let activity_indicator = activity_indicator::ActivityIndicator::new(
+ // workspace,
+ // app_state.languages.clone(),
+ // cx,
+ // );
+ // let active_buffer_language =
+ // cx.add_view(|_| language_selector::ActiveBufferLanguage::new(workspace));
+ // let vim_mode_indicator = cx.add_view(|cx| vim::ModeIndicator::new(cx));
+ // let feedback_button = cx.add_view(|_| {
+ // feedback::deploy_feedback_button::DeployFeedbackButton::new(workspace)
+ // });
+ // let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new());
+ workspace.status_bar().update(cx, |status_bar, cx| {
+ // status_bar.add_left_item(diagnostic_summary, cx);
+ // status_bar.add_left_item(activity_indicator, cx);
+
+ // status_bar.add_right_item(feedback_button, cx);
+ // status_bar.add_right_item(copilot, cx);
+ // status_bar.add_right_item(active_buffer_language, cx);
+ // status_bar.add_right_item(vim_mode_indicator, cx);
+ // status_bar.add_right_item(cursor_position, cx);
+ });
+
+ // auto_update::notify_of_any_new_update(cx.weak_handle(), cx);
+
+ // vim::observe_keystrokes(cx);
+
+ // cx.on_window_should_close(|workspace, cx| {
+ // if let Some(task) = workspace.close(&Default::default(), cx) {
+ // task.detach_and_log_err(cx);
+ // }
+ // false
+ // });
+
+ cx.spawn(|workspace_handle, mut cx| async move {
+ let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
+ let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
+ // let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
+ let channels_panel =
+ collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
+ // let chat_panel =
+ // collab_ui::chat_panel::ChatPanel::load(workspace_handle.clone(), cx.clone());
+ // let notification_panel = collab_ui::notification_panel::NotificationPanel::load(
+ // workspace_handle.clone(),
+ // cx.clone(),
+ // );
+ let (
+ project_panel,
+ terminal_panel,
+ // assistant_panel,
+ channels_panel,
+ // chat_panel,
+ // notification_panel,
+ ) = futures::try_join!(
+ project_panel,
+ terminal_panel,
+ // assistant_panel,
+ channels_panel,
+ // chat_panel,
+ // notification_panel,
+ )?;
+
+ workspace_handle.update(&mut cx, |workspace, cx| {
+ let project_panel_position = project_panel.position(cx);
+ workspace.add_panel(project_panel, cx);
+ workspace.add_panel(terminal_panel, cx);
+ // workspace.add_panel(assistant_panel, cx);
+ workspace.add_panel(channels_panel, cx);
+ // workspace.add_panel(chat_panel, cx);
+ // workspace.add_panel(notification_panel, cx);
+
+ // if !was_deserialized
+ // && workspace
+ // .project()
+ // .read(cx)
+ // .visible_worktrees(cx)
+ // .any(|tree| {
+ // tree.read(cx)
+ // .root_entry()
+ // .map_or(false, |entry| entry.is_dir())
+ // })
+ // {
+ // workspace.toggle_dock(project_panel_position, cx);
+ // }
+ // cx.focus_self();
+ })
+ })
+ .detach();
+
workspace
.register_action(about)
.register_action(|_, _: &Hide, cx| {