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
Completion suggestion only shows public traits and members #7728
Comments
I don't get completion in |
With latest nigthly Feb 21. Things seems working better. I get priv2 within |
I don't recall this any recent changes that could have affected this, but it's good to hear that it works. Can we close it, then? |
After playing bit more, I get still inconsistent suggestions. It seems that only reliable way to get member and trait suggestions is to mark everything pub. |
Can you provide a concrete example where you're missing suggestions? |
The attached video shows how trait method rustanalyzer.mp4 |
Huh, there seems to be something weird going on with macroexpansion here. mod foo {
#[derive(Debug, Default)]
struct Template2 {}
impl Template2 {
fn private(&self) {}
}
fn baz() {
let goo: Template2 = Template2 {};
// goo.<|> -> here it works
println!("goo");
// goo.<|> -> here it doesn't work
}
} It seems like we detect the wrong module after the macro call. Note that this only fails if it's in a submodule; putting the code into the crate root makes it work. |
Um.. an empty macro is not working either: macro_rules! empty {
() => {};
}
mod foo {
#[derive(Debug, Default)]
struct Template2 {}
impl Template2 {
fn private(&self) {}
}
fn baz() {
let goo: Template2 = Template2 {};
// goo.<|> -> here it works
empty!();
// goo.<|> -> here it doesn't work
}
} |
Latest working great. Thank you! |
Environment: mac osx 10.15.7, VSCode 1.53.2,
Latest nightly Rust Analyzer
I don't know if this has been always the case?
We got simple struct and some traits.
goo.<*>
get fn bar completion if bar is pub.also bar's
self.<*>
find priv() only if it is pub.Has rust analyser always followed visibility rules? I think it would be really nice if we could turn this of and let compiler fail when private part is tried to use.
The text was updated successfully, but these errors were encountered: