2

rust-analyzer recognizes examples folder , and what I want is to recognize it, sub-folders like 'examples/borrowship/' so I can collect useful snippets and study under in one project, is there any way ? vs code example folder

atari_61
  • 91
  • 4
  • From my experience, it should work also with subfolders by default - but you have to include them in the main as a module, e.g `pub mod mix.rs` – nir shahar Dec 31 '22 at 21:40

1 Answers1

1

The contents of examples/ are analyzed by Cargo target auto-discovery. There is no way to expand the automatic behavior of looking for files (or directories with main.rs files) in examples/; you can only disable it entirely, or add individual targets manually.

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
  • thanks as a newbie I thought it is caused by rust-analyzer but this cargo book tip opened my eyes , I used cargo workspaces , so now I am able to divide by workspaces as "topic1/examples/" , "topic2/examples/" all in one cargo project – atari_61 Jan 01 '23 at 00:49