Stream: t-compiler/rust-analyzer

Topic: documenting rustcSource


Joshua Nelson (Mar 08 2021 at 15:54, on Zulip):

@matklad how do I regenerate generated_config.adoc? I tried cargo xtask codegen but it didn't update the file

Joshua Nelson (Mar 08 2021 at 15:56, on Zulip):

also, would you be interested in an assist to add rustcSources if rust-analyzer sees feature(rustc_private)?

Joshua Nelson (Mar 08 2021 at 16:01, on Zulip):

Joshua Nelson said:

matklad how do I regenerate generated_config.adoc? I tried cargo xtask codegen but it didn't update the file

---- config::tests::schema_in_sync_with_docs stdout ----
thread 'config::tests::schema_in_sync_with_docs' panicked at 'updated config manual', crates/rust-analyzer/src/config.rs:907:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Joshua Nelson (Mar 08 2021 at 16:01, on Zulip):

oh huh it's part of the test itself, that's kind of nifty

Joshua Nelson (Mar 08 2021 at 16:01, on Zulip):

I'll add a comment

Joshua Nelson (Mar 08 2021 at 16:07, on Zulip):

also fyi \n doesn't work in asciidoc: image.png

matklad (Mar 08 2021 at 16:08, on Zulip):

cargo t -p rust-analyzer mind https://github.com/rust-analyzer/rust-analyzer/pull/7891 though

Joshua Nelson (Mar 08 2021 at 16:16, on Zulip):

matklad said:

cargo t -p rust-analyzer mind https://github.com/rust-analyzer/rust-analyzer/pull/7891 though

thanks for the link, left some comments

Daniel Mcnab (Mar 08 2021 at 16:47, on Zulip):

Are you changing the documentation of rustcSource specifically? I have also done that for the changes in https://github.com/rust-analyzer/rust-analyzer/pull/7891

Joshua Nelson (Mar 08 2021 at 16:48, on Zulip):

hmm, ok - the changes will conflict but I think my additions are still good

Joshua Nelson (Mar 08 2021 at 16:49, on Zulip):
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index 96788bc2c..aca08bd96 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -713,7 +713,7 @@
                     }
                 },
                 "rust-analyzer.rustcSource": {
-                    "markdownDescription": "Path to the rust compiler sources, for usage in rustc_private projects, or \"discover\" to try to automatically find it.",
+                    "markdownDescription": "Path to the Cargo.toml of the rust compiler workspace, for usage in rustc_private projects, or \"discover\" to try to automatically find it.    This option is not reloaded automatically; you must restart rust-analyzer for it to take effect.",
                     "default": null,
                     "type": [
                         "null",
Joshua Nelson (Mar 08 2021 at 20:06, on Zulip):

FYI there is some sort of bug in schema_in_sync_with_package_json - I ran the test and it passed, but when I unconditionally wrote the schema to disk it made changes that weren't there before:

diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 89bee175d..f475d80d6 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -945,33 +946,33 @@ mod tests {
         let p = remove_ws(&package_json[start..end]);
         let s = remove_ws(&schema);

-        if !p.contains(&s) {
+        //if !p.contains(&s) {
             package_json.replace_range(start..end, &schema);
             fs::write(&package_json_path, &mut package_json).unwrap();
             panic!("new config, updating package.json")
-        }
+        //}
     }
Joshua Nelson (Mar 08 2021 at 20:06, on Zulip):

took me ages to debug it wasn't a bug I'd introduced myself lol

Last update: Jul 27 2021 at 22:15UTC