FetchBuildDataError in some default vscode installs
rfulwell opened this issue · 1 comments
I did my best to faithfully follow defaults to install Rust and Rust Analyzer for WSL/Linux:
https://www.rust-lang.org/learn/get-started
https://code.visualstudio.com/docs/languages/rust
When launched on Debian 11 and Ubuntu 22.04 running in WSL2 I got the following error from the server:
[ERROR rust_analyzer::main_loop] FetchBuildDataError:
Failed to run build scripts for /workspaces/rust-analyzer-repro: No such file or directory (os error 2)
I prepared a dev container with a minimal set of files which reproduces the issue if you are set up to run remote containers:
https://github.com/rfulwell/rust-analyzer-repro
Steps to reproduce:
git pull https://github.com/rfulwell/rust-analyzer-reprocd rust-analyzer-repro; code .- When prompted, reopen the project in a dev container
- Open the
src/main.rsfile and pause while the server processes the file - Note the error as above and the status bar message with popup:

The most simplified way I was able to find in order to work around the issue is to override three default settings. You can reproduce this by uncommenting the lines in the devcontainer.json file yourself or reverting the last commit in the repo.
So to reproduce the workaround, uncomment these lines and rebuild the dev container:
// "rust-analyzer.cargo.buildScripts.enable": false,
// "rust-analyzer.procMacro.attributes.enable": false,
// "rust-analyzer.procMacro.enable": false
This does not seem to be a blocking issue for the extension but I don't like working with persistent errors in my environment so here we are. 😅
Is this still happening? Please file an issue against https://github.com/rust-lang/rust-analyzer, that's the right repository.