rust-lang / rust-lang/rust-analyzer

Rust-analyzer in VSCode seems to initiate the LSP check too soon when using a devcontainer.

Open
#16,837 21 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

Using a devcontainer with nix to get a stable environment to do rust development on. As a postCreateCommand I am using nix-env -i rustup && rustup default stable (yes, not entirely deterministic but that's not what it is about). This is the first hook after the development container is run. The next being postStartCommand which should run after the container has started and postAttachCommand which should run after VSCode has attached to the container and has a shell. However the rust-analyzer plugin tries to run cargo even before the container has started. Not sure if this is something that can be or you would like to address. Perhaps you'd advise me to approach this differently.

Kind regards,

Dirk Louwers

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

Reproduce the startup sequence using a devcontainer with the listed postCreateCommand, postStartCommand, and postAttachCommand hooks, then trace when the VSCode rust-analyzer extension first invokes cargo. Done means rust-analyzer does not start its LSP check before the container is ready and attached.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.