Rust LSP Configuration

The details below describe how to install and configure the Rust rust-analyzer Language Server found here.
NOTE: This installation process assumes Rust has been installed on the machine.

Installing the Language Server

To install the language server run the following command:
rustup +nightly component add rust-analyzer-preview
That installation will copy the binary files to the following user folder location wher the <user id> represents the id of the current user:
 Directory of C:\Users\<user id>\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin

02/07/2022  10:04 PM        26,444,800 rust-analyzer.exe
If that folder does not contain the rust-analyzer.exe binary, use the Windows search to try and locate that file.
With the file located, run the following commands to copy that binary to the following Zeus installation folder, as this will insure the executable is then located in a folder that is defined in the system PATH environment variable.
cd "C:\Users\<user id>\AppData\Local\Programs\Zeus (x64)\zGNU\Rust\"
copy "C:\Users\<user id>\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rust-analyzer.exe"
With the binary filed copied, test the installation by running rust-analyzer.exe --version command using the Zeus Tools, DOS Command Line menu which should produce output similar to this:
rust-analyzer 996300f4a 2021-08-31 dev
If that output is not produced refer to the this page for more details.

Configuration

Start Zeus and use the Options, Document Types menu to edit the Rust document type and in the Language Server panel apply the following configuration settings:
Program Type: Executable
     Program: rust-analyzer.exe
   Directory: $wdd
NOTE: In this case the directory of the executable can be omitted only because the Language Server executable folder is now found in a Zeus folder that is located in the system PATH environment variable.

Using the Language Server

To test the configuration you will need to create a Rust project and a Zeus workspace as described below.
1: At the command line create a new Rust project as follow:
cd c:\Rust\
cargo new hello_world --bin
More details about Rust projects can be found here.
2: Start Zeus and use the Workspace, New menu to create a new, dynamic style workspace in that c:\Rust\hello_world folder.
3: Open the the hello_world\src\main.rs file found in the workspace and type in the code shown below to see the auto-complete and code navigation in action:
lsp rust


Latest Version: Zeus 3.99b
Released: 29th January 2024