ZoeyR / rls-vs2017

Rust extension for Visual Studio 2017 with RLS support
MIT License
110 stars 12 forks source link

Extension not starting #7

Closed PvdBerg1998 closed 5 years ago

PvdBerg1998 commented 6 years ago

I've installed the two extensions into the latest VS preview, then opened a rust project. I've also tried manually installing the RLS (currently only available via the beta channel).

The extension will start when you open a Rust file. You'll be prompted to install the RLS. Once installed, the RLS should start building your project.

.. but it doesn't.

ZoeyR commented 6 years ago

Do you at least get the prompts to install the RLS? If you do and the RLS doesn't install then the extension is at least starting. If you do get those prompts then it sounds like the problem is that the RLS is currently unavailable on nightly. If you wish to use a different toolchain with this extension you need to set that option in Tools > Options > Rust.

Edit: I just tested this myself and it would seem that the issue is the fact that rls-preview is unavailable in the current nightly. For now you can use the option i described above to set the extension to use a different toolchain. I would recommend nightly-2017-12-08 since that is more feature complete than the beta.

I can do more work on my end to surface the actual error to the end user. Right now the extension just silently exits when it encounters an error installing the components.

PvdBerg1998 commented 6 years ago

I've set the extension to use the beta channel. Any idea why it still exits?

ZoeyR commented 6 years ago

So just to confirm,

After this the extension still exits, is that correct? If so, try restarting VS first and making sure the setting stuck since I am unable to reproduce on any of my systems.

ZoeyR commented 6 years ago

A few more questions:

PvdBerg1998 commented 6 years ago
ZoeyR commented 6 years ago

If the components are already installed my extension won't pop up any notifications. It's main job is to launch the rls process and pass that on to the LSP extension. You can try looking in task manager to see if there is an rls.exe process running (If you are on windows 10 you may need to expand the process tree for visual studio). Tonight I'll add some logging to the extension and send out an update. I'll update this issue with instructions on how to read the logs once the update is out.

It is also possible that the RLS is crashing on your project. If you are working with a particularly large project create a new library via cargo and see what happens then.

PvdBerg1998 commented 6 years ago

Was using a helloworld project so that shouldn't be the problem. The process is not being started though.

ZoeyR commented 6 years ago

Its ugly, but I've attached a debug version of the extension RustLanguageExtension.zip unzip that and install the .vsix file. You should now get a lot of infobars when you open a rust file. Please tell me which ones you see and which is the last one.

PvdBerg1998 commented 6 years ago

Could you push the changes (to a separate branch)? I'm trying to build the extension myself.

ZoeyR commented 6 years ago

I could, I just figured that just providing a vsix was simpler than having you build the extension. Allthough if you build it yourself you can debug the OnLoadedAsync method to see whats going on.

ZoeyR commented 6 years ago

branch https://github.com/dgriffen/rls-vs2017/tree/super-infobar-debug has the changes

PvdBerg1998 commented 6 years ago

I only see "extension has begun launching" (or something similar) pop up 🤔

ZoeyR commented 6 years ago

I assume you pressed continue? Well that means that it is detecting all the components as installed, but it still isn't starting. This was something I didn't predict, let me add a few more info bars.

PvdBerg1998 commented 6 years ago

I'm trying to debug the extension but it says: "the breakpoint will currently not be hit, no symbols have been loaded for this document". Edit: that seems to be the case, yes.

ZoeyR commented 6 years ago

It won't bind until you actually load the extension via opening a rust file.

ZoeyR commented 6 years ago

here is another file with even more info bars, I also pushed the changes to the super-infobar-debug branch if you'd prefer to build it.

PvdBerg1998 commented 6 years ago

It seems I can't debug further than the Rustup.HasToolchain call, but I'm not experienced with debugging c# vs extensions. I can build it though, you don't need to bother uploading packages :)

PvdBerg1998 commented 6 years ago

