You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user/manual.adoc
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -269,6 +269,57 @@ Gnome Builder currently has support for RLS, and there's no way to configure the
269
269
1. Rename, symlink or copy the `rust-analyzer` binary to `rls` and place it somewhere Builder can find (in `PATH`, or under `~/.cargo/bin`).
270
270
2. Enable the Rust Builder plugin.
271
271
272
+
== Non-Cargo Based Projects
273
+
274
+
rust-analyzer does not require Cargo.
275
+
However, if you use some other build system, you'll have to describe the structure of your project for rust-analyzer in the `rust-project.json` format:
276
+
277
+
[source,TypeScript]
278
+
----
279
+
interface JsonProject {
280
+
/// The set of paths containing the crates for this project.
281
+
/// Any `Crate` must be nested inside some `root`.
282
+
roots: string[];
283
+
/// The set of crates comprising the current project.
284
+
/// Must include all transitive dependencies as well as sysroot crate (libstd, libcore and such).
285
+
crates: Crate[];
286
+
}
287
+
288
+
interface Crate {
289
+
/// Path to the root module of the crate.
290
+
root_module: string;
291
+
/// Edition of the crate.
292
+
edition: "2015" | "2018";
293
+
/// Dependencies
294
+
deps: Dep[];
295
+
/// The set of cfgs activated for a given crate, like `["unix", "feature=foo", "feature=bar"]`.
296
+
cfg: string[];
297
+
298
+
/// value of the OUT_DIR env variable.
299
+
out_dir?: string;
300
+
/// For proc-macro crates, path to compiles proc-macro (.so file).
301
+
proc_macro_dylib_path?: string;
302
+
}
303
+
304
+
interface Dep {
305
+
/// Index of a crate in the `crates` array.
306
+
crate: number,
307
+
/// Name as should appear in the (implicit) `extern crate name` declaration.
308
+
name: string,
309
+
}
310
+
----
311
+
312
+
This format is provisional and subject to change.
313
+
Specifically, the `roots` setup will be different eventually.
314
+
315
+
There are tree ways to feed `rust-project.json` to rust-analyzer:
316
+
317
+
* Place `rust-project.json` file at the root of the project, and rust-anlayzer will discover it.
318
+
* Specify `"rust-analyzer.linkedProjects": [ "path/to/rust-project.json" ]` in the settings (and make sure that your LSP client sends settings as a part of initialize request).
0 commit comments