Skip to content

No hover over hints, Go to definition does not work! #12172

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
AuroraLantean opened this issue May 6, 2022 · 10 comments
Closed

No hover over hints, Go to definition does not work! #12172

AuroraLantean opened this issue May 6, 2022 · 10 comments
Labels
C-support Category: support questions

Comments

@AuroraLantean
Copy link

AuroraLantean commented May 6, 2022

I don't know what happened but
now after code checking is completed,
there is no inline types, no hover-over hints(showing only "Loading...")
Go to definition does not work!

rust-analyzer: stable release v0.2.1040 and pre-release v0.3.1043

VS Code: 1.67.0

rustc version: rustc 1.59.0 (9d1b2106e 2022-02-23)

relevant settings in vscode settings.json:
"rust-analyzer.trace.extension": true,
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.inlayHints.parameterHints": true,

@lnicola
Copy link
Member

lnicola commented May 6, 2022

I suggest disabling rust-analyzer.trace.extension, it will massively slow down Code. The other two are already default, so there's no need to set them.

Do you have any errors in Output / Rust Analyzer Language Server?

@AuroraLantean
Copy link
Author

Ok I have removed all three rust-analyzer settings in vscode settings.json
after reloading the VS Code, there is no error from the Rust Analyzer. RA only gives me some warning about my code. That is all. And the problems remain. please advise. Thanks

@AuroraLantean AuroraLantean changed the title No hover over hints, Goto definition does not work! No hover over hints, Go to definition does not work! May 6, 2022
@lnicola
Copy link
Member

lnicola commented May 6, 2022

Is your project public? Does it still happen in an empty project?

@lnicola
Copy link
Member

lnicola commented May 6, 2022

But yeah, hovering over hints isn't working yet: #11701.

@lnicola lnicola added the C-support Category: support questions label May 6, 2022
@AuroraLantean
Copy link
Author

AuroraLantean commented May 6, 2022

@inicola What do you mean by empty project?
My project is not public, but this one below is similar to my project:
Polkadot substrate-parachain-template at https://github.com/substrate-developer-hub/substrate-parachain-template
then checkout polkadot-v0.9.18 tag
After Rust Analyzer(cargo check) checking the code in that public repo above... it takes 20 mins to 1 hour time,
then it keeps spinning in the VS Code without stopping!!!??? It seems to be stuck in a loop.
I see no inline types, no hover-over hints(showing only "Loading...")
Go to definition does not work!
This happens in both rust-analyzer stable release v0.2.1040 and pre-release v0.3.1043

In my private repo, I just disabled RA, shut down VSCode, started it again, then enable RA. RA completed checking the code with no more icon spinning. Then still Go To Definition is not working...
Please help!

@lnicola
Copy link
Member

lnicola commented May 6, 2022

What do you mean by empty project?

The output of cargo new foo or whatever else Rust project you want (like https://github.com/rust-lang/rust-analyzer itself).

After Rust Analyzer(cargo check) checking the code in that public repo above... it takes 20 mins to 1 hour time,
I just disabled RA, shut down VSCode, started it again, then enable RA. RA completed checking the code with no more icon spinning.

It's can be disabled, but we run cargo check --all-targets on project load. I just tried to run that on substrate-parachain-template and it took 2m 35s on my 5950X. That's after I switched to nightly and installed the wasm32-unknown-unknown target.

From what I remember, the Polkadot ecosystem tends to use build scripts in creative ways, which aren't always helpful when you want fast builds. But after loading the project, features more or less work:

image

image

@AuroraLantean
Copy link
Author

@lnicola thank you for your quick reply. After installing rust-analyzer pre-release v0.3.1047, type hints worked, hover over hints worked. when I pressed control key when my mouse cursor was over a function, the underscore appeared. Then when I mouse clicked on it, the Go To Definition was stuck/not working... and after that, the hover over hints did not work anymore... my computer is a little old... This is very weird... What do you suggest? Overriding Polkadot's build scripts ? Thanks

@lnicola
Copy link
Member

lnicola commented May 9, 2022

Does that happen in substrate-parachain-template? If so, where? Some places will not work, either because we can't figure out a type, or because we don't support the syntax yet (like the red T::DbWeight in my screenshot above).

You can also keep looking for errors in the Rust Analyzer Language Server output channel.

Overriding Polkadot's build scripts ?

That might speed things up, but will probably break some features.

Did you disable rust-analyzer.trace.extension?

@AuroraLantean
Copy link
Author

AuroraLantean commented May 9, 2022

@lnicola yes, I was in substrate-parachain-template,

pub fn do_something()...
			let who = ensure_signed(origin)?;

The hover over hint worked when my cursor was above ensure_signed(),
Inside that hover over hint, there were two links: Result and BadOrigin...
when I clicked on the Result link, another rust file opened up.
when I clicked on the BadOrigin link, it got stuck, and after that, the hover over hints did not work anymore...
There was no error anywhere I looked. nothing in PROBLEM, OUTPUT, or DEBUG CONSOLE in the VSCode

Okay... after adding this "rust-analyzer.trace.extension": false, in the VSCode settings,
and removed "rust-analyzer.diagnostics.disabled": ["unresolved-macro-call"],
everything worked.
Thank you!

@lnicola
Copy link
Member

lnicola commented May 9, 2022

Yeah, that works for me and goes to ~/.cargo/git/checkouts/substrate-7e08433d4c370a21/fc3fd07/primitives/runtime/src/traits.rs:175:12.

The problem with rust-analyzer.trace.extension is that it logs everything, including the semantic token info, and massively slows down Code. That's why I suggested disabling it right from the start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

No branches or pull requests

2 participants