rust-lang / rust-lang/rust-analyzer

Enable an offline mode that passes `--offline` to cargo

Open
#15,146 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-cargo C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how rust-analyzer exposes menu options and launches cargo commands. Determine where running operations can be cancelled or relaunched, then implement enable and disable offline actions that apply or remove --offline. Done means the mode is visible and toggleable, active operations follow the requested behavior, and cargo commands run without network access when enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.