nova-rust
nova-rust copied to clipboard
[BUG] `target/` gets flushed when a background syntax check is running (on save)
Describe the bug
Whenever I save a Rust file from Nova, nova-rust
performs a background check of the syntax and errors, which works perfectly fine. However, whenever this runs, I lose my target/
cache from the previous build in my terminal (manual build using eg. cargo build
), which makes the next build slow.
Also, when the background syntax check operation runs, and is still running while I attempt to call: cargo build
in my terminal, I also see:
Blocking waiting for file lock on build directory
This shows that something is sharing the same target/
directory in my local project, and I'm not sure this used to happen in the previous nova-rust
versions.
My options are as follow in the screenshot:
To Reproduce
- Build your Rust project using
cargo build
- Re-build your Rust project using
cargo build
(thetarget/
cache is used) - Change a file, save it in Nova
- Try running
cargo build
(slow!), the cache was purged by the extension
Expected behavior
My target/
build cache would stay populated, and I wouldnt have to compete w/ another build lockfile.
Versions (please complete the following information):
- macOS: 12.4
- Processor: Apple Silicon
- Nova 9.3
- Extension Version 2.1.0
- Rustc version
rustc 1.60.0 (7737e0b5c 2022-04-04)
Rust Analyzer uses Cargo for issue checks on save (cargo check
or cargo clippy
depending on the preference you set as shown above), which is why your target
directory is being shared.
Your best bet to prevent sharing is probably to add --target-dir ./target-check
to the Additional Arguments preference in the Issues section (see your screenshot above). You can of course use whatever directory name suits you, but you'd need to add it to your .gitignore
. I'll note that you can set this preference per-project if it doesn't make sense as a global preference. (Project -> Project Settings... -> Rust extension)
Thank you, this worked perfect to fix the issue!
In terms of developer UX, I'd advise adding this to the README, or maybe even auto-configuring the default --target-dir
to be some temporary folder owned by Nova (possibly w/ a permanent cache), outside of the Rust project. Even if I know the standard Rust tools share the target/
folder between commands, something definitely collides here.