1interface JsonProject { 2 /// Path to the directory with *source code* of 3 /// sysroot crates. 4 /// 5 /// It should point to the directory where std, 6 /// core, and friends can be found: 7 /// 8 /// https://github.com/rust-lang/rust/tree/master/library. 9 /// 10 /// If provided, rust-analyzer automatically adds 11 /// dependencies on sysroot crates. Conversely, 12 /// if you omit this path, you can specify sysroot 13 /// dependencies yourself and, for example, have 14 /// several different "sysroots" in one graph of 15 /// crates. 16 sysroot_src?: string; 17 /// The set of crates comprising the current 18 /// project. Must include all transitive 19 /// dependencies as well as sysroot crate (libstd, 20 /// libcore and such). 21 crates: Crate[]; 22} 23 24interface Crate { 25 /// Optional crate name used for display purposes, 26 /// without affecting semantics. See the `deps` 27 /// key for semantically-significant crate names. 28 display_name?: string; 29 /// Path to the root module of the crate. 30 root_module: string; 31 /// Edition of the crate. 32 edition: "2015" | "2018" | "2021"; 33 /// Dependencies 34 deps: Dep[]; 35 /// Should this crate be treated as a member of 36 /// current "workspace". 37 /// 38 /// By default, inferred from the `root_module` 39 /// (members are the crates which reside inside 40 /// the directory opened in the editor). 41 /// 42 /// Set this to `false` for things like standard 43 /// library and 3rd party crates to enable 44 /// performance optimizations (rust-analyzer 45 /// assumes that non-member crates don't change). 46 is_workspace_member?: boolean; 47 /// Optionally specify the (super)set of `.rs` 48 /// files comprising this crate. 49 /// 50 /// By default, rust-analyzer assumes that only 51 /// files under `root_module.parent` can belong 52 /// to a crate. `include_dirs` are included 53 /// recursively, unless a subdirectory is in 54 /// `exclude_dirs`. 55 /// 56 /// Different crates can share the same `source`. 57 /// 58 /// If two crates share an `.rs` file in common, 59 /// they *must* have the same `source`. 60 /// rust-analyzer assumes that files from one 61 /// source can't refer to files in another source. 62 source?: { 63 include_dirs: string[]; 64 exclude_dirs: string[]; 65 }; 66 /// The set of cfgs activated for a given crate, like 67 /// `["unix", "feature=\"foo\"", "feature=\"bar\""]`. 68 cfg: string[]; 69 /// Target triple for this Crate. 70 /// 71 /// Used when running `rustc --print cfg` 72 /// to get target-specific cfgs. 73 target?: string; 74 /// Environment variables, used for 75 /// the `env!` macro 76 env: { [key: string]: string }; 77 78 /// Whether the crate is a proc-macro crate. 79 is_proc_macro: boolean; 80 /// For proc-macro crates, path to compiled 81 /// proc-macro (.so file). 82 proc_macro_dylib_path?: string; 83} 84 85interface Dep { 86 /// Index of a crate in the `crates` array. 87 crate: number; 88 /// Name as should appear in the (implicit) 89 /// `extern crate name` declaration. 90 name: string; 91} 92