Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing RLS config file? #186

Closed
pixilcode opened this issue Dec 13, 2018 · 23 comments
Closed

Missing RLS config file? #186

pixilcode opened this issue Dec 13, 2018 · 23 comments

Comments

@pixilcode
Copy link

I have installed Eclipse for Rust and would like to use it for development. However, the content assist by RLS (such as code completion and highlighting) doesn’t work. RLS can't seem to find racer or rustc. As I was looking at the settings for Rust (Window > Preferences > Rust), I noticed that the RLS config is pointing to a nonexistent file at ~/.cargo/rls.conf. How do I get the rls.conf file?

I am currently using Ubuntu 18.04 and Eclipse Photon.

@mickaelistria
Copy link
Contributor

Is the .cargo folder already existing?
@norru Can you help?

@pixilcode
Copy link
Author

The .cargo folder does exist. It is just the rls.conf file that does not exist.

@pixilcode
Copy link
Author

pixilcode commented Dec 13, 2018

What does the rls.conf file store? Would it be possible for me to make one myself?

@norru
Copy link
Contributor

norru commented Dec 13, 2018

Hi @theDragonFire: the .cargo/rls.conf file contains the startup settings for the rls and it is optional. If you don't have one, Corrosion will ignore it and guess some sensible (!) defaults.

In this file you should be able to specify any of the valid RLS settings, as listed in https://github.com/rust-lang/rls#configuration. Syntax for these options is IDE-specific: the PR at #183 contains an example config file for Corrosion.

Unfortunately, none of the settings in RLS, as I can understand, allow you to specify rustc path, which should be set up for you by rustup (check your env vars?) or racer - which AFAIK is linked into the RLS as a library rather than as an external tool.

To progress with troubleshooting I suggest you

  1. look in the Eclipse Error log view
    image

  2. enable the Language Server logs for the Rust Language server here:
    image

Once the logging is active, and you have restarted your IDE, Eclipse will output some RLS logging here:

path/to/your/eclipse_rust_workspace/languageServers-log/org.eclipse.corrosion.rls.log

If you need more help, please post the relevant sections of the log file or any other clue you may find, and we'll take it from there.

@norru
Copy link
Contributor

norru commented Dec 13, 2018

I have also just spotted that you are using Eclipse Photon - I would suggest you upgrade to Eclipse 2018-09 (if Eclipse hasn't done that for you) as there is not much of Corrosion development taking place in the older version.

@pixilcode
Copy link
Author

So I seem to be getting one recurring warning and one recurring error relating to corrosion. The warning says RLS settings for Corrosion path not found at /home/dragonfire/.cargo/rls.conf, which you said isn't a problem. The error says org.eclipse.lsp4j.jsonrpc.ResponseErrorException: missing field 'codeActionKind'.

The only thing I could find in the log file that mentions anything like 'codeActionKind' is this recurring line:

org.eclipse.corrosion.rls to LSP4E: {
  "jsonrpc":"2.0", "id":1, "result": {
    "capabilities": {
      [...]
      "codeActionProvider":true
      [...]
    }
  }
}

and

LSP4E to org.eclipse.corrosion.rls: { 
    [...]
    "params":{
     [...]
     "capabilities":{
       [...]
       "textDocument":{
         [...]
         "codeAction":{},
         [...] 
       }
     }
    [...]
  }
}

Does this help?

@pixilcode
Copy link
Author

pixilcode commented Dec 14, 2018

Is there a way for Eclipse to automatically update? Or do I have to completely reinstall it?
Never mind. I just reinstalled it.

@mickaelistria
Copy link
Contributor

Is there a way for Eclipse to automatically update?

Of course, you can go to Help > Install New Software... , and add link to the repository where your new content stand. Then either you can pick the new content from this same dialog; or using Help > Check for Updates should find it.
Fully reinstalling can be a good thing too, since most of customization happens to be in the workspace, just a new installation opening the same workspace will keep all your preferences and customization.
For Rust, there is the "Eclipse IDE for Rust developers" package that's recommended (if you only or mainly do Rust development). You can get a fresh version from https://www.eclipse.org/downloads/index-developer.php

@norru
Copy link
Contributor

norru commented Dec 14, 2018

org.eclipse.lsp4j.jsonrpc.ResponseErrorException: missing field 'codeActionKind'.

This does ring a bell, there was a bug reported in the Language Server Protocol handler in Eclipse, which was fixed in:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=541851
https://git.eclipse.org/c/lsp4e/lsp4e.git/commit/?id=6cc786f0d9bc1c12b818f7677796e2b4efdefbef
rust-lang/rls#1161

So @theDragonFire it does appear that you are using a slightly outdated version of some Corrosion dependencies (in this case LSP4E).

@mickaelistria is the version of the LSP4E containing this fix not delivered with the latest Eclipse repo?

In the meantime, perhaps one could install the latest bleeding edge LSP4E from the repository at http://download.eclipse.org/lsp4e/snapshots/

@mickaelistria
Copy link
Contributor

is the version of the LSP4E containing this fix not delivered with the latest Eclipse repo?

Indeed, we didn't update the .target file to latest version of LSP4E, so currently, the latest release from September (containing this bug) is shipped.
It's all fine in the SimRel repo but not in Corrosion snapshot repo. I'll update it immediately, and since it's only transitive dependencies and actual bundles we produce shouldn't change, we may consider just replacing the 0.3.0 repo with a newer one; or ask for a 0.3.1.

@norru
Copy link
Contributor

norru commented Dec 14, 2018

It's all fine in the SimRel repo but not in Corrosion snapshot repo.

If it is the case, then the quickest fix for @theDragonFire is to also get the bleeding edge version of Corrosion from http://download.eclipse.org/corrosion/snapshots/

@theDragonFire if it helps, I have an almost identical setup to yours (Ubuntu 18.04 + Eclipse 2018-09 + Corrosion snapshots + LSP4E snapshots) and I use it daily so if you run into other obstacles I can probably reproduce them quickly :)

