Skip to content

Document why rust-analyzer doesn't show action name in action docs #23072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Jan 13, 2025

rust-analyzer does not support derive_macro expansion in attributes - rust-lang/rust-analyzer#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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 13, 2025
@zed-industries-bot
Copy link

Messages
📖

This PR includes links to the following GitHub Issues: #rust-lang/rust-analyzer#8092
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against 380234b

@mgsloan mgsloan enabled auto-merge January 13, 2025 17:37
#[doc = stringify!($name)]
#[doc = "` action, see [`gpui::actions!`]"]
#[doc = "action generated by `gpui::actions!`"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we lose a space here?

Seems like action would run together with the preceding action name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't! The macro expanded code is

        ///NoAction
        ///action generated by `gpui::actions!`

Copy link
Member

@maxdeviant maxdeviant Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it seems like the #[doc = stringify!($name)] might not be doing anything, then (or at least, not doing what I think it would)?

Because when I hover an action all I see is this:

Screenshot 2025-01-13 at 5 15 41 PM

And the action name is nowhere to be seen 🤔

Copy link
Contributor Author

@mgsloan mgsloan Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! That's what the comment this added is about

// Unfortunately rust-analyzer doesn't display the name due to
// rust-lang/rust-analyzer#8092

Before it was even worse because it had the empty backticks so rust analyzer's view of the doc comment was like it was written:

/// The `
///
/// ` action generated by `gpui::actions!`

@mgsloan mgsloan added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit b59a9f1 Jan 13, 2025
13 checks passed
@mgsloan mgsloan deleted the document-why-rust-analyzer-docs-on-generated-actions-dont-have-names branch January 13, 2025 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants