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

Not warning about the lack of rust-analyzer #15

Open
Seven0492 opened this issue Dec 7, 2022 · 9 comments
Open

Not warning about the lack of rust-analyzer #15

Seven0492 opened this issue Dec 7, 2022 · 9 comments

Comments

@Seven0492
Copy link

Seven0492 commented Dec 7, 2022

Lapce Version

0.2.4

System information

Arch Linux kernel version: 5.15.81-1-lts

Describe the bug

Autosuggestion not working when dealing with some crates (In Rust)

Syntax highlighting just not showing in some cases

The problem?

I fixed it, it was that rust-analyzer was not installed.

The problem with that?

I only found out when I was trying to switch to Helix,
and had to install rust-analyzer via rustup and do a symlink to a directory in PATH from the analyzer binary.

What I suggest?

Adding a prompt warning about the lack of rust-analyzer like other mainstream IDE's instead of just being silently faulty.

Or even installing it automatically.

I had no idea what was wrong with the Rust plugin, I thought the 'sub-par' (Used lightly) performance of its highlighting was 'normal', until I added the missing part by accident and made it work like a champ!

I can now use Lapce coding in Rust without reservation and have had a fantastic experience so far, keep it up!
This is a wonderful project that was badly needed (The Rust plugin was needed too :P).

I just want other people coming to Lapce for a good Rust environment not be discouraged by its problem when it lacks rust-analyzer.

I made this issue since I think this is something that should me made aware to the user.

@Seven0492
Copy link
Author

Duplicate of lapce/lapce #1763

@bobajeff
Copy link

I was wondering why code completion didn't seem to do anything.
As stated above install rust-analyzer via rustup and create a symlink to ~/.cargo/bin fixed it:

rustup component add rust-analyzer
rustup which --toolchain stable rust-analyzer
cd ~/.cargo/bin
ln -s <PATH TO RUSTUP'S RUST-ANALYZER> rust-analyzer

@Seven0492
Copy link
Author

Seven0492 commented Dec 13, 2022

Oh, and to find the location of rust-analyzer without too much hassle:

# Prints the absolute path to the rust-analyzer binary
rustup which rust-analyzer

So, the new command to make a symlink to the binary would be:

ln -s $(rustup which rust-analyzer) ~/.cargo/bin/rust-analyzer

@MinusGix
Copy link
Member

MinusGix commented Dec 14, 2022

Typically the Rust extension installs RA itself, but the download can fail (faulty internet connection, or it being blocked). Typically, uninstalling then reinstalling the plugin would fix the issue for a faulty connection. It should alert the user if it fails, though.

@Seven0492
Copy link
Author

Seven0492 commented Dec 14, 2022

Hm, weird then, anyway, its fixed now with a simple solution, this issue will be available for anyone to mention if they had any other, similar problems, and how they solved it.

Not sure if I should close this issue, though.

@bobajeff
Copy link

I'm not sure where it failed. When I noticed it not working the first thing I did was open the folder where the extension is installed. In there I saw there was already a binary of rust-analyser; so I would assume it was meant to use that one. However, it clearly wasn't as things only started working after installing my own via rust-up and symlinking.

@Seven0492
Copy link
Author

Seven0492 commented Dec 14, 2022

I hadn't gone that far, but it is weird indeed, maybe the rust-analyzer version packaged with the extension is out of date?

This is the only reason I could think off which would generate this disconnect.

And even then, why would it silently fail? Question to ponder on, I guess.

@Erutuon
Copy link

Erutuon commented Feb 1, 2023

I'm trying to use the Rust extension in Lapce on Windows. I had an old version from March 2022 and recently updated to Nightly (a93ffe0). The Rust extension sort of worked in the old Lapce version, but showed an empty tab with the name of the appropriate rust file when I did "Go to definition" on a symbol from an imported crate or from the same file. In nightly Lapce the extension is enabled but "Go to definition" does nothing. No error messages. I did rustup component add rust-analyzer and plugged the path to stable rust-analyzer.exe into "Server Path" in the Rust extension settings as recommended on lapce/lapce.docs#1 and no change. There is also a downloaded rust-analyzer in the extension folder. (No .exe but the file command on WSL says it's a PE32+ executable.) There are 0 warnings and errors in the left bottom corner; is there another place to see error messages from the extension?

Sorry, this may not be the right place to post this, as it doesn't seem to be about missing rust-analyzer.

@Occuros
Copy link

Occuros commented Sep 25, 2023

I currently have the same issue on Windows, without specifying a path I get proc macro losing failed errors (unsupported metadata version 7).

If I define a path in the plugin settings, I get server path "~.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\rust-analyzer.exe", could not be found.

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

5 participants