windowseclipserustrust-language-server

Eclipse W10 Rust configuration "RLS"


I've installed Rust on the system.

I've installed the Corrosion plugin in Eclipse (v.2021-03 - 4.19.0).

I can open rs files and they show syntax highlighting.

But I'm getting this annoying thing when I try to do any rusting: "Rust support not found" --> Open preferences --> Error: "Input a valid path to the Rust Language Server (rls)".

The path for "Language Server" in that dialog is wrong: it is my Eclipse installation directory. I have installed Rust under D:\apps\rust. I have run this command among others:

C:\Users\Mike>rustup component add rls rust-analysis rust-src

... in the Eclipse dialog I can configure the path to the RLS using a file-chooser dialog. What am I looking for? A file? A directory? Which one?

NB I have also downloaded (and expanded) the RLS from here.

NB2 Perhaps Rust HQ could cater for this OS + IDE combination, with more explicitly idiot-proof instructions?


Solution

  • RLS is the acronym for Rust Language Server. It's an executable file, on Windows rls.exe, on Linux and macOS rls.

    The term server is a bit misleading here, as a language server is in general a locally executed headless application. The IDE or editor runs the language server application to get back via the standardized Language Server Protocol (LSP) e.g. which errors and warning exist where and which code completion proposals have to be displayed at a given cursor position.

    RLS is written in Rust and is shipped with Rust, in the same directory as the Rust compiler (rustc), at least that was the case in the past. These days, the rust-analyzer (rust-analyzer.exe) is the replacement for RLS and offers better support than RLS. Eclipse Corrosion detects it and prefers rust-analyzer, if it is available in PATH or is found in some standard locations (see Eclipse Corrosion Rust language server documentation and rust-analyzer Eclipse Corrosion documentation).

    Since in your case no language server for Rust language support was found, make sure rls.exe or better rust-analyzer.exe is installed on your system (as it is not part of Eclipse Corrosion) and in the Eclipse IDE the language server executable file is configured as language server in the preferences for Rust.

    Please note, Eclipse Corrosion is mainly developed and tested on Linux. Therefore, the documentation for Windows might need to be improved and Windows specific glitches might be overlooked. If you find something, make sure it has been reported, preferably with a patch (as I did some time ago).