Why doesn't Rust code completion work in my Visual Studio 2015?

I am using Visual Studio 2015 v14 with VisualRust 0.1.2

In Tools -> Options -> Text Editor -> Visual Rust statement completion is grayed out and cannot be enabled.

In Tools -> Options -> Visual Rust I selected Use bundled racer and Read rust sources from environment variable

The driver that comes with VisualRust works correctly when called manually, that is, racer-120e98b.exe complete std::io:: returns the corresponding results.

In Visual Studio, writing let e = std::io:: and then pressing CTRL + Space to start autocomplete will return a list of reserved keywords (for example, if, while, struct, etc.).

I assume the problem is that statement completion cannot be enabled. How to solve this?

+5
source share
1 answer

I am launching the Visual Studio 2015 community and that is how I did it:

Download the source and sources of rust through

 cargo install racer rustup component add rust-src 

However, the variable RUST_SRC_PATH has not yet been set, and I do not know who should set it. The next batch of script will set the variable to its correct value, see this issue on github .

 @ECHO OFF FOR /F "tokens=* USEBACKQ" %%P IN (`rustc --print sysroot`) DO SET RS=%%P SETX RUST_SRC_PATH "%RS%\lib\rustlib\src\rust\src" 

After that, I still had to specify the path to racer.exe manually instead of the Use bundled racer option. By default, you can find it here:

 %USERPROFILE%\.cargo\bin\racer.exe 

Hope this helps!

+1
source

All Articles