Still only the first popup. Trying a popup at the end of OnLoadedAsync

ZoeyR commented 6 years ago

Can you try debugging into HasToolchain? I think the problem might be an await command that is never exiting, since you couldn't debug past it.

PvdBerg1998 commented 6 years ago

That's what I'm thinking as well. I'm never getting past the await. The command should be working though.

PvdBerg1998 commented 6 years ago

RunCommand isn't even reached. Edit: might it be a permission problem?

ZoeyR commented 6 years ago

You are pressing continue on the infobars right? cause those block execution. If so, wat. The only call that could be blocking between the first infobar and RunCommand would be OptionsModel.Toolchain.

PvdBerg1998 commented 6 years ago

I am. Maybe VS's await debugger is broken in the preview? It generates a state machine so I could understand if debugging such a thing would break. I'll try adding print statements somewhere in between.

ZoeyR commented 6 years ago

The await debugger is pretty rock solid, I haven't had issues with it when I'm debugging. There must be something really screwy going on. I'm guessing something is redirecting a dll my extension uses. (Either via GAC or a binding redirect). You could try removing the () tuples from Rustup.rs and replacing them with the Tuple class.

PvdBerg1998 commented 6 years ago
on loaded sync entered
got toolchain, awaiting rustup.hastoolchain
Exception thrown: 'System.IO.FileNotFoundException' in RustLanguageExtension.dll
ZoeyR commented 6 years ago

Do you not have rustup on your path?

PvdBerg1998 commented 6 years ago
C:\Windows\System32>rustup --version
rustup 1.7.0 (813f7b7a8 2017-10-30)
PvdBerg1998 commented 6 years ago

NB I've added a debug println inside HasToolchain and that didn't print anything - so maybe the Rustup.cs didn't get compiled?

ZoeyR commented 6 years ago

Rustup.cs must get compiled, you'd have much different errors if it wasn't included in the output binary. How is your rustup path set? It looks like you were running cmd.exe as admin since it doesn't default to the system32 directory otherwise. Perharps its only on the admin path?

PvdBerg1998 commented 6 years ago

My rustup path is set in my user path, and my user cmd defaults to sys32 for some reason. I've pushed my extra prints if you need them https://github.com/PvdBerg1998/rls-vs2017/commit/9b5c689f7615fd18368ea02cdee1b555fadba70d . Edit: I'm off for today, it's 12:34AM here. Good luck 👍

ZoeyR commented 6 years ago

Did that FileNotFoundException have a stack trace or anything? Because at this point my guess is that you are missing some dll on the system. Since its happening when you hit Rustup.rs it could be System.ValueTuple, which is meant to be shipped with VS. Since I can't repro on your system I pushed an update to the infobar branch that remove the valuetuples.

PvdBerg1998 commented 6 years ago

This fixes the problem. (And it didn't have a stack trace btw.)

I do get a lot of System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=IconAutomationText; DataItem='CompletionView' (HashCode=16558849); target element is 'CrispImage' (Name=''); target property is 'Name' (type 'String') spam though, but that might be a different issue.

ZoeyR commented 6 years ago

System.ValueTuple really should be included with a VS installation, it sounds like yours got corrupted somehow. Try repairing it to see if that fixes it.

DustinByfuglien commented 6 years ago

Hello. I install LSP, extension but nothing happens when I open rust file. No error or other messages is provided. I'm confused...

Win7x64

ZoeyR commented 6 years ago

Did you open an individual file or an entire folder? The RLS and the LSP extension don't work with individual files.

DustinByfuglien commented 6 years ago

I open a folder. Than open a main.rs file in src subfdolder.

ZoeyR commented 6 years ago

Hopefully its not a Win7 specific issue as I don't have any machine to test that with. It may be the same issue as PvdBerg so repairing your VS installation may be the way to go. I could remove ValueTuple to get it working for you immediately but your VS install would still be unstable since ValueTuple is used throughout VS.

DustinByfuglien commented 6 years ago

After VS repairing and opening prjoect folder a toolbar with rls Install button appears. But after clicking on it a error rises in that tab:

could not install one of the required rls components

ZoeyR commented 6 years ago

That will likely be an issue with the RLS not being available in the current nightly. It's been a major issue lately and is quite annoying. You can select your toolchain in the Tools>Options>Rust menu

DustinByfuglien commented 6 years ago

Thanks. I'll wait a while with nightly.

KiillThemAll commented 6 years ago

Hello! Have this issue, only see "extension has begun launching" Tryed to repair VS - useless Have any advices?

ZoeyR commented 6 years ago

What do you mean by seeing "extension has begun launching"? That's not a prompt that VS would normally display to you.

KiillThemAll commented 6 years ago

Tryed your extension with more info bars. RLS manually installed Windows 10

ZoeyR commented 6 years ago

Yeah, sounds like the System.ValueTuple issue again. I'll talk to people within VS to figure out what could be going on. VS includes System.ValueTuple so there should be no issue using it. Sorry for the inconvenience. If I'm not able to figure out the issue by the end of the week I'll just remove tuple stuff.

ZoeyR commented 6 years ago

Additionally, can you verify that the rest of VS is stable for you? It would help narrow down if this is a systemic VS install issue or something with my extension specifically.

KiillThemAll commented 6 years ago

Mooving back to Intellij rust)

Havent seen any problems yet with VS, but usually work in Qt Creator, therefore its hard to say. unfortunately, there isnt appropriate plugins for creator( everythings abandoned

illera88 commented 6 years ago

Hi,

I'm having problems too. I followed the installation steps and everything went smooth. I have VS2107 Professional Preview on a Windows 10. I've created a hello.rs file at C:\test and opened C:\test folder in VS.

file content:

fn main() {
    println!("Hello World!");
}

I've installed rustup install nightly-x86_64-pc-windows-msvc.

rustup.exe --version
rustup 1.9.0 (57fc3c087 2018-01-04)
rustup.exe show
Default host: x86_64-pc-windows-msvc

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.23.0 (766bd11c8 2018-01-01)

I've set rustup in VS config:

2018-01-14 13_16_10-options

I've tried changing nightly for stable but don't see anything compiled when I open the hello.rs file.

What other info can I provide so we can debug the problem?

Cheers

ZoeyR commented 6 years ago

First verify that the rls is included in your current nightly build. You can check this with rustup component list --toolchain nightly. If you see rls-preview then the rls was included. If not I recommend setting your toolchain to nightly-2017-12-08. Also not that setting the path to rustup isn't necessary if rustup is already on your path.

Once you have that done please tell me which messages you see at the top when you open a .rs file. You should see messages to install the toolchain and install the rls components. If you don't see either of these make sure you opened a cargo project folder with the VS open folder feature.

If you still don't see any operation then I have to conclude that System.ValueTuple is broken for you as well. Which is completely ridiculous that this keeps happening since the language server extension also relies on it.

illera88 commented 6 years ago

Hi,

First of all thank you for your help. RLS is installed:

C:\Users\default3\Documents\code\daemon-rs>rustup component list --toolchain nightly
cargo-x86_64-pc-windows-msvc (default)
rls-preview-x86_64-pc-windows-msvc (installed)
rust-analysis-x86_64-pc-windows-msvc (installed)
rust-docs-x86_64-pc-windows-msvc (default)
rust-src (installed)
rust-std-aarch64-apple-ios

I've done this steps now: cargo new --bin "test-test" and from VS2017 Preview File -> Open Folder and select the test file that has the Cargo.toml and src folder with the main.rs file. But nothing happens when I open the .rs file :(

What other info do you need?

Cheers

illera88 commented 6 years ago

Btw the first time that I opened a project it did showed something that I pressed "Install" but I don't see that anymore.

EDIT: I've repaired the VS 2017 preview installation but I'm still facing the same problem.