@norru
Copy link
Contributor

norru commented Dec 14, 2018

If it is the case, then the quickes fix for @theDragonFire is to also get the bleeding edge version of Corrosion from http://download.eclipse.org/corrosion/snapshots/

@mickaelistria
Copy link
Contributor

At the moment, the quickfix would be to use the latest build of "Eclipse IDE for Rust developers"

@pixilcode
Copy link
Author

So I have installed Eclipse 2018-09. I used the above links to get the bleeding edge version of lsp4e and Corrosion. However, when I try to install lsp4e, it won't install 'Generic and Extensible Text Editor' and 'Gson', giving me this error:

Your original request has been modified.
  "Gson: Google Json Library for Java" will be ignored because a newer version is already installed. 
  "Generic and Extensible Text Editor" is already installed, so an update will be performed instead.
Cannot complete the install because of a conflicting dependency.
  Software being installed: Generic and Extensible Text Editor 1.1.200.v20180921-0739 (org.eclipse.ui.genericeditor 1.1.200.v20180921-0739)
  Software currently installed: Eclipse Platform 4.9.0.v20180906-1121 (org.eclipse.platform.feature.group 4.9.0.v20180906-1121)
  Only one of the following can be installed at once: 
    Generic and Extensible Text Editor 1.1.200.v20180921-0739 (org.eclipse.ui.genericeditor 1.1.200.v20180921-0739)
    Generic and Extensible Text Editor 1.1.100.v20180824-1616 (org.eclipse.ui.genericeditor 1.1.100.v20180824-1616)
  Cannot satisfy dependency:
    From: Eclipse Platform 4.9.0.v20180906-1121 (org.eclipse.platform.feature.group 4.9.0.v20180906-1121)
    To: org.eclipse.equinox.p2.iu; org.eclipse.ui.genericeditor [1.1.100.v20180824-1616,1.1.100.v20180824-1616]

I am also still getting the previously mentioned error about 'codeActionKind'.

@norru
Copy link
Contributor

norru commented Dec 14, 2018

I am also still getting the previously mentioned error about 'codeActionKind'.

This probably means the latest LSP4E is not being installed - possibly because of the conflicts - you should be able to "force upgrade" to the latest version, doesn't Eclipse give you the option?
You may want to try and

@pixilcode
Copy link
Author

I've tried all of that and for some reason it isn't working. Any other ideas?

If not, I guess I'll wait until Eclipse 2018-12 comes out. Hopefully that will fix it. I'll report back then.

@mickaelistria
Copy link
Contributor

You can already try Eclipse 2018-12 at https://www.eclipse.org/downloads/index-developer.php . Pick the package directly (not the installer). It does contain the latest version of LSP4E and Corrosion.

@norru: Corrosion has a "lax" dependency on LSP4E versions. As a result, if a compatible version of LSP4E is already installed, the installation or upgrade will not necessarily force an update of it; so the bug is still here. We need Corrosion to be a bit more strict regarding requirements on LSP4E to reduce the probability of such issues.

@pixilcode
Copy link
Author

I installed Eclipse 2018-12 and everything works perfectly! Thank you so much @norru and @mickaelistria for spending your time helping me figure this out! Now that it works, I'll be able to be a lot more productive.

@norru
Copy link
Contributor

norru commented Dec 14, 2018

Hi @theDragonFire, I have managed to reproduce your problem and found a workaround (should you want to stay with 2018-09):

Do not press Next >. Instead, add the following three sites via Add... or Manage...

Corrosion Snapshots - http://download.eclipse.org/corrosion/snapshots/
TM4E Snapshots - http://download.eclipse.org/tm4e/snapshots/
LSP4E Snapshots - http://download.eclipse.org/lsp4e/snapshots/

  • Close the "Install" window
  • Help -> Check for updates
  • accept the proposed selection (in my case Corrosion wanted to upgrade)
  • press Next/Finish to the end
  • restart Eclipse when prompted

@sabdelhay
Copy link

@norru thank you, you're a live saver 👍

@worikgh
Copy link

worikgh commented Sep 18, 2019

I am having the exact same problem but with

Version: 2019-06 (4.12.0)
Build id: 20190614-1200

I have tried: $ touch ~/.cargo/rls.conf but does not help.
I have read the above but find it very opaque.

@worikgh
Copy link

worikgh commented Sep 18, 2019

$ rustup component add rls

@jorn-p-l
Copy link

jorn-p-l commented Jan 5, 2020

The solution is to create the rls.conf file

and using the command in the console.

PS C:\Users\andre\.cargo\bin> .\rls.exe
error: 'rls.exe' is not installed for the toolchain 'stable-x86_64-pc-windows-msvc'
To install, run `rustup component add rls --toolchain stable-x86_64-pc-windows-msvc`
PS C:\Users\andre\.cargo\bin> rustup component add rls --toolchain stable-x86_64-pc-windows-msvc
info: downloading component 'rls'
  5.3 MiB /   5.3 MiB (100 %)   4.8 MiB/s in  2s ETA:  0s
info: installing component 'rls'
PS C:\Users\andre\.cargo\bin> rls

After downloading the additional file, the problem disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants