Skip to content
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

Integrate attribute macros into source_to_def #9142

Closed
jonas-schievink opened this issue Jun 4, 2021 · 2 comments
Closed

Integrate attribute macros into source_to_def #9142

jonas-schievink opened this issue Jun 4, 2021 · 2 comments
Labels
A-macro macro expansion A-nameres name, path and module resolution S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

Currently, rust-analyzer does not work inside items with attribute macros when they are enabled. This is because we never add the item to the child-by-source map of the parent, because the item is replaced by the macro expansion.

This might be a bit tricky to fix, because syntactically these are still items, but semantically they're macro invocations.

@jonas-schievink jonas-schievink added A-macro macro expansion S-actionable Someone could pick this issue up and work on it right now A-nameres name, path and module resolution labels Jun 4, 2021
bors bot added a commit that referenced this issue Jun 8, 2021
9180: fix: fix some IDE functionality inside attribute macros r=jonas-schievink a=jonas-schievink

In `SourceToDefCtx::find_container`, we might encounter a container that has an attribute macro. We need to skip that item, instead of bailing out and creating an empty `Resolver`, otherwise all names in the macro stay unresolved.

Part of #9142

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
@jonas-schievink
Copy link
Contributor Author

This was mostly fixed by #9180, but it seems that fn-like macro invocations in the attribute macro's output still lose syntax highlighting and IDE functions.

@jonas-schievink
Copy link
Contributor Author

it seems that fn-like macro invocations in the attribute macro's output still lose syntax highlighting and IDE functions.

Opened this as #10115, which has since been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion A-nameres name, path and module resolution S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

1 participant