Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add support for namespace changes in action deprecations (#23086)
Michael Sloand4e91c1898ee
diff --git a/crates/editor/src/actions.rs b/crates/editor/src/actions.rsindex 43226f0f62a..97a4aefa0e0 100644--- a/crates/editor/src/actions.rs+++ b/crates/editor/src/actions.rs@@ -1,6 +1,6 @@//! This module contains all actions supported by [`Editor`].use super::*;-use gpui::{action_aliases, action_as};+use gpui::{action_as, action_with_deprecated_aliases};use schemars::JsonSchema;use util::serde::default_true;@@ -394,4 +394,4 @@ gpui::actions!(action_as!(go_to_line, ToggleGoToLine as Toggle);-action_aliases!(editor, OpenSelectedFilename, [OpenFile]);+action_with_deprecated_aliases!(editor, OpenSelectedFilename, ["editor::OpenFile"]);diff --git a/crates/gpui/src/action.rs b/crates/gpui/src/action.rsindex 06029676650..ee285b896bf 100644--- a/crates/gpui/src/action.rs+++ b/crates/gpui/src/action.rs@@ -286,7 +286,9 @@ macro_rules! action_as {// https://github.com/rust-lang/rust-analyzer/issues/8092#[doc = stringify!($name)]#[doc = "action generated by `gpui::action_as!`"]- #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]+ #[derive(+ ::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug, ::std::cmp::PartialEq,+ )]pub struct $name;gpui::__impl_action!(@@ -311,21 +313,15 @@ macro_rules! action_as {/// Defines and registers a unit struct that can be used as an action, with some deprecated aliases.#[macro_export]-macro_rules! action_aliases {- ($namespace:path, $name:ident, [$($alias:ident),* $(,)?]) => {+macro_rules! action_with_deprecated_aliases {+ ($namespace:path, $name:ident, [$($alias:literal),* $(,)?]) => {// Unfortunately rust-analyzer doesn't display the name due to// https://github.com/rust-lang/rust-analyzer/issues/8092#[doc = stringify!($name)]- #[doc = "action, generated by `gpui::action_aliases!`"]+ #[doc = "action, generated by `gpui::action_with_deprecated_aliases!`"]#[derive(- ::std::cmp::PartialEq,- ::std::clone::Clone,- ::std::default::Default,- ::std::fmt::Debug,- gpui::private::serde_derive::Deserialize,- gpui::private::schemars::JsonSchema,+ ::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug, ::std::cmp::PartialEq,)]- #[serde(crate = "gpui::private::serde")]pub struct $name;gpui::__impl_action!(@@ -345,7 +341,7 @@ macro_rules! action_aliases {},fn deprecated_aliases() -> &'static [&'static str] {&[- $(concat!(stringify!($namespace), "::", stringify!($alias))),*+ $($alias),*]});