Skip to content

Completions not working with Faux macros #19863

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

Closed
DGolubets opened this issue May 25, 2025 · 4 comments · Fixed by #19864 or #19942
Closed

Completions not working with Faux macros #19863

DGolubets opened this issue May 25, 2025 · 4 comments · Fixed by #19864 or #19942
Assignees
Labels
A-completion autocompletion A-macro macro expansion C-bug Category: bug

Comments

@DGolubets
Copy link

Hi,

I'm using Faux for mocking my components.
If my component impl block is marked with Faux macros, I don't get completions inside it.

rust-analyzer version: 0.3.2466-standalone

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: Zed (0.187.8), VSCode (RA 0.3.2466)

code snippet to reproduce:

struct ComponentA;

impl ComponentA {
    pub fn do_something(&self) {}
}

#[cfg_attr(test, faux::create)]
pub struct ComponentB {
    a: ComponentA,
}

#[cfg_attr(test, faux::methods)]
impl ComponentB {
    pub fn do_something(&self) {
        self.a.do_something(); // no completion here
    }
}
@DGolubets DGolubets added the C-bug Category: bug label May 25, 2025
@ChayimFriedman2 ChayimFriedman2 added the A-completion autocompletion label May 25, 2025
@ChayimFriedman2
Copy link
Contributor

Oh this is might_be_inside_macro_call() not considering cfg_attr.

I think we ought to stop the pile of hacks we're doing there and instead use semantics properly.

@ChayimFriedman2 ChayimFriedman2 added the A-macro macro expansion label May 25, 2025
@DGolubets
Copy link
Author

Also, for some reason it's only "dot "completions, on instances.
Something like ComponentA:: shows completions fine (if I add e.g. new method there).

@DGolubets
Copy link
Author

@ChayimFriedman2 @Veykril
This is still not working with 0.3.2482-standalone

@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Jun 7, 2025

Oh sorry! I didn't check it is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment