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

Enable an offline mode that passes --offline to cargo #15146

Open
tgross35 opened this issue Jun 27, 2023 · 3 comments
Open

Enable an offline mode that passes --offline to cargo #15146

tgross35 opened this issue Jun 27, 2023 · 3 comments
Labels
A-cargo cargo related issues C-feature Category: feature request

Comments

@tgross35
Copy link
Contributor

tgross35 commented Jun 27, 2023

When working in slow or no internet situations, RA seems to lock the registry/workspace trying to do internet things. It can be tricky to cancel these operations.

My suggestion is to add a new offline mode that can be toggled via the menu. This can either set the environment variable (CARGO_NET_OFFLINE=true) or pass --offline to each cargo command (I'd prefer this so it's easy to tell the mode is being used). This would be two new menu options:

  • "rust-analyzer: Enable offline mode": cancel any running operations, set the flag, and relaunch anything in progress
  • "rust-analyzer: Disable offline mode": allow running operations to complete, remove --offline flag
@tgross35 tgross35 added the C-feature Category: feature request label Jun 27, 2023
@tgross35
Copy link
Contributor Author

Related, #12499

@lowr lowr added the A-cargo cargo related issues label Jun 28, 2023
@clouds56
Copy link

As related, I tried to add --offline in settings,
Image
but it seems not have any effect on cargo metadata

$ ps -ef |grep cargo
  501 82674 79393   0 10:58AM ??         0:00.97 ~/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo metadata --format-version 1 --manifest-path /path/to/Cargo.toml --filter-platform aarch64-apple-darwin
  501 82909 74547   0 10:58AM ttys027    0:00.00 grep --color=auto cargo

@Veykril
Copy link
Member

Veykril commented Sep 24, 2024

cargo metadata is not configurable by r-a currently. Also see #12499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo cargo related issues C-feature Category: feature request
Projects
None yet
Development

No branches or pull requests

4 participants