ayrat555 / frankenstein

Telegram bot API client for Rust
Do What The F*ck You Want To Public License
268 stars 28 forks source link

Rust analyzer cannot find builders #45

Closed nick-lehmann closed 2 years ago

nick-lehmann commented 2 years ago

I have tried the reply_to_message_updates example with VS Code and rust-analyzer. Unfortunately, I noticed that rust analyzer was unable to find any imported api_params builder generated by the derive_builder macro. Hence, no form of intellisense is available, neither when typing the import statement nor when using of the builder. Importing the original structs for the api parameters works as expected.

Having not worked with macros, I was unable to identify the cause of this problem. Do you have an idea why rust_analyzer struggles with the macro? If so, do you no a workaround or a tracking issue here on Github?

P.S. Thank you for the nice work and this great project 👍🏻

EdJoPaTo commented 2 years ago

Not sure where the problem is for you, but rust_analyzer in VSCode works fine for me.

Screenshot

nick-lehmann commented 2 years ago

Mmh, I guess it is not a problem with your crate. If I use the derive_builder crate and their derive macro, code completion also does not work in a strange way. It is able to tell me, that invoking a setter method without an argument is wrong, but it can neither infer the type nor provide code completion.

Just out of curiosity, could you tell me which version of rust and rust-analyzer you have installed?

Since it is clearly not related to your crate, I will close the issue. Nevertheless, thanks for your response 👍🏻

EdJoPaTo commented 2 years ago

just to make sure, not my crate, I only contributed and saw the issue :innocent:

I am running Arch Linux with rust-analyzer (20220228-1) and rustup, which installed and uses the current stable (1.59.0).

The only relevant config in VSCode I see is my change of the rust-analyzer serverPath to the one of the host binary:

https://github.com/EdJoPaTo/LinuxScripts/blob/d7d518cd0c7c7d5eefcffdc844502abc318ae88a/configs/vscode-settings.json#L20

That way the package manager updates the version when I update everything and I do not need to always wait for the update of the VSCode internal thingy to complete. But its just a different place of the same binary. It shouldnt interfere with the autocompletion / intellisense. Not sure what is happening for you there.

ayrat555 commented 2 years ago

@EdJoPaTo Thank you for looking into this!

just to make sure, not my crate, I only contributed and saw the issue 😇

don't be modest. we built it together :]