Add minimal support for cargo scripts#15456
Closed
HKalbasi wants to merge 1 commit intorust-lang:masterfrom
Closed
Add minimal support for cargo scripts#15456HKalbasi wants to merge 1 commit intorust-lang:masterfrom
HKalbasi wants to merge 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
☔ The latest upstream changes (presumably #15574) made this pull request unmergeable. Please resolve the merge conflicts. |
Merged
Member
|
Updated the implementation building on this in a new PR #17110 |
bors
added a commit
that referenced
this pull request
Apr 19, 2024
Cargo script mvp Based on #15456, As the original PR stated, detached files are still horrendous to work with.
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Apr 20, 2024
Cargo script mvp Based on rust-lang/rust-analyzer#15456, As the original PR stated, detached files are still horrendous to work with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.rson 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 metadatato work) it reads the file, checks if the//! cargo.tomlpart of the script is changed, and if so it will reload the workspace and runcargo metadataagain. I think this part works good enough, but not detecting the cargo scripts inside normal projects is definitely not good.