I have seen youtubers and such working on Rust in VSC with rust-analyzer plug-in where they get the optional type annotations displayed, even if it isn't necessarily written in the code. It's like I type foo(a,b)
in the editor and it automagically displays foo(a: A, b: B)
where the :A
and :B
are in faint grey possibly not even written in the file, just visual hint? It's nice and I can't figure out whether this is a feature of VSC or rust-analyzer? My rust-analyzer has the two settings Parameter Hints and TypeHints both set to enabled.
How to get type hints to display?
17.5k Views Asked by jsstuball At
2
You're looking for
parameter hints
in this case. The function for which you want to display hints also needs to have more than one parameter.Make sure that the setting is enabled:
Settings (UI)
Settings (JSON)
You should then end up with something akin to the following:
Make sure that only
rust-analyzer
is enabled as it can conflict withrls
. A warning was added which mentions the following if both are enabled: