-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RA does not work at all when offline #12499
Comments
Does it work if you add |
That only changes the error message to
|
Hmm, I would think that if the local cache has all the crates in them it should work fine... |
This might be related to rust-lang/cargo#10096, where I see two orthogonal issues here:
|
Without Cargo metadata, RA doesn't have a project and basically can't do anything. Sure, in theory it could blindly run check to report errors, but 1) check-on-save is really a bolted-on-top workaround to the fact that RA doesn't have most diagnostics built-in yet, so we don't really want to make fundamental changes to the architecture based on it, and 2) I think in most cases, if |
Should there be an |
That's not only "I'm on an airplane" case, but also "I work in airgapped environment and would like to use Rust". We do build docker image with all cargo dependencies on a networked host and then move it inside environment without network access. I believe analyzer worked ok about 9 months ago, but we could have used older RA back then too. |
I think the issue is that when |
Note that even |
right, it only works if things are in the cargo cache before the internet access is removed. Have you tried setting the env var |
FWIW, I ran into this yesterday on an airplane as well. I managed to work around this in the following way:
(Separately, editing dependencies required some manual dexterity, but that's more of a Cargo issue.) In my mind the ideal solution here would be that RA uses some connectivity canary (like a trivial DNS request to Google or Cloudflare DNS servers) to assess whether it should try applying |
If we do (#15146), it should be disabled by default, because everyone will go up in arms about it ("rust-analyzer is sending your personal information to Cloudflare!"). |
Well, I'm fine with a HTTP request to |
Realized there is a |
feat: Make rust-analyzer work partially when offline Helps out with #12499 a bit
feat: Make rust-analyzer work partially when offline Helps out with rust-lang/rust-analyzer#12499 a bit
I tried to do a bit of coding on rustc while on a plane without internet, and noticed that RA handles this situation quite badly.
cargo metadata
fails because it cannot refresh the index, and then basically nothing works, even though everything needed should be available offline. In particular, not even "check on save" does anything -- I had to run./x.py check
by hand. That worked perfectly fine, demonstrating that RA could also have runx.py
as usual and show the diagnostics in the editor.rust-analyzer version: ad6810e 2022-06-06 stable
rustc version: rustc 1.63.0-nightly (e09449220 2022-05-31)
relevant settings:
The text was updated successfully, but these errors were encountered: