Add minimal support for cargo scripts #15456
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR runs
cargo metadata -Zscript --manifest-path=file.rs
on files opened as detached file, and then r-a will magically detect dependencies.It doesn't touch anything in the salsa area. So, detached files need to be opened in a separate window and they are as bad as they were (no progress on #14318), and on each save operation (it needs to be on disk for
cargo metadata
to work) it reads the file, checks if the//! cargo.toml
part of the script is changed, and if so it will reload the workspace and runcargo metadata
again. I think this part works good enough, but not detecting the cargo scripts inside normal projects is definitely not good.