rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Add minimal support for cargo scripts

Open HKalbasi opened this issue 1 year ago • 1 comments

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 run cargo metadata again. I think this part works good enough, but not detecting the cargo scripts inside normal projects is definitely not good.

HKalbasi avatar Aug 13 '23 22:08 HKalbasi

:umbrella: The latest upstream changes (presumably #15574) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 08 '23 07:09 bors

Updated the implementation building on this in a new PR https://github.com/rust-lang/rust-analyzer/pull/17110

Veykril avatar Apr 19 '24 12:04 Veykril