Add support for namespace changes in action deprecations (#23086)
cc @cole-miller Release Notes: - N/A
This commit is contained in:
parent
b633f62aa6
commit
d4e91c1898
2 changed files with 10 additions and 14 deletions
|
@ -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"]);
|
||||
|
|
|
@ -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),*
|
||||
]
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue