Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Add installing rls #181

Merged
merged 6 commits into from
Apr 22, 2017
Merged

Add installing rls #181

merged 6 commits into from
Apr 22, 2017

Conversation

KalitaAlexey
Copy link
Member

@KalitaAlexey KalitaAlexey commented Apr 18, 2017

Fixes #177

After this PR:

  • the documentation will be extended to describe a new way to set RLS up
  • the extension will:
    • determine:
      • if a user uses Rustup
      • if RLS is installed
      • if RLS can be installed via RLS
    • ask a user to update Rustup before installing RLS
    • ask a user to install RLS
    • use RLS installed via Rustup by default (There is no need to specify rust.rls.executable if RLS is installed via Rustup)

For those who wants to try it out:

GitHub documentation
The page "Install the extension from source" in the extension's documentation

git clone https://github.com/editor-rs/vscode-rust.git
cd vscode-rust
git fetch origin pull/181/head:pull-181
git checkout pull-181
npm install
code .

Then Press F5

@pronebird
Copy link

pronebird commented Apr 19, 2017

Since RLS has been added into rustup, it would be awesome to default rust.rls.executable setting to rls. Currently Rust plugin fails to run RLS if this option is not configured. RLS lives now in ~/.cargo/bin/rls.

"rust.rls": {
  "executable": "rls" /* <- should be default */
}

@KalitaAlexey
Copy link
Member Author

@pronebird,
Yes, that's what I am doing.

This commit makes the configuration be able to determine if RLS is installed via Rustup and to use it.
After this commit a user don't have to specify `rust.rls.executable`, but if one does, a specified value supersedes an automatic one
@KalitaAlexey
Copy link
Member Author

@pronebird,
I actually have done what you had asked.
You can try it out.

After this commit on opening any Rust project the extension will ask a user to install RLS if it is not installed yet.
@KalitaAlexey
Copy link
Member Author

The next step is to ask a user to install Rustup and to install if the user agrees.
I will make it in another pull request.
Everything works as I planned.

@KalitaAlexey
Copy link
Member Author

I ask you to check it.

@pronebird
Copy link

pronebird commented Apr 20, 2017 via email

@KalitaAlexey
Copy link
Member Author

Another next step is to check if a user use stable toolchain and to run RLS using nightly toolchain.
It will be another PR.

@pronebird
Copy link

@KalitaAlexey I think rustup takes care of that already.

@KalitaAlexey
Copy link
Member Author

@pronebird,
I didn't try it, if it does, that's cool)

@KalitaAlexey
Copy link
Member Author

A note for:
I must add information about it to the PR

@KalitaAlexey
Copy link
Member Author

@redactedscribe,
I need you to review this PR.
Probably some messages can be improved.

@pronebird
Copy link

I did rustup component remove rls then restarted VSCode with plugin built off this PR. It asked me to install RLS then update rustup. After update RLS has been installed without any problems.

$ rustup component list | grep rls               
rls-x86_64-apple-darwin (installed)

Debug output seems to be correct:

DEBUG: Configuration: Rustup: updatePathToRlsExecutable: RLS is not installed
DEBUG: askForInstallingRlsViaRustup: A user decided to install RLS
DEBUG: handleUserDecisionToInstallRls: A user agreed to update rustup
DEBUG: handleUserDecisionToInstallRls: Rustup has updated successfully
DEBUG: handleUserDecisionToInstallRls: Rustup can install RLS
DEBUG: Configuration: Rustup: updatePathToRlsExecutable: RLS is installed. Path=/Users/pronebird/.cargo/bin/rls
DEBUG: runInRlsMode: env={"RUST_SRC_PATH":"/Users/pronebird/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/"}
DEBUG: runInRlsMode: args=undefined
DEBUG: runInRlsMode: revealOutputChannelOn=4
DEBUG: Language Client Manager: start
DEBUG: Language Client Manager: stop
DEBUG: Language Client Manager: start
DEBUG: Language Client Manager: stop
DEBUG: Language Client Manager: start

@KalitaAlexey
Copy link
Member Author

@pronebird,
Did RLS work?

@pronebird
Copy link

pronebird commented Apr 21, 2017 via email

@KalitaAlexey
Copy link
Member Author

@pronebird,
That's nice.

@KalitaAlexey
Copy link
Member Author

KalitaAlexey commented Apr 22, 2017

@pronebird,
rustup does not run RLS when a default toolchain is stable.
rust-lang/rustup#1083

@KalitaAlexey KalitaAlexey merged commit c5c7d2f into master Apr 22, 2017
@KalitaAlexey KalitaAlexey deleted the add-installing-rls branch April 22, 2017 07:57
@pronebird
Copy link

@KalitaAlexey yeah that's not cool :/

@pvaibhav
Copy link

Thanks for your work. But merging this PR has caused 2 major issues for me:

  1. Every single time I opened VScode I got a message asking me to install RLS because it provides a better user experience. But clicking install asked me to update rustup, clicking update did nothing. This was with stable toolchain (as I guess most users are on).

  2. After I installed nightly toolchain and then rls, every time I start VScode now I get this message: "error: toolchain 'stable-x86_64-apple-darwin' does not have the binary rls"

