From b59a9f1f42b3d38f654b2624a17d201d544b444d Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 13 Jan 2025 10:48:50 -0700 Subject: [PATCH] Document why rust-analyzer doesn't show action name in action docs (#23072) rust-analyzer does not support derive_macro expansion in attributes - https://github.com/rust-lang/rust-analyzer/issues/8092. This could be worked around via a proc_macro, but I think it'd be best to just require docs for every action. Release Notes: - N/A --- crates/gpui/src/action.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/gpui/src/action.rs b/crates/gpui/src/action.rs index bc7388e513..0602967665 100644 --- a/crates/gpui/src/action.rs +++ b/crates/gpui/src/action.rs @@ -252,9 +252,10 @@ impl ActionRegistry { macro_rules! actions { ($namespace:path, [ $($name:ident),* $(,)? ]) => { $( - #[doc = "The `"] + // Unfortunately rust-analyzer doesn't display the name due to + // https://github.com/rust-lang/rust-analyzer/issues/8092 #[doc = stringify!($name)] - #[doc = "` action, see [`gpui::actions!`]"] + #[doc = "action generated by `gpui::actions!`"] #[derive(::std::clone::Clone,::std::cmp::PartialEq, ::std::default::Default)] pub struct $name; @@ -281,9 +282,10 @@ macro_rules! actions { #[macro_export] macro_rules! action_as { ($namespace:path, $name:ident as $visual_name:ident) => { - #[doc = "The `"] + // Unfortunately rust-analyzer doesn't display the name due to + // https://github.com/rust-lang/rust-analyzer/issues/8092 #[doc = stringify!($name)] - #[doc = "` action, see [`gpui::actions!`]"] + #[doc = "action generated by `gpui::action_as!`"] #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)] pub struct $name; @@ -311,9 +313,10 @@ macro_rules! action_as { #[macro_export] macro_rules! action_aliases { ($namespace:path, $name:ident, [$($alias:ident),* $(,)?]) => { - #[doc = "The `"] + // Unfortunately rust-analyzer doesn't display the name due to + // https://github.com/rust-lang/rust-analyzer/issues/8092 #[doc = stringify!($name)] - #[doc = "` action, see [`gpui::actions!`]"] + #[doc = "action, generated by `gpui::action_aliases!`"] #[derive( ::std::cmp::PartialEq, ::std::clone::Clone,