Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'docs/user/manual.adoc')
-rw-r--r--docs/user/manual.adoc90
1 files changed, 83 insertions, 7 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index ffc820e9b7..4a2a6f2e36 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -716,6 +716,32 @@ interface JsonProject {
/// dependencies as well as sysroot crate (libstd,
/// libcore and such).
crates: Crate[];
+ /// Configuration for CLI commands.
+ ///
+ /// These are used for running and debugging binaries
+ /// and tests without encoding build system-specific
+ /// knowledge into rust-analyzer.
+ ///
+ /// # Example
+ ///
+ /// Below is an example of a test runnable. `{label}` and `{test_id}`
+ /// are explained in `Runnable::args`'s documentation below.
+ ///
+ /// ```json
+ /// {
+ /// "program": "buck",
+ /// "args": [
+ /// "test",
+ /// "{label}",
+ /// "--",
+ /// "{test_id}",
+ /// "--print-passing-details"
+ /// ],
+ /// "cwd": "/home/user/repo-root/",
+ /// "kind": "testOne"
+ /// }
+ /// ```
+ runnables?: Runnable[];
}
interface Crate {
@@ -726,7 +752,10 @@ interface Crate {
/// Path to the root module of the crate.
root_module: string;
/// Edition of the crate.
- edition: "2015" | "2018" | "2021";
+ edition: '2015' | '2018' | '2021' | '2024';
+ /// The version of the crate. Used for calculating
+ /// the correct docs.rs URL.
+ version?: string;
/// Dependencies
deps: Dep[];
/// Should this crate be treated as a member of
@@ -757,9 +786,9 @@ interface Crate {
/// rust-analyzer assumes that files from one
/// source can't refer to files in another source.
source?: {
- include_dirs: string[],
- exclude_dirs: string[],
- },
+ include_dirs: string[];
+ exclude_dirs: string[];
+ };
/// List of cfg groups this crate inherits.
///
/// All cfg in these groups will be concatenated to
@@ -776,21 +805,68 @@ interface Crate {
target?: string;
/// Environment variables, used for
/// the `env!` macro
- env: { [key: string]: string; },
+ env: { [key: string]: string; };
/// Whether the crate is a proc-macro crate.
is_proc_macro: boolean;
/// For proc-macro crates, path to compiled
/// proc-macro (.so file).
proc_macro_dylib_path?: string;
+
+ /// Repository, matching the URL that would be used
+ /// in Cargo.toml.
+ repository?: string;
+
+ /// Build-specific data about this crate.
+ build?: BuildInfo;
}
interface Dep {
/// Index of a crate in the `crates` array.
- crate: number,
+ crate: number;
/// Name as should appear in the (implicit)
/// `extern crate name` declaration.
- name: string,
+ name: string;
+}
+
+interface BuildInfo {
+ /// The name associated with this crate.
+ ///
+ /// This is determined by the build system that produced
+ /// the `rust-project.json` in question. For instance, if buck were used,
+ /// the label might be something like `//ide/rust/rust-analyzer:rust-analyzer`.
+ ///
+ /// Do not attempt to parse the contents of this string; it is a build system-specific
+ /// identifier similar to `Crate::display_name`.
+ label: string;
+ /// Path corresponding to the build system-specific file defining the crate.
+ build_file: string;
+ /// The kind of target.
+ ///
+ /// This information is used to determine what sort
+ /// of runnable codelens to provide, if any.
+ target_kind: 'bin' | 'lib' | 'test';
+}
+
+interface Runnable {
+ /// The program invoked by the runnable.
+ ///
+ /// For example, this might be `cargo`, `buck`, or `bazel`.
+ program: string;
+ /// The arguments passed to `program`.
+ args: string[];
+ /// The current working directory of the runnable.
+ cwd: string;
+ /// Used to decide what code lens to offer.
+ ///
+ /// `testOne`: This runnable will be used when the user clicks the 'Run Test'
+ /// CodeLens above a test.
+ ///
+ /// The args for testOne can contain two template strings:
+ /// `{label}` and `{test_id}`. `{label}` will be replaced
+ /// with the `Build::label` and `{test_id}` will be replaced
+ /// with the test name.
+ kind: 'testOne' | string;
}
----