And none of the completion etc. (that was previously working fine with racer) works anymore.

Was this tested well before release?

What can I do to get rid of the popup after I've removed rls and switched back to stable?

Thanks.

@KalitaAlexey
Copy link
Member Author

@pvaibhav,
For your case you can use "forceLegacyMode".
Your case is described in #187

@pvaibhav
Copy link

pvaibhav commented May 1, 2017

Thanks, that brought back the old functionality. Any idea why the new RLS mode doesn't work even after installing rls and switching to nightly?

@KalitaAlexey
Copy link
Member Author

@pvaibhav,
It must work.
Open a new issue and attach what the output channel "Rust Logging" shows. Also attach what the output channel "Rust Language Server" shows.

@pvaibhav
Copy link

pvaibhav commented May 12, 2017

@KalitaAlexey sorry for replying late. I managed to get the plugin to try starting in RLS mode after unsetting stable and setting nightly as default. But now I get another error. Logs are below:

Attached the output of "Rust Logging":

DEBUG: Configuration: Rustup: create: sysroot=/Users/pvaibhav/.rustup/toolchains/nightly-x86_64-apple-darwin
DEBUG: Configuration: Rustup: updateComponents: this.components=["cargo-x86_64-apple-darwin (default)","rls-x86_64-apple-darwin (installed)","rust-analysis-x86_64-apple-darwin (installed)","rust-docs-x86_64-apple-darwin (default)","rust-src (installed)","rust-std-aarch64-apple-ios","rust-std-aarch64-linux-android","rust-std-aarch64-unknown-fuchsia","rust-std-aarch64-unknown-linux-gnu","rust-std-arm-linux-androideabi","rust-std-arm-unknown-linux-gnueabi","rust-std-arm-unknown-linux-gnueabihf","rust-std-arm-unknown-linux-musleabi","rust-std-arm-unknown-linux-musleabihf","rust-std-armv7-apple-ios","rust-std-armv7-linux-androideabi","rust-std-armv7-unknown-linux-gnueabihf","rust-std-armv7-unknown-linux-musleabihf","rust-std-armv7s-apple-ios","rust-std-asmjs-unknown-emscripten","rust-std-i386-apple-ios","rust-std-i586-pc-windows-msvc","rust-std-i586-unknown-linux-gnu","rust-std-i686-apple-darwin","rust-std-i686-linux-android","rust-std-i686-pc-windows-gnu","rust-std-i686-pc-windows-msvc","rust-std-i686-unknown-freebsd","rust-std-i686-unknown-linux-gnu","rust-std-i686-unknown-linux-musl","rust-std-mips-unknown-linux-gnu","rust-std-mips-unknown-linux-musl","rust-std-mips64-unknown-linux-gnuabi64","rust-std-mips64el-unknown-linux-gnuabi64","rust-std-mipsel-unknown-linux-gnu","rust-std-mipsel-unknown-linux-musl","rust-std-powerpc-unknown-linux-gnu","rust-std-powerpc64-unknown-linux-gnu","rust-std-powerpc64le-unknown-linux-gnu","rust-std-s390x-unknown-linux-gnu","rust-std-sparc64-unknown-linux-gnu","rust-std-wasm32-unknown-emscripten","rust-std-x86_64-apple-darwin (default)","rust-std-x86_64-apple-ios","rust-std-x86_64-linux-android","rust-std-x86_64-pc-windows-gnu","rust-std-x86_64-pc-windows-msvc","rust-std-x86_64-rumprun-netbsd","rust-std-x86_64-unknown-freebsd","rust-std-x86_64-unknown-fuchsia","rust-std-x86_64-unknown-linux-gnu","rust-std-x86_64-unknown-linux-musl","rust-std-x86_64-unknown-netbsd","rustc-x86_64-apple-darwin (default)",""]
DEBUG: Configuration: Rustup: updatePathToRlsExecutable: rlsInstalled=true
DEBUG: Configuration: Rustup: updatePathToRlsExecutable: rlsPath=/Users/pvaibhav/.cargo/bin/rls
DEBUG: runInRlsMode: rlsPath=/Users/pvaibhav/.cargo/bin/rls
DEBUG: runInRlsMode: env={"RUST_SRC_PATH":"/Users/pvaibhav/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src"}
DEBUG: runInRlsMode: args=[]
DEBUG: runInRlsMode: revealOutputChannelOn=3
DEBUG: Language Client Manager: start

And of "Rust Language Server":

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorImpl { code: Message("missing field `experimental`"), line: 0, column: 0 }', src/libcore/result.rs:859
note: Run with `RUST_BACKTRACE=1` for a backtrace.
[Error - 11:50:14 PM] Connection to server got closed. Server will not be restarted.

How should I run the plugin with RUST_BACKTRACE=1 ?

@KalitaAlexey
Copy link
Member Author

Now you experience #229.

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

Successfully merging this pull request may close these issues.

3 participants