Unnamed repository; edit this file 'description' to name the repository.
doc: Update docs for runnables to include run/flycheck
Cormac Relf 4 months ago
parent ad27655 · commit a7eb8c0
-rw-r--r--crates/project-model/src/project_json.rs3
-rw-r--r--docs/book/src/non_cargo_based_projects.md19
2 files changed, 17 insertions, 5 deletions
diff --git a/crates/project-model/src/project_json.rs b/crates/project-model/src/project_json.rs
index 536f170e11..6938010cbd 100644
--- a/crates/project-model/src/project_json.rs
+++ b/crates/project-model/src/project_json.rs
@@ -357,9 +357,12 @@ pub enum RunnableKind {
Check,
/// Can run a binary.
+ /// May include {label} which will get the label from the `build` section of a crate.
Run,
/// Run a single test.
+ /// May include {label} which will get the label from the `build` section of a crate.
+ /// May include {test_id} which will get the test clicked on by the user.
TestOne,
/// Template for checking a target, emitting rustc JSON diagnostics.
diff --git a/docs/book/src/non_cargo_based_projects.md b/docs/book/src/non_cargo_based_projects.md
index e7df4a5d76..d8be9a82d0 100644
--- a/docs/book/src/non_cargo_based_projects.md
+++ b/docs/book/src/non_cargo_based_projects.md
@@ -204,16 +204,25 @@ interface Runnable {
args: string[];
/// The current working directory of the runnable.
cwd: string;
- /// Used to decide what code lens to offer.
+ /// Maps a runnable to a piece of rust-analyzer functionality.
///
- /// `testOne`: This runnable will be used when the user clicks the 'Run Test'
- /// CodeLens above a test.
+ /// - `testOne`: This runnable will be used when the user clicks the 'Run Test'
+ /// CodeLens above a test.
+ /// - `run`: This runnable will be used when the user clicks the 'Run' CodeLens
+ /// above a main function or triggers a run command.
+ /// - `flycheck`: This is run to provide check-on-save diagnostics when the user
+ /// saves a file. It must emit rustc JSON diagnostics that rust-analyzer can
+ /// parse. If this runnable is not specified, we may try to use `cargo check -p`.
+ /// This is only run for a single crate that the user saved a file in. The
+ /// {label} syntax is replaced with `BuildInfo::label`.
+ /// Alternatively, you may use `{saved_file}` and figure out which crate
+ /// to produce diagnostics for based on that.
///
/// 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 `BuildInfo::label` and `{test_id}` will be replaced
/// with the test name.
- kind: 'testOne' | string;
+ kind: 'testOne' | 'run' | 'flycheck' | string;
}
```