rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.33k stars 1.61k forks source link

vscode single file has no hints #17877

Open Arichy opened 3 months ago

Arichy commented 3 months ago

rust-analyzer version: 0.3.2070-standalone

rustc version: 1.77.2

editor or extension: vscode v0.3.2070

Just create an add.rs in the root of a JS repo, it has no hints. image

ShoyuVanilla commented 3 months ago

You need a proper cargo workspace structure to work with rust code - except passing it directly to rustc with some flags -. Such single .rs file doesn't have any necessary informations like dependencies, editions, etc.

GF-Huang commented 1 month ago

Same issue for me, while playing VSCode LeetCode.

ChayimFriedman2 commented 1 month ago

@GF-Huang Do you have a Cargo project your file is included in?

GF-Huang commented 1 month ago

@GF-Huang Do you have a Cargo project your file is included in?

No, because I want single file analysis.

ChayimFriedman2 commented 1 month ago

@GF-Huang rust-analyzer does not support full analysis for single file (the closest will be cargo script). If you want IDE services, you need to create a Cargo project.

simon-eon commented 2 weeks ago

@GF-Huang rust-analyzer does not support full analysis for single file (the closest will be cargo script). If you want IDE services, you need to create a Cargo project.

when?

ChayimFriedman2 commented 2 weeks ago

@simon-eon When what?