2

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?

E_net4
  • 27,810
  • 13
  • 101
  • 139
mike rodent
  • 14,126
  • 11
  • 103
  • 157
  • See e.g. [here](https://users.rust-lang.org/t/unable-to-create-or-debug-project-in-eclipse-with-rust-2018-1-31-0-rls-windows/22996) and consider to contribute more explicitly idiot-proof instructions [here](https://github.com/eclipse/corrosion). It would be better to have RLS as part of Cargo, so it will change when switching Rust versions. – howlger Jun 13 '21 at 18:03
  • I don't remember doing anything at all to make this work. I installed Rust as suggested before adding Corrosion. These are the current "rust" preferences: "Use default paths (...)": on -- "Rls config:" empty -- "Use default": on -- "Rust Language Server Location": "Use Rustup" Toolchain: Stable -- HTH – the busybee Jun 14 '21 at 06:44
  • @busybee I have a different set of things to fill in in my Corrosion dialog ... no "use default paths", no "Rls config". Instead I have "Language Server", "LS configuration", etc. What's this all about? – mike rodent Jun 15 '21 at 17:40
  • I want to use Rust on Eclipse in W10. At the moment the Corrosion plugin appears to be not fully functional, and irritating. – mike rodent Jun 28 '21 at 15:33
  • RLS means Rust Language Server and is an executable file (on Windows: `rls.exe`). The Rust [language server](https://en.wikipedia.org/wiki/Language_Server_Protocol) is written in Rust an tells the IDE e.g. which code completion proposals should be shown. What do have in the Eclipse [preferences](https://aws1.discourse-cdn.com/business5/uploads/rust_lang/original/2X/f/f3e317a8672b27e41f27766d2e8d852a68471950.png)? Where did you install Rust in Windows (where is the Rust compiler and is there also the file `rls.exe`) and which [toolchain](https://stackoverflow.com/a/58228429/6505250) do you use? – howlger Jun 29 '21 at 07:58

2 Answers2

2

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

howlger
  • 31,050
  • 11
  • 59
  • 99
  • Although I chose this as the accepted answer, in fact I wasn't able to configure Corrosion properly. When I set Language Server to "D:\apps\rust\rust_1.70.0\.cargo\bin\rust-analyzer.exe" (seems to be what you recommend), I then get syntax highlighting for Rust. But basically that's it. When I start Eclipse I get an error dialog "Rust Support Not Found". – mike rodent Aug 05 '23 at 12:03
  • @mikerodent I'm sorry for that. It worked for me back then, including code completion. If you are using recent versions of Rust and Eclipse Corrision, consider to ask a new question with more details (which version of Rust you have installed where; what exactly have you configured in Eclipse Corrision; what works and what doesn't; etc.). – howlger Aug 05 '23 at 18:31
  • Yes, thanks... or maybe I'd be better to raise a Github question. In Linux (same machine, dual-boot) everything works fine. Actually, I don't think "rust-analyzer.exe" is the right file: when I click to "download rust analyzer", it actually downloads something called "rust-analyzer" (as in Linux). In Linux this is a non-executable binary file. Will persist in W10! – mike rodent Aug 06 '23 at 10:43
0

For me, what I had to do was:

  • Go to Window > Preferences > Rust
  • In the field "Language Server", replace the pre-populated entry with C:\Users\[Username]\.cargo\bin\rls.exe
Kira Resari
  • 1,718
  • 4
  • 19
  • 50