rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

vscode single file has no hints

Open Arichy opened this issue 1 year ago • 1 comments

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

Arichy avatar Aug 13 '24 09:08 Arichy

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.

ShoyuVanilla avatar Aug 13 '24 16:08 ShoyuVanilla

Same issue for me, while playing VSCode LeetCode.

GF-Huang avatar Sep 28 '24 13:09 GF-Huang

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

ChayimFriedman2 avatar Sep 28 '24 18:09 ChayimFriedman2

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

No, because I want single file analysis.

GF-Huang avatar Sep 28 '24 19:09 GF-Huang

@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.

ChayimFriedman2 avatar Sep 28 '24 21:09 ChayimFriedman2

@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?

ghost avatar Nov 08 '24 15:11 ghost

@simon-eon When what?

ChayimFriedman2 avatar Nov 09 '24 16:11 ChayimFriedman2

@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.

But if I only want to write my algorithm in a single file like leetcode 1.twoSum.rs 2.addTwoNumbers.rs ... like this How to solve the problem of intelligent prompts without inlay hints and standard libraries in VSC?

jinhuid avatar Dec 16 '24 10:12 jinhuid

@jinhuid Just create a Cargo project. That's not too much of a burden, and with cargo script it's even easier.

ChayimFriedman2 avatar Dec 16 '24 11:12 ChayimFriedman2

We will support standalone files properly at some point, but right now that is not really supported (well) due to implementation problems

Veykril avatar Dec 16 '24 12:12 Veykril