rust-lang / rust-lang/rust-analyzer

[VSCode client] Extension appears to be ignoring workspace-level `runBuildScripts` setting

Open
#10,779 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-config A-vscode C-bug S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Repro
  1. Create or git clone a Rust project which includes a build script (I'm currently seeing the issue in rust-skia)
  2. (optional) For easier identification of the issue, force a build script to fail by explicitly panicing
  3. In VSCode > Settings > User tab, ensure the setting Rust-analyzer > Cargo: Run Build Scripts is enabled
  4. Create a new file in the test workspace at .vscode/settings.json with the following content:
    {
      "rust-analyzer.cargo.runBuildScripts": false,
      "rust-analyzer.procMacro.enable": false
    }
    
  5. If necessary, run cargo clean at the workspace root and re-open VS Code with the RA extension enabled
Actual Behavior
  • The rust-analyzer indicator in the status bar eventually displays a "Warning" icon
  • View > Output > Rust Analyzer Language Server displays something like the following output:
    [ERROR rust_analyzer::reload] failed to switch build data: rust-analyzer failed to run build scripts:
    ...
    
Expected

Rust Analyzer extension should respect the workspace-level cargo.runBuildScripts setting and forgo executing build scripts if the option is disabled.

Notes

Please let me know if there's something I'm missing / some other explanation for the behavior I'm seeing.

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 issue in a VS Code workspace using the reported Rust project setup, enabling the user setting and disabling rust-analyzer.cargo.runBuildScripts in .vscode/settings.json. Trace how the VS Code client reads workspace configuration and verify that the workspace value is applied; done means build scripts are not executed and the Rust Analyzer output no longer reports their failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.