Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Mark TODOs and prep for merging main
Mikayla3734a390b275
diff --git a/Cargo.toml b/Cargo.tomlindex 26cd9ab0393..a4e51e6aae2 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -185,7 +185,7 @@ wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", rev = "v16.0.split-debuginfo = "unpacked"debug = "limited"-# TODO - Remove this+# todo!(linux) - Remove this[profile.dev.package.blade-graphics]split-debuginfo = "off"debug = "full"diff --git a/crates/gpui/screenshot.png b/crates/gpui/screenshot.pngdeleted file mode 100644index 50597680f03..00000000000Binary files a/crates/gpui/screenshot.png and /dev/null differdiff --git a/crates/gpui/src/platform/linux/blade_belt.rs b/crates/gpui/src/platform/linux/blade_belt.rsindex b0e4be58939..2562097cbb2 100644--- a/crates/gpui/src/platform/linux/blade_belt.rs+++ b/crates/gpui/src/platform/linux/blade_belt.rs@@ -75,11 +75,11 @@ impl BladeBelt {chunk.into()}- //Note: assuming T: bytemuck::Zeroable+ //todo!(linux): enforce T: bytemuck::Zeroablepub fn alloc_data<T>(&mut self, data: &[T], gpu: &gpu::Context) -> gpu::BufferPiece {assert!(!data.is_empty());let type_alignment = mem::align_of::<T>() as u64;- assert_eq!(+ debug_assert_eq!(self.desc.alignment % type_alignment,0,"Type alignment {} is too big",diff --git a/crates/gpui/src/platform/linux/blade_renderer.rs b/crates/gpui/src/platform/linux/blade_renderer.rsindex 492b135cde0..128b918ef78 100644--- a/crates/gpui/src/platform/linux/blade_renderer.rs+++ b/crates/gpui/src/platform/linux/blade_renderer.rs@@ -411,7 +411,7 @@ impl BladeRenderer {}PrimitiveBatch::Paths(paths) => {let mut encoder = pass.with(&self.pipelines.paths);- //TODO: group by texture ID+ //todo!(linux): group by texture IDfor path in paths {let tile = &self.path_tiles[&path.id];let tex_info = self.atlas.get_texture_info(tile.texture_id);diff --git a/crates/gpui/src/platform/linux/dispatcher.rs b/crates/gpui/src/platform/linux/dispatcher.rsindex 28526d360a4..108b8ed354e 100644--- a/crates/gpui/src/platform/linux/dispatcher.rs+++ b/crates/gpui/src/platform/linux/dispatcher.rs@@ -90,7 +90,7 @@ impl PlatformDispatcher for LinuxDispatcher {fn dispatch_on_main_thread(&self, runnable: Runnable) {self.main_sender.send(runnable).unwrap();// Send a message to the invisible window, forcing- // tha main loop to wake up and dispatch the runnable.+ // the main loop to wake up and dispatch the runnable.self.xcb_connection.send_request(&x::SendEvent {propagate: false,destination: x::SendEventDest::Window(self.x_listener_window),diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rsindex eae7893054b..30d2b66bf01 100644--- a/crates/gpui/src/platform/linux/platform.rs+++ b/crates/gpui/src/platform/linux/platform.rs@@ -170,14 +170,19 @@ impl Platform for LinuxPlatform {self.state.lock().quit_requested = true;}+ //todo!(linux)fn restart(&self) {}+ //todo!(linux)fn activate(&self, ignoring_other_apps: bool) {}+ //todo!(linux)fn hide(&self) {}+ //todo!(linux)fn hide_other_apps(&self) {}+ //todo!(linux)fn unhide_other_apps(&self) {}fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>> {@@ -199,6 +204,7 @@ impl Platform for LinuxPlatform {)))}+ //todo!(linux)fn active_window(&self) -> Option<AnyWindowHandle> {None}@@ -324,6 +330,7 @@ impl Platform for LinuxPlatform {unimplemented!()}+ //todo!(linux)fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap) {}fn local_timezone(&self) -> UtcOffset {@@ -334,14 +341,16 @@ impl Platform for LinuxPlatform {unimplemented!()}+ //todo!(linux)fn set_cursor_style(&self, style: CursorStyle) {}- fn should_auto_hide_scrollbars(&self) -> bool {- false- }+ //todo!(linux)+ fn should_auto_hide_scrollbars(&self) -> bool {}+ //todo!(linux)fn write_to_clipboard(&self, item: ClipboardItem) {}+ //todo!(linux)fn read_from_clipboard(&self) -> Option<ClipboardItem> {None}diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rsindex 187ffb526ab..53faa936bc2 100644--- a/crates/gpui/src/platform/linux/text_system.rs+++ b/crates/gpui/src/platform/linux/text_system.rs@@ -29,6 +29,7 @@ struct LinuxTextSystemState {postscript_names_by_font_id: HashMap<FontId, String>,}+// todo!(linux): Double check thisunsafe impl Send for LinuxTextSystemState {}unsafe impl Sync for LinuxTextSystemState {}@@ -54,33 +55,52 @@ impl Default for LinuxTextSystem {#[allow(unused)]impl PlatformTextSystem for LinuxTextSystem {+ // todo!(linux)fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {- Ok(()) //TODO+ Ok(())}++ // todo!(linux)fn all_font_names(&self) -> Vec<String> {Vec::new()}++ // todo!(linux)fn all_font_families(&self) -> Vec<String> {Vec::new()}++ // todo!(linux)fn font_id(&self, descriptor: &Font) -> Result<FontId> {- Ok(FontId(0)) //TODO+ Ok(FontId(0))}++ // todo!(linux)fn font_metrics(&self, font_id: FontId) -> FontMetrics {unimplemented!()}++ // todo!(linux)fn typographic_bounds(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Bounds<f32>> {unimplemented!()}++ // todo!(linux)fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>> {unimplemented!()}++ // todo!(linux)fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId> {None}++ // todo!(linux)fn glyph_raster_bounds(&self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {unimplemented!()}++ // todo!(linux)fn rasterize_glyph(&self,params: &RenderGlyphParams,@@ -88,9 +108,13 @@ impl PlatformTextSystem for LinuxTextSystem {) -> Result<(Size<DevicePixels>, Vec<u8>)> {unimplemented!()}++ // todo!(linux)fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout {LineLayout::default() //TODO}++ // todo!(linux)fn wrap_line(&self,text: &str,diff --git a/crates/gpui/src/platform/linux/window.rs b/crates/gpui/src/platform/linux/window.rsindex 7ac7ebf9b4b..9ad02039e8a 100644--- a/crates/gpui/src/platform/linux/window.rs+++ b/crates/gpui/src/platform/linux/window.rs@@ -77,6 +77,7 @@ pub(crate) struct LinuxWindowState {#[derive(Clone)]pub(crate) struct LinuxWindow(pub(crate) Arc<LinuxWindowState>);+//todo!(linux): Remove other RawWindowHandle implementationunsafe impl blade_rwh::HasRawWindowHandle for RawWindow {fn raw_window_handle(&self) -> blade_rwh::RawWindowHandle {let mut wh = blade_rwh::XcbWindowHandle::empty();@@ -287,10 +288,12 @@ impl PlatformWindow for LinuxWindow {self.0.inner.lock().scale_factor}+ //todo!(linux)fn titlebar_height(&self) -> Pixels {unimplemented!()}+ //todo!(linux)fn appearance(&self) -> WindowAppearance {unimplemented!()}@@ -299,10 +302,12 @@ impl PlatformWindow for LinuxWindow {Rc::clone(&self.0.display)}+ //todo!(linux)fn mouse_position(&self) -> Point<Pixels> {Point::default()}+ //todo!(linux)fn modifiers(&self) -> crate::Modifiers {crate::Modifiers::default()}@@ -311,12 +316,15 @@ impl PlatformWindow for LinuxWindow {self}+ //todo!(linux)fn set_input_handler(&mut self, input_handler: PlatformInputHandler) {}+ //todo!(linux)fn take_input_handler(&mut self) -> Option<PlatformInputHandler> {None}+ //todo!(linux)fn prompt(&self,_level: crate::PromptLevel,@@ -327,24 +335,36 @@ impl PlatformWindow for LinuxWindow {unimplemented!()}+ //todo!(linux)fn activate(&self) {}+ //todo!(linux)fn set_title(&mut self, title: &str) {}+ //todo!(linux)fn set_edited(&mut self, edited: bool) {}+ //todo!(linux), this corresponds to `orderFrontCharacterPalette` on macOS,+ // but it looks like the equivalent for Linux is GTK specific:+ //+ // https://docs.gtk.org/gtk3/signal.Entry.insert-emoji.html+ //+ // This API might need to change, or we might need to build an emoji picker into GPUIfn show_character_palette(&self) {unimplemented!()}+ //todo!(linux)fn minimize(&self) {unimplemented!()}+ //todo!(linux)fn zoom(&self) {unimplemented!()}+ //todo!(linux)fn toggle_full_screen(&self) {unimplemented!()}@@ -385,10 +405,12 @@ impl PlatformWindow for LinuxWindow {self.0.callbacks.lock().appearance_changed = Some(callback);}+ //todo!(linux)fn is_topmost_for_position(&self, _position: crate::Point<Pixels>) -> bool {unimplemented!()}+ //todo!(linux)fn invalidate(&self) {}fn draw(&self, scene: &crate::Scene) {diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rsindex 464e38b0c40..7052377a00c 100644--- a/crates/gpui/src/platform/test/platform.rs+++ b/crates/gpui/src/platform/test/platform.rs@@ -118,7 +118,11 @@ impl Platform for TestPlatform {}fn text_system(&self) -> Arc<dyn PlatformTextSystem> {- Arc::new(TestTextSystem {})+ #[cfg(target_os = "linux")]+ return Arc::new(TestTextSystem {});++ #[cfg(target_os = "macos")]+ return Arc::new(crate::platform::mac::MacTextSystem::new());}fn run(&self, _on_finish_launching: Box<dyn FnOnce()>) {diff --git a/crates/gpui/src/platform/test/text_system.rs b/crates/gpui/src/platform/test/text_system.rsindex d7847f10128..0e877aabbdb 100644--- a/crates/gpui/src/platform/test/text_system.rs+++ b/crates/gpui/src/platform/test/text_system.rs@@ -7,6 +7,7 @@ use std::borrow::Cow;pub(crate) struct TestTextSystem {}+//todo!(linux)#[allow(unused)]impl PlatformTextSystem for TestTextSystem {fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rsindex 8c5156f3cbe..e125af052d7 100644--- a/crates/project/src/terminals.rs+++ b/crates/project/src/terminals.rs@@ -7,8 +7,8 @@ use terminal::{Terminal, TerminalBuilder,};-#[cfg(target_os = "macos")]-use std::os::unix::ffi::OsStrExt;+// #[cfg(target_os = "macos")]+// use std::os::unix::ffi::OsStrExt;pub struct Terminals {pub(crate) local_handles: Vec<WeakModel<terminal::Terminal>>,diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rsindex 0448cb8ec6c..e191ff1b660 100644--- a/crates/zed/src/languages.rs+++ b/crates/zed/src/languages.rs@@ -280,7 +280,8 @@ pub fn init(],);- /// Produces a link error on linux due to duplicated `state_new` symbol+ // Produces a link error on linux due to duplicated `state_new` symbol+ // todo!(linux): Restore purescript#[cfg(not(target_os = "linux"))]language("purescript",diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 73acfdef343..c291773e4a1 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -257,7 +257,7 @@ fn main() {initialize_workspace(app_state.clone(), cx);if stdout_is_a_pty() {- //TODO: unblock this+ //todo!(linux): unblock this#[cfg(not(target_os = "linux"))]upload_panics_and_crashes(http.clone(), cx);cx.activate(true);@@ -919,6 +919,7 @@ fn load_user_themes_in_background(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {.detach();}+//todo!(linux): Port fsevents to linux/// Spawns a background task to watch the themes directory for changes.#[cfg(target_os = "macos")]fn watch_themes(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {