vscode-rust
vscode-rust copied to clipboard
Multiroot workspaces support
Version of VSCode: Version 1.16.0-insider Version of the extension: 0.4.2 OS: MacOS Sierra 10.12.6
Description: New version of vscode is going to add support for workspaces with multiple root directories. Currently RLS mode starts only for the first project of such workspace. All the rest are simply ignored. https://code.visualstudio.com/updates/v1_15#_new-api-for-multiroot-workspaces
Output of the "Rust logging" channel:
DEBUG: Rustup: updateToolchains: this.toolchains=[{"channel":"stable","host":"x86_64-apple-darwin","isDefault":true},{"channel":"nightly","host":"x86_64-apple-darwin","isDefault":false}]
DEBUG: activate: processPossibleSetButMissingUserToolchain: toolchainKind=toolchain
DEBUG: activate: processPossibleSetButMissingUserToolchain: user toolchain is installed
DEBUG: Rustup: updateComponents(nightly-x86_64-apple-darwin): 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: RlsMode: start: enter
DEBUG: RlsMode: start: no RLS executable
DEBUG: RlsMode: start: processPossibleSetButMissingUserToolchain: toolchainKind=nightly toolchain
DEBUG: RlsMode: start: processPossibleSetButMissingUserToolchain: user nightly toolchain is installed
DEBUG: RlsMode: processPossiblyMissingRlsComponents: RLS is installed
DEBUG: RlsMode: processPossiblyMissingRlsComponents: rust-analysis is installed
DEBUG: RlsMode: start: User decided to use rustfmt
DEBUG: RlsMode: start: rlsPath=rustup
DEBUG: RlsMode: start: env={"RUST_SRC_PATH":"/Users/frizi/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src"}
DEBUG: RlsMode: start: args=["run","nightly-x86_64-apple-darwin","rls"]
DEBUG: RlsMode: start: revealOutputChannelOn=3
DEBUG: RlsMode: start: Language Client Manager: start
Hey guys, What do you expect?
Do you expect that a separate instance of RLS will be running for each workspace? Or do you expect that the RLS will be switched to another workspace?
To be honest i haven't really looked too much how it works and it's hard to judge. I can tell how I would expect it to work from user point of view.
Whenever I'm editing a specific file in one of the projects or have multiple of them open side by side, every one of them should show me the errors as I type and when those arise. This is how it currently works with single project setup. With the difference that every file could be in different crate.
I think I have a draft implementation (forked this repo) where I start a separate server per workspace folder.
It currently lacks the callbacks for when adding/removing a folder to/from the workspace but that's easy to add. I'll do so this week.
From basic tests I did (checking autocomplete and for errors) I didn't see anything wrong.
If you are interested I'll update my progress here.
I was a bit hasty reporting what I have implemented above. Auto-completion works but changing the logic of the command subscriptions needs quite a bit of refactoring. I'll see if I can come up with a clean solution and if yes, I'll make a PR for your guys to check if you want.
I've opted for a far simpler approach than my initial one and I have a PR at #355.
Any feedback would be much appreciated.