Remove todo! comments (#8981)

Switching fully to normal `todo` style

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-03-06 18:25:20 -08:00 committed by GitHub
parent 8be4b4d75d
commit 8a92d28663
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 86 additions and 86 deletions

View file

@ -156,7 +156,7 @@ mod linux {
}
}
// todo("windows")
// todo(windows)
#[cfg(target_os = "windows")]
mod windows {
use std::path::Path;

View file

@ -132,7 +132,7 @@ async fn main() -> Result<()> {
.await
.map_err(|e| anyhow!(e))?;
// todo("windows")
// todo(windows)
#[cfg(windows)]
unimplemented!();
}

View file

@ -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<dyn Platform> {
pub(crate) fn current_platform() -> Rc<dyn Platform> {
Rc::new(LinuxPlatform::new())
}
// todo("windows")
// todo(windows)
#[cfg(target_os = "windows")]
pub(crate) fn current_platform() -> Rc<dyn Platform> {
Rc::new(WindowsPlatform::new())

View file

@ -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!()
}

View file

@ -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<Uuid> {
Err(anyhow!("not implemented yet."))
}

View file

@ -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<Rc<dyn PlatformDisplay>> {
vec![Rc::new(WindowsDisplay::new())]
}
// todo!("windows")
// todo(windows)
fn display(&self, id: crate::DisplayId) -> Option<Rc<dyn PlatformDisplay>> {
Some(Rc::new(WindowsDisplay::new()))
}
// todo!("windows")
// todo(windows)
fn active_window(&self) -> Option<AnyWindowHandle> {
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<dyn FnMut(Vec<String>)>) {
self.inner.callbacks.lock().open_urls = Some(callback);
}
// todo!("windows")
// todo(windows)
fn prompt_for_paths(&self, options: PathPromptOptions) -> Receiver<Option<Vec<PathBuf>>> {
unimplemented!()
}
// todo!("windows")
// todo(windows)
fn prompt_for_new_path(&self, directory: &Path) -> Receiver<Option<PathBuf>> {
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<Menu>, keymap: &Keymap) {}
fn on_app_menu_action(&self, callback: Box<dyn FnMut(&dyn Action)>) {
@ -423,7 +423,7 @@ impl Platform for WindowsPlatform {
})
}
// todo!("windows")
// todo(windows)
fn app_path(&self) -> Result<PathBuf> {
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<PathBuf> {
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<ClipboardItem> {
unimplemented!()
}
// todo!("windows")
// todo(windows)
fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Task<Result<()>> {
Task::Ready(Some(Err(anyhow!("not implemented yet."))))
}
// todo!("windows")
// todo(windows)
fn read_credentials(&self, url: &str) -> Task<Result<Option<(String, Vec<u8>)>>> {
Task::Ready(Some(Err(anyhow!("not implemented yet."))))
}
// todo!("windows")
// todo(windows)
fn delete_credentials(&self, url: &str) -> Task<Result<()>> {
Task::Ready(Some(Err(anyhow!("not implemented yet."))))
}

View file

@ -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<String> {
self.0
@ -71,13 +71,13 @@ impl PlatformTextSystem for WindowsTextSystem {
.collect()
}
// todo!("windows")
// todo(windows)
fn all_font_families(&self) -> Vec<String> {
Vec::new()
}
fn font_id(&self, font: &Font) -> Result<FontId> {
// 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<Bounds<DevicePixels>> {
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()),

View file

@ -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<Pixels> {
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<dyn PlatformDisplay> {
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<PlatformInputHandler> {
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<dyn FnMut()>) {
self.inner.callbacks.borrow_mut().request_frame = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>) {
self.inner.callbacks.borrow_mut().input = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>) {
self.inner.callbacks.borrow_mut().active_status_change = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_resize(&self, callback: Box<dyn FnMut(Size<Pixels>, f32)>) {
self.inner.callbacks.borrow_mut().resize = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_fullscreen(&self, callback: Box<dyn FnMut(bool)>) {
self.inner.callbacks.borrow_mut().fullscreen = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_moved(&self, callback: Box<dyn FnMut()>) {
self.inner.callbacks.borrow_mut().moved = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_should_close(&self, callback: Box<dyn FnMut() -> bool>) {
self.inner.callbacks.borrow_mut().should_close = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_close(&self, callback: Box<dyn FnOnce()>) {
self.inner.callbacks.borrow_mut().close = Some(callback);
}
// todo!("windows")
// todo(windows)
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>) {
self.inner.callbacks.borrow_mut().appearance_changed = Some(callback);
}
// todo!("windows")
// todo(windows)
fn is_topmost_for_position(&self, position: Point<Pixels>) -> 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<dyn PlatformAtlas> {
self.inner.renderer.borrow().sprite_atlas().clone()
}

View file

@ -1,4 +1,4 @@
// todo("windows"): remove
// todo(windows): remove
#![cfg_attr(windows, allow(dead_code))]
use crate::{

View file

@ -18,7 +18,7 @@ pub async fn install_cli(cx: &AsyncAppContext) -> Result<PathBuf> {
// 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)

View file

@ -77,7 +77,7 @@ impl super::LspAdapter for OmniSharpAdapter {
archive.unpack(container_dir).await?;
}
// todo("windows")
// todo(windows)
#[cfg(not(windows))]
{
fs::set_permissions(

View file

@ -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(

View file

@ -79,7 +79,7 @@ impl super::LspAdapter for LuaLspAdapter {
archive.unpack(container_dir).await?;
}
// todo("windows")
// todo(windows)
#[cfg(not(windows))]
{
fs::set_permissions(

View file

@ -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(

View file

@ -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(

View file

@ -73,7 +73,7 @@ impl LspAdapter for ZlsAdapter {
archive.unpack(container_dir).await?;
}
// todo("windows")
// todo(windows)
#[cfg(not(windows))]
{
fs::set_permissions(

View file

@ -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 {

View file

@ -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");