-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Completions for macros in #[macro_use(...)]
of extern crate/mod declaration
#15657
Comments
We'll have to add a new arm to the match here rust-analyzer/crates/ide-completion/src/completions/attribute.rs Lines 49 to 70 in 8a23314
and create a corresponding submodule in crates/ide-completion/src/completions/attribute/macro_use.rs .
Then we'll need to figure out what the attribute we are completing in is actually attached to. For that we need to add a new field here rust-analyzer/crates/ide-completion/src/context.rs Lines 370 to 374 in 8a23314
ModuleDef and populate it here appropriately rust-analyzer/crates/ide-completion/src/context/analysis.rs Lines 257 to 262 in 8a23314
Then in the newly created completions module we'll have to check if the definition the attribute is attached to is a module or extern crate and fetch the exported macros for that from there. |
Seems like arguments to #[macro_use(foo)] // <- error: arguments to `macro_use` are not allowed here
mod inner {
macro_rules! foo {
() => {};
}
}
fn main() {} We should just autocomplete if |
we should be completing the exported macros of the
foo
crate here.Likewise for modules
The text was updated successfully, but these errors were encountered: