From 8a92d2866394073576466886f3b54b83eea103c0 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 6 Mar 2024 18:25:20 -0800 Subject: [PATCH] Remove `todo!` comments (#8981) Switching fully to normal `todo` style Release Notes: - N/A --- crates/cli/src/main.rs | 2 +- crates/collab/src/main.rs | 2 +- crates/gpui/src/platform.rs | 4 +- crates/gpui/src/platform/test/platform.rs | 2 +- crates/gpui/src/platform/windows/display.rs | 4 +- crates/gpui/src/platform/windows/platform.rs | 44 +++++++------- .../gpui/src/platform/windows/text_system.rs | 32 +++++----- crates/gpui/src/platform/windows/window.rs | 60 +++++++++---------- crates/gpui/src/scene.rs | 2 +- crates/install_cli/src/install_cli.rs | 2 +- crates/languages/src/csharp.rs | 2 +- crates/languages/src/elixir.rs | 2 +- crates/languages/src/lua.rs | 2 +- crates/languages/src/rust.rs | 2 +- crates/languages/src/toml.rs | 2 +- crates/languages/src/zig.rs | 2 +- crates/terminal/src/terminal.rs | 4 +- crates/zed/build.rs | 2 +- 18 files changed, 86 insertions(+), 86 deletions(-) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index e6ec1e559d..86e901368a 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -156,7 +156,7 @@ mod linux { } } -// todo("windows") +// todo(windows) #[cfg(target_os = "windows")] mod windows { use std::path::Path; diff --git a/crates/collab/src/main.rs b/crates/collab/src/main.rs index e4b134b06b..a082ff9219 100644 --- a/crates/collab/src/main.rs +++ b/crates/collab/src/main.rs @@ -132,7 +132,7 @@ async fn main() -> Result<()> { .await .map_err(|e| anyhow!(e))?; - // todo("windows") + // todo(windows) #[cfg(windows)] unimplemented!(); } diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 176d391d82..9dce3781f7 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -1,6 +1,6 @@ // todo(linux): remove #![cfg_attr(target_os = "linux", allow(dead_code))] -// todo("windows"): remove +// todo(windows): remove #![cfg_attr(windows, allow(dead_code))] mod app_menu; @@ -68,7 +68,7 @@ pub(crate) fn current_platform() -> Rc { pub(crate) fn current_platform() -> Rc { Rc::new(LinuxPlatform::new()) } -// todo("windows") +// todo(windows) #[cfg(target_os = "windows")] pub(crate) fn current_platform() -> Rc { Rc::new(WindowsPlatform::new()) diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rs index 5df416f9ab..3e0260b851 100644 --- a/crates/gpui/src/platform/test/platform.rs +++ b/crates/gpui/src/platform/test/platform.rs @@ -126,7 +126,7 @@ impl Platform for TestPlatform { #[cfg(target_os = "macos")] return Arc::new(crate::platform::mac::MacTextSystem::new()); - // todo("windows") + // todo(windows) #[cfg(target_os = "windows")] unimplemented!() } diff --git a/crates/gpui/src/platform/windows/display.rs b/crates/gpui/src/platform/windows/display.rs index a865246f82..28d65c70a2 100644 --- a/crates/gpui/src/platform/windows/display.rs +++ b/crates/gpui/src/platform/windows/display.rs @@ -17,12 +17,12 @@ impl WindowsDisplay { } impl PlatformDisplay for WindowsDisplay { - // todo!("windows") + // todo(windows) fn id(&self) -> DisplayId { DisplayId(1) } - // todo!("windows") + // todo(windows) fn uuid(&self) -> Result { Err(anyhow!("not implemented yet.")) } diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 53e16ab595..5482b56e89 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -1,4 +1,4 @@ -// todo!("windows"): remove +// todo(windows): remove #![allow(unused_variables)] use std::{ @@ -263,40 +263,40 @@ impl Platform for WindowsPlatform { .detach(); } - // todo!("windows") + // todo(windows) fn restart(&self) { unimplemented!() } - // todo!("windows") + // todo(windows) fn activate(&self, ignoring_other_apps: bool) {} - // todo!("windows") + // todo(windows) fn hide(&self) { unimplemented!() } - // todo!("windows") + // todo(windows) fn hide_other_apps(&self) { unimplemented!() } - // todo!("windows") + // todo(windows) fn unhide_other_apps(&self) { unimplemented!() } - // todo!("windows") + // todo(windows) fn displays(&self) -> Vec> { vec![Rc::new(WindowsDisplay::new())] } - // todo!("windows") + // todo(windows) fn display(&self, id: crate::DisplayId) -> Option> { Some(Rc::new(WindowsDisplay::new())) } - // todo!("windows") + // todo(windows) fn active_window(&self) -> Option { unimplemented!() } @@ -309,7 +309,7 @@ impl Platform for WindowsPlatform { Box::new(WindowsWindow::new(self.inner.clone(), handle, options)) } - // todo!("windows") + // todo(windows) fn window_appearance(&self) -> WindowAppearance { WindowAppearance::Dark } @@ -326,17 +326,17 @@ impl Platform for WindowsPlatform { .detach(); } - // todo!("windows") + // todo(windows) fn on_open_urls(&self, callback: Box)>) { self.inner.callbacks.lock().open_urls = Some(callback); } - // todo!("windows") + // todo(windows) fn prompt_for_paths(&self, options: PathPromptOptions) -> Receiver>> { unimplemented!() } - // todo!("windows") + // todo(windows) fn prompt_for_new_path(&self, directory: &Path) -> Receiver> { unimplemented!() } @@ -379,7 +379,7 @@ impl Platform for WindowsPlatform { self.inner.callbacks.lock().event = Some(callback); } - // todo!("windows") + // todo(windows) fn set_menus(&self, menus: Vec, keymap: &Keymap) {} fn on_app_menu_action(&self, callback: Box) { @@ -423,7 +423,7 @@ impl Platform for WindowsPlatform { }) } - // todo!("windows") + // todo(windows) fn app_path(&self) -> Result { Err(anyhow!("not yet implemented")) } @@ -452,7 +452,7 @@ impl Platform for WindowsPlatform { Duration::from_millis(millis as _) } - // todo!("windows") + // todo(windows) fn path_for_auxiliary_executable(&self, name: &str) -> Result { Err(anyhow!("not yet implemented")) } @@ -483,32 +483,32 @@ impl Platform for WindowsPlatform { let _ = unsafe { SetCursor(HCURSOR(handle.unwrap().0)) }; } - // todo!("windows") + // todo(windows) fn should_auto_hide_scrollbars(&self) -> bool { false } - // todo!("windows") + // todo(windows) fn write_to_clipboard(&self, item: ClipboardItem) { unimplemented!() } - // todo!("windows") + // todo(windows) fn read_from_clipboard(&self) -> Option { unimplemented!() } - // todo!("windows") + // todo(windows) fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Task> { Task::Ready(Some(Err(anyhow!("not implemented yet.")))) } - // todo!("windows") + // todo(windows) fn read_credentials(&self, url: &str) -> Task)>>> { Task::Ready(Some(Err(anyhow!("not implemented yet.")))) } - // todo!("windows") + // todo(windows) fn delete_credentials(&self, url: &str) -> Task> { Task::Ready(Some(Err(anyhow!("not implemented yet.")))) } diff --git a/crates/gpui/src/platform/windows/text_system.rs b/crates/gpui/src/platform/windows/text_system.rs index 411e1a8d28..7f6c356d0a 100644 --- a/crates/gpui/src/platform/windows/text_system.rs +++ b/crates/gpui/src/platform/windows/text_system.rs @@ -32,7 +32,7 @@ impl WindowsTextSystem { pub(crate) fn new() -> Self { let mut font_system = FontSystem::new(); - // todo!("windows") make font loading non-blocking + // todo(windows) make font loading non-blocking font_system.db_mut().load_system_fonts(); Self(RwLock::new(WindowsTextSystemState { @@ -59,7 +59,7 @@ impl PlatformTextSystem for WindowsTextSystem { self.0.write().add_fonts(fonts) } - // todo!("windows") ensure that this integrates with platform font loading + // todo(windows) ensure that this integrates with platform font loading // do we need to do more than call load_system_fonts()? fn all_font_names(&self) -> Vec { self.0 @@ -71,13 +71,13 @@ impl PlatformTextSystem for WindowsTextSystem { .collect() } - // todo!("windows") + // todo(windows) fn all_font_families(&self) -> Vec { Vec::new() } fn font_id(&self, font: &Font) -> Result { - // todo!("windows"): Do we need to use CosmicText's Font APIs? Can we consolidate this to use font_kit? + // todo(windows): Do we need to use CosmicText's Font APIs? Can we consolidate this to use font_kit? let lock = self.0.upgradable_read(); if let Some(font_id) = lock.font_selections.get(font) { Ok(*font_id) @@ -127,13 +127,13 @@ impl PlatformTextSystem for WindowsTextSystem { FontMetrics { units_per_em: metrics.units_per_em as u32, ascent: metrics.ascent, - descent: -metrics.descent, // todo!("windows") confirm this is correct + descent: -metrics.descent, // todo(windows) confirm this is correct line_gap: metrics.leading, underline_position: metrics.underline_offset, underline_thickness: metrics.stroke_size, cap_height: metrics.cap_height, x_height: metrics.x_height, - // todo!("windows"): Compute this correctly + // todo(windows): Compute this correctly bounding_box: Bounds { origin: point(0.0, 0.0), size: size(metrics.max_width, metrics.ascent + metrics.descent), @@ -146,7 +146,7 @@ impl PlatformTextSystem for WindowsTextSystem { let metrics = lock.fonts[font_id.0].as_swash().metrics(&[]); let glyph_metrics = lock.fonts[font_id.0].as_swash().glyph_metrics(&[]); let glyph_id = glyph_id.0 as u16; - // todo!("windows"): Compute this correctly + // todo(windows): Compute this correctly // see https://github.com/servo/font-kit/blob/master/src/loaders/freetype.rs#L614-L620 Ok(Bounds { origin: point(0.0, 0.0), @@ -181,7 +181,7 @@ impl PlatformTextSystem for WindowsTextSystem { self.0.write().layout_line(text, font_size, runs) } - // todo!("windows") Confirm that this has been superseded by the LineWrapper + // todo(windows) Confirm that this has been superseded by the LineWrapper fn wrap_line( &self, text: &str, @@ -256,7 +256,7 @@ impl WindowsTextSystemState { } fn is_emoji(&self, font_id: FontId) -> bool { - // todo!("windows"): implement this correctly + // todo(windows): implement this correctly self.postscript_names_by_font_id .get(&font_id) .map_or(false, |postscript_name| { @@ -264,7 +264,7 @@ impl WindowsTextSystemState { }) } - // todo!("windows") both raster functions have problems because I am not sure this is the correct mapping from cosmic text to gpui system + // todo(windows) both raster functions have problems because I am not sure this is the correct mapping from cosmic text to gpui system fn raster_bounds(&mut self, params: &RenderGlyphParams) -> Result> { let font = &self.fonts[params.font_id.0]; let font_system = &mut self.font_system; @@ -297,7 +297,7 @@ impl WindowsTextSystemState { if glyph_bounds.size.width.0 == 0 || glyph_bounds.size.height.0 == 0 { Err(anyhow!("glyph bounds are empty")) } else { - // todo!("windows") handle subpixel variants + // todo(windows) handle subpixel variants let bitmap_size = glyph_bounds.size; let font = &self.fonts[params.font_id.0]; let font_system = &mut self.font_system; @@ -320,13 +320,13 @@ impl WindowsTextSystemState { } } - // todo!("windows") This is all a quick first pass, maybe we should be using cosmic_text::Buffer + // todo(windows) This is all a quick first pass, maybe we should be using cosmic_text::Buffer #[profiling::function] fn layout_line(&mut self, text: &str, font_size: Pixels, font_runs: &[FontRun]) -> LineLayout { let mut attrs_list = AttrsList::new(Attrs::new()); let mut offs = 0; for run in font_runs { - // todo!("windows") We need to check we are doing utf properly + // todo(windows) We need to check we are doing utf properly let font = &self.fonts[run.font_id.0]; let font = self.font_system.db().face(font.id()).unwrap(); attrs_list.add_span( @@ -343,11 +343,11 @@ impl WindowsTextSystemState { let layout = line.layout( &mut self.font_system, font_size.0, - f32::MAX, // todo!("windows") we don't have a width cause this should technically not be wrapped I believe + f32::MAX, // todo(windows) we don't have a width cause this should technically not be wrapped I believe cosmic_text::Wrap::None, ); let mut runs = Vec::new(); - // todo!("windows") what I think can happen is layout returns possibly multiple lines which means we should be probably working with it higher up in the text rendering + // todo(windows) what I think can happen is layout returns possibly multiple lines which means we should be probably working with it higher up in the text rendering let layout = layout.first().unwrap(); for glyph in &layout.glyphs { let font_id = glyph.font_id; @@ -358,7 +358,7 @@ impl WindowsTextSystemState { .unwrap(), ); let mut glyphs = SmallVec::new(); - // todo!("windows") this is definitely wrong, each glyph in glyphs from cosmic-text is a cluster with one glyph, ShapedRun takes a run of glyphs with the same font and direction + // todo(windows) this is definitely wrong, each glyph in glyphs from cosmic-text is a cluster with one glyph, ShapedRun takes a run of glyphs with the same font and direction glyphs.push(ShapedGlyph { id: GlyphId(glyph.glyph_id as u32), position: point((glyph.x).into(), glyph.y.into()), diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 88a04e4d36..053d64569d 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -1,5 +1,5 @@ #![deny(unsafe_op_in_unsafe_fn)] -// todo!("windows"): remove +// todo(windows): remove #![allow(unused_variables)] use std::{ @@ -670,7 +670,7 @@ impl HasWindowHandle for WindowsWindow { } } -// todo!("windows") +// todo(windows) impl HasDisplayHandle for WindowsWindow { fn display_handle( &self, @@ -687,7 +687,7 @@ impl PlatformWindow for WindowsWindow { }) } - // todo!("windows") + // todo(windows) fn content_size(&self) -> Size { let size = self.inner.size.get(); Size { @@ -696,22 +696,22 @@ impl PlatformWindow for WindowsWindow { } } - // todo!("windows") + // todo(windows) fn scale_factor(&self) -> f32 { 1.0 } - // todo!("windows") + // todo(windows) fn titlebar_height(&self) -> Pixels { 20.0.into() } - // todo!("windows") + // todo(windows) fn appearance(&self) -> WindowAppearance { WindowAppearance::Dark } - // todo!("windows") + // todo(windows) fn display(&self) -> Rc { Rc::new(WindowsDisplay::new()) } @@ -720,7 +720,7 @@ impl PlatformWindow for WindowsWindow { self.inner.mouse_position.get() } - // todo!("windows") + // todo(windows) fn modifiers(&self) -> Modifiers { Modifiers::none() } @@ -729,17 +729,17 @@ impl PlatformWindow for WindowsWindow { self } - // todo!("windows") + // todo(windows) fn set_input_handler(&mut self, input_handler: PlatformInputHandler) { self.inner.input_handler.set(Some(input_handler)); } - // todo!("windows") + // todo(windows) fn take_input_handler(&mut self) -> Option { self.inner.input_handler.take() } - // todo!("windows") + // todo(windows) fn prompt( &self, level: PromptLevel, @@ -750,87 +750,87 @@ impl PlatformWindow for WindowsWindow { unimplemented!() } - // todo!("windows") + // todo(windows) fn activate(&self) {} - // todo!("windows") + // todo(windows) fn set_title(&mut self, title: &str) { unsafe { SetWindowTextW(self.inner.hwnd, &HSTRING::from(title)) } .inspect_err(|e| log::error!("Set title failed: {e}")) .ok(); } - // todo!("windows") + // todo(windows) fn set_edited(&mut self, edited: bool) {} - // todo!("windows") + // todo(windows) fn show_character_palette(&self) {} - // todo!("windows") + // todo(windows) fn minimize(&self) {} - // todo!("windows") + // todo(windows) fn zoom(&self) {} - // todo!("windows") + // todo(windows) fn toggle_full_screen(&self) {} - // todo!("windows") + // todo(windows) fn on_request_frame(&self, callback: Box) { self.inner.callbacks.borrow_mut().request_frame = Some(callback); } - // todo!("windows") + // todo(windows) fn on_input(&self, callback: Box bool>) { self.inner.callbacks.borrow_mut().input = Some(callback); } - // todo!("windows") + // todo(windows) fn on_active_status_change(&self, callback: Box) { self.inner.callbacks.borrow_mut().active_status_change = Some(callback); } - // todo!("windows") + // todo(windows) fn on_resize(&self, callback: Box, f32)>) { self.inner.callbacks.borrow_mut().resize = Some(callback); } - // todo!("windows") + // todo(windows) fn on_fullscreen(&self, callback: Box) { self.inner.callbacks.borrow_mut().fullscreen = Some(callback); } - // todo!("windows") + // todo(windows) fn on_moved(&self, callback: Box) { self.inner.callbacks.borrow_mut().moved = Some(callback); } - // todo!("windows") + // todo(windows) fn on_should_close(&self, callback: Box bool>) { self.inner.callbacks.borrow_mut().should_close = Some(callback); } - // todo!("windows") + // todo(windows) fn on_close(&self, callback: Box) { self.inner.callbacks.borrow_mut().close = Some(callback); } - // todo!("windows") + // todo(windows) fn on_appearance_changed(&self, callback: Box) { self.inner.callbacks.borrow_mut().appearance_changed = Some(callback); } - // todo!("windows") + // todo(windows) fn is_topmost_for_position(&self, position: Point) -> bool { true } - // todo!("windows") + // todo(windows) fn draw(&self, scene: &Scene) { self.inner.renderer.borrow_mut().draw(scene) } - // todo!("windows") + // todo(windows) fn sprite_atlas(&self) -> Arc { self.inner.renderer.borrow().sprite_atlas().clone() } diff --git a/crates/gpui/src/scene.rs b/crates/gpui/src/scene.rs index 1f7088ddfb..61141b2c4d 100644 --- a/crates/gpui/src/scene.rs +++ b/crates/gpui/src/scene.rs @@ -1,4 +1,4 @@ -// todo("windows"): remove +// todo(windows): remove #![cfg_attr(windows, allow(dead_code))] use crate::{ diff --git a/crates/install_cli/src/install_cli.rs b/crates/install_cli/src/install_cli.rs index 506de309ef..b9956ebbb9 100644 --- a/crates/install_cli/src/install_cli.rs +++ b/crates/install_cli/src/install_cli.rs @@ -18,7 +18,7 @@ pub async fn install_cli(cx: &AsyncAppContext) -> Result { // If the symlink is not there or is outdated, first try replacing it // without escalating. smol::fs::remove_file(link_path).await.log_err(); - // todo("windows") + // todo(windows) #[cfg(not(windows))] { if smol::fs::unix::symlink(&cli_path, link_path) diff --git a/crates/languages/src/csharp.rs b/crates/languages/src/csharp.rs index 297e397cdd..0678f89926 100644 --- a/crates/languages/src/csharp.rs +++ b/crates/languages/src/csharp.rs @@ -77,7 +77,7 @@ impl super::LspAdapter for OmniSharpAdapter { archive.unpack(container_dir).await?; } - // todo("windows") + // todo(windows) #[cfg(not(windows))] { fs::set_permissions( diff --git a/crates/languages/src/elixir.rs b/crates/languages/src/elixir.rs index 471f466c84..012401412b 100644 --- a/crates/languages/src/elixir.rs +++ b/crates/languages/src/elixir.rs @@ -350,7 +350,7 @@ impl LspAdapter for NextLspAdapter { } futures::io::copy(response.body_mut(), &mut file).await?; - // todo("windows") + // todo(windows) #[cfg(not(windows))] { fs::set_permissions( diff --git a/crates/languages/src/lua.rs b/crates/languages/src/lua.rs index cad9004480..96bc26964f 100644 --- a/crates/languages/src/lua.rs +++ b/crates/languages/src/lua.rs @@ -79,7 +79,7 @@ impl super::LspAdapter for LuaLspAdapter { archive.unpack(container_dir).await?; } - // todo("windows") + // todo(windows) #[cfg(not(windows))] { fs::set_permissions( diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index 2d3925e7d6..652b1b5102 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -70,7 +70,7 @@ impl LspAdapter for RustLspAdapter { let decompressed_bytes = GzipDecoder::new(BufReader::new(response.body_mut())); let mut file = File::create(&destination_path).await?; futures::io::copy(decompressed_bytes, &mut file).await?; - // todo("windows") + // todo(windows) #[cfg(not(windows))] { fs::set_permissions( diff --git a/crates/languages/src/toml.rs b/crates/languages/src/toml.rs index 1ca6bb8d1d..a2caea6dbf 100644 --- a/crates/languages/src/toml.rs +++ b/crates/languages/src/toml.rs @@ -68,7 +68,7 @@ impl LspAdapter for TaploLspAdapter { futures::io::copy(decompressed_bytes, &mut file).await?; - // todo("windows") + // todo(windows) #[cfg(not(windows))] { fs::set_permissions( diff --git a/crates/languages/src/zig.rs b/crates/languages/src/zig.rs index d3ad22aa8b..ab0e08983e 100644 --- a/crates/languages/src/zig.rs +++ b/crates/languages/src/zig.rs @@ -73,7 +73,7 @@ impl LspAdapter for ZlsAdapter { archive.unpack(container_dir).await?; } - // todo("windows") + // todo(windows) #[cfg(not(windows))] { fs::set_permissions( diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index a84b02350e..6f5ad36ec4 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -400,7 +400,7 @@ impl TerminalBuilder { #[cfg(unix)] let (fd, shell_pid) = (pty.file().as_raw_fd(), pty.child().id()); - // todo("windows") + // todo(windows) #[cfg(windows)] let (fd, shell_pid) = (-1, 0); @@ -668,7 +668,7 @@ impl Terminal { fn update_process_info(&mut self) -> bool { #[cfg(unix)] let mut pid = unsafe { libc::tcgetpgrp(self.shell_fd as i32) }; - // todo("windows") + // todo(windows) #[cfg(windows)] let mut pid = unsafe { windows::Win32::System::Threading::GetCurrentProcessId() } as i32; if pid < 0 { diff --git a/crates/zed/build.rs b/crates/zed/build.rs index 783995942f..d05237f294 100644 --- a/crates/zed/build.rs +++ b/crates/zed/build.rs @@ -45,7 +45,7 @@ fn main() { } if std::env::var("CARGO_CFG_TARGET_ENV").ok() == Some("msvc".to_string()) { - // todo!("windows"): This is to avoid stack overflow. Remove it when solved. + // todo(windows): This is to avoid stack overflow. Remove it when solved. println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024); let manifest = std::path::Path::new("resources/windows/manifest.xml");