Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/zed-intergration/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Clone zed and switch to the specific version
ZED_ROOT='./zed'
ZED_REPO='https://github.com/zed-industries/zed.git'
TARGET_PATCH_VERSION='04ee5e3e6e563fbcc6ea37f8733aaf6897428773'
TARGET_PATCH_VERSION='a56f946a7d0734839f820d2943dabe7fa09a4b22'

# Place patch files here
PATCH_DIR='./patches/'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
From 006bd0e01b5deba6792af824a5a73c32e96efa2c Mon Sep 17 00:00:00 2001
From: Neon <yyk1249501542@gmail.com>
Date: Sat, 19 Oct 2024 21:24:00 +0800
Subject: [PATCH 01/10] add new module mega and mega_panel

---
Cargo.lock | 23 ++++++
Cargo.toml | 4 +
crates/mega/LICENSE-GPL | 1 +
crates/mega/src/delegate.rs | 0
crates/mega_panel/LICENSE-GPL | 1 +
crates/mega_panel/src/mega_panel_settings.rs | 80 ++++++++++++++++++++
crates/zed/Cargo.toml | 1 +
crates/zed/src/zed.rs | 12 +++
8 files changed, 122 insertions(+)
create mode 120000 crates/mega/LICENSE-GPL
create mode 100644 crates/mega/src/delegate.rs
create mode 120000 crates/mega_panel/LICENSE-GPL
create mode 100644 crates/mega_panel/src/mega_panel_settings.rs

diff --git a/Cargo.lock b/Cargo.lock
index 6f1d7b2c9c..d39aae09ee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6884,6 +6884,28 @@ dependencies = [
"objc",
]

+[[package]]
+name = "mega"
+version = "0.1.0"
+dependencies = [
+ "reqwest 0.12.8",
+ "serde",
+]
+
+[[package]]
+name = "mega_panel"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "editor",
+ "file_icons",
+ "gpui",
+ "schemars",
+ "serde",
+ "settings",
+ "workspace",
+]
+
[[package]]
name = "memchr"
version = "2.7.4"
@@ -14631,6 +14653,7 @@ dependencies = [
"libc",
"log",
"markdown_preview",
+ "mega_panel",
"menu",
"mimalloc",
"nix",
diff --git a/Cargo.toml b/Cargo.toml
index 4a4ddb4424..6a02b98478 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -64,6 +64,8 @@ members = [
"crates/markdown",
"crates/markdown_preview",
"crates/media",
+ "crates/mega",
+ "crates/mega_panel",
"crates/menu",
"crates/multi_buffer",
"crates/node_runtime",
@@ -240,6 +242,8 @@ lsp = { path = "crates/lsp" }
markdown = { path = "crates/markdown" }
markdown_preview = { path = "crates/markdown_preview" }
media = { path = "crates/media" }
+mega = { path = "crates/mega" }
+mega_panel = { path = "crates/mega_panel" }
menu = { path = "crates/menu" }
multi_buffer = { path = "crates/multi_buffer" }
node_runtime = { path = "crates/node_runtime" }
diff --git a/crates/mega/LICENSE-GPL b/crates/mega/LICENSE-GPL
new file mode 120000
index 0000000000..89e542f750
--- /dev/null
+++ b/crates/mega/LICENSE-GPL
@@ -0,0 +1 @@
+../../LICENSE-GPL
\ No newline at end of file
diff --git a/crates/mega/src/delegate.rs b/crates/mega/src/delegate.rs
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/crates/mega_panel/LICENSE-GPL b/crates/mega_panel/LICENSE-GPL
new file mode 120000
index 0000000000..89e542f750
--- /dev/null
+++ b/crates/mega_panel/LICENSE-GPL
@@ -0,0 +1 @@
+../../LICENSE-GPL
\ No newline at end of file
diff --git a/crates/mega_panel/src/mega_panel_settings.rs b/crates/mega_panel/src/mega_panel_settings.rs
new file mode 100644
index 0000000000..1ca1149b01
--- /dev/null
+++ b/crates/mega_panel/src/mega_panel_settings.rs
@@ -0,0 +1,80 @@
+use schemars::JsonSchema;
+use gpui::Pixels;
+use gpui::private::serde::{Deserialize, Serialize};
+use settings::{Settings, SettingsSources};
+
+#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Copy, PartialEq)]
+#[serde(rename_all = "snake_case")]
+pub enum MegaPanelDockPosition {
+ Left,
+ Right,
+}
+
+#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
+pub struct MegaPanelSettings {
+ pub button: bool,
+ pub default_width: Pixels,
+ pub dock: MegaPanelDockPosition,
+ pub file_icons: bool,
+ pub folder_icons: bool,
+ pub git_status: bool,
+ pub indent_size: f32,
+ pub auto_reveal_entries: bool,
+ pub auto_fold_dirs: bool,
+}
+
+#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
+pub struct MegaPanelSettingsContent {
+ /// Whether to show the outline panel button in the status bar.
+ ///
+ /// Default: true
+ pub button: Option<bool>,
+ /// Customize default width (in pixels) taken by outline panel
+ ///
+ /// Default: 240
+ pub default_width: Option<f32>,
+ /// The position of outline panel
+ ///
+ /// Default: left
+ pub dock: Option<MegaPanelDockPosition>,
+ /// Whether to show file icons in the outline panel.
+ ///
+ /// Default: true
+ pub file_icons: Option<bool>,
+ /// Whether to show folder icons or chevrons for directories in the outline panel.
+ ///
+ /// Default: true
+ pub folder_icons: Option<bool>,
+ /// Whether to show the git status in the outline panel.
+ ///
+ /// Default: true
+ pub git_status: Option<bool>,
+ /// Amount of indentation (in pixels) for nested items.
+ ///
+ /// Default: 20
+ pub indent_size: Option<f32>,
+ /// Whether to reveal it in the outline panel automatically,
+ /// when a corresponding project entry becomes active.
+ /// Gitignored entries are never auto revealed.
+ ///
+ /// Default: true
+ pub auto_reveal_entries: Option<bool>,
+ /// Whether to fold directories automatically
+ /// when directory has only one directory inside.
+ ///
+ /// Default: true
+ pub auto_fold_dirs: Option<bool>,
+}
+
+impl Settings for MegaPanelSettings {
+ const KEY: Option<&'static str> = Some("outline_panel");
+
+ type FileContent = MegaPanelSettingsContent;
+
+ fn load(
+ sources: SettingsSources<Self::FileContent>,
+ _: &mut gpui::AppContext,
+ ) -> anyhow::Result<Self> {
+ sources.json_merge()
+ }
+}
\ No newline at end of file
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index 69ca3aa98d..81243cf62f 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -66,6 +66,7 @@ languages = { workspace = true, features = ["load-grammars"] }
libc.workspace = true
log.workspace = true
markdown_preview.workspace = true
+mega_panel.workspace = true
menu.workspace = true
mimalloc = { version = "0.1", optional = true }
nix = { workspace = true, features = ["pthread", "signal"] }
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index c33cef4a4b..545e42551a 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -27,6 +27,7 @@ use anyhow::Context as _;
use assets::Assets;
use futures::{channel::mpsc, select_biased, StreamExt};
use outline_panel::OutlinePanel;
+use mega_panel::MegaPanel;
use project::Item;
use project_panel::ProjectPanel;
use quick_action_bar::QuickActionBar;
@@ -238,6 +239,7 @@ pub fn initialize_workspace(

let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
let outline_panel = OutlinePanel::load(workspace_handle.clone(), cx.clone());
+ let mega_panel = MegaPanel::load(workspace_handle.clone(), cx.clone());
let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
let channels_panel =
collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
@@ -250,6 +252,7 @@ pub fn initialize_workspace(

let (
project_panel,
+ mega_panel,
outline_panel,
terminal_panel,
assistant_panel,
@@ -258,6 +261,7 @@ pub fn initialize_workspace(
notification_panel,
) = futures::try_join!(
project_panel,
+ mega_panel,
outline_panel,
terminal_panel,
assistant_panel,
@@ -269,6 +273,7 @@ pub fn initialize_workspace(
workspace_handle.update(&mut cx, |workspace, cx| {
workspace.add_panel(assistant_panel, cx);
workspace.add_panel(project_panel, cx);
+ workspace.add_panel(mega_panel, cx);
workspace.add_panel(outline_panel, cx);
workspace.add_panel(terminal_panel, cx);
workspace.add_panel(channels_panel, cx);
@@ -467,6 +472,13 @@ pub fn initialize_workspace(
workspace.toggle_panel_focus::<ProjectPanel>(cx);
},
)
+ .register_action(
+ |workspace: &mut Workspace,
+ _: &mega_panel::ToggleFocus,
+ cx: &mut ViewContext<Workspace>| {
+ workspace.toggle_panel_focus::<MegaPanel>(cx);
+ },
+ )
.register_action(
|workspace: &mut Workspace,
_: &outline_panel::ToggleFocus,
--
2.43.0

Loading