axum icon indicating copy to clipboard operation
axum copied to clipboard

Re-integrate examples into the root workspace

Open jplatte opened this issue 3 years ago • 2 comments

Motivation

Currently, when working on axum (with VSCode), you don't get in-editor errors when working on examples. This was caused by #978 moving examples into their own workspace to make development of axum easier, but I've found the opposite to be true.

Solution

Re-integrate the examples into the workspace, this time also setting default-members so that they don't get built / checked by a regular cargo check / cargo build (only with --workspace). I hope that retains most of the positives of #978 while fixing its downsides.

jplatte avatar Oct 10 '22 09:10 jplatte

For me rust-analyzer still checks all the examples which I'd like to avoid. I tried a bunch of ways to set overrideCommand (both rust-analyzer.cargo.buildScripts.overrideCommand and rust-analyzer.checkOnSave.overrideCommand) but couldn't get it to stop doing that. Unless there is a way to fix that I don't think we should do this.

davidpdrsn avatar Oct 10 '22 16:10 davidpdrsn

This seems to work for me on the latest release:

"rust-analyzer.checkOnSave.overrideCommand": [
    "cargo",
    "check", // or clippy
    "--message-format=json",
    "--all-targets",
]

(cc https://github.com/rust-lang/rust-analyzer/issues/10717, which tracks first-class support for this kind of thing)

jplatte avatar Oct 10 '22 16:10 jplatte

I was able to get it working with that overrideCommand. So let's give this a try and see how it works! I'll deal with the conflicts.

davidpdrsn avatar Mar 10 '23 10:03 davidpdrsn