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

BUG: candid_method macro messes up intellisense and stops it from working #403

Closed
saikatdas0790 opened this issue Jan 7, 2023 · 6 comments

Comments

@saikatdas0790
Copy link

saikatdas0790 commented Jan 7, 2023

Applying the #[candid::candid_method] macro for autogeneration of Candid in a Rust project breaks intellisense on that function. Here's a minimal reproduction:
https://github.com/saikatdas0790/ic_cdk_macro_intellisense_test

Steps to reproduce:

  • Clone repo and install dependencies
  • Open the project in a VS Code instance with the rust-analyzer extension installed
  • Try prompting intellisense in the increment_1 and increment_2 functions
  • Intellisense doesn't work in the first one with both macros but works in the second one

Here are some screenshots:

Intellisense shows generic word results here
image

Intellisense shows relevant results received from the Rust language server
image

Additional environment details:

  • Running on Windows 11 with WSL 2
  • VS Code stable
  • rust-analyzer - official extension for Rust autocomplete
@chenyan-dfinity
Copy link
Contributor

The offending code is here: https://github.com/dfinity/candid/blob/master/rust/candid_derive/src/func.rs#L17.

Will watch for a solution when rust-lang/rust#44034 is resolved.

@neeboo
Copy link

neeboo commented Jul 17, 2023

another issue related.

My Clion keeps complaining the duplicated method.

image

@chenyan-dfinity
Copy link
Contributor

I cannot reproduce this. Did you try the latest CDK 0.10 and candid 0.9?

@neeboo
Copy link

neeboo commented Jul 18, 2023

Updates: it turns out my rustc version causing the issue. When I switch back to 1.68, the errors are gone.

I cannot reproduce this. Did you try the latest CDK 0.10 and candid 0.9?

Same thing, It's weird when I try to modify the rename and function name.
It seems the function name is randomly occupied.
Kapture 2023-07-18 at 22 25 49

@neeboo
Copy link

neeboo commented Aug 8, 2023

It seems that the issue was raised but not solved .

rust-lang/rust-analyzer#13918

@chenyan-dfinity
Copy link
Contributor

In CDK 0.10, you don't need to put candid_method attribute in the code. See the migration guide: https://daviddalbusco.com/blog/automatic-candid-generation-in-rust-exploring-the-ic-cdk-v0-10-0-update/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants