From eaebead2965959cab1c989978aef7acdbd018a89 Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 11 Jul 2022 15:42:49 +0900 Subject: [PATCH 1/6] Fix config keys regarding imports in docs --- crates/ide-assists/src/handlers/auto_import.rs | 8 ++++---- crates/ide-completion/src/completions/flyimport.rs | 2 +- docs/user/manual.adoc | 8 +++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/ide-assists/src/handlers/auto_import.rs b/crates/ide-assists/src/handlers/auto_import.rs index 1ec24d8fcc33..802449f85884 100644 --- a/crates/ide-assists/src/handlers/auto_import.rs +++ b/crates/ide-assists/src/handlers/auto_import.rs @@ -40,7 +40,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel}; // // .Import Granularity // -// It is possible to configure how use-trees are merged with the `importGranularity` setting. +// It is possible to configure how use-trees are merged with the `imports.granularity.group` setting. // It has the following configurations: // // - `crate`: Merge imports from the same crate into a single use statement. This kind of @@ -50,11 +50,11 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel}; // - `preserve`: Do not change the granularity of any imports. For auto-import this has the same // effect as `item`. // -// In `VS Code` the configuration for this is `rust-analyzer.assist.importGranularity`. +// In `VS Code` the configuration for this is `rust-analyzer.imports.granularity.group`. // // .Import Prefix // -// The style of imports in the same crate is configurable through the `importPrefix` setting. +// The style of imports in the same crate is configurable through the `imports.prefix` setting. // It has the following configurations: // // - `crate`: This setting will force paths to be always absolute, starting with the `crate` @@ -64,7 +64,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel}; // `super` or an extern crate identifier. // - `plain`: This setting does not impose any restrictions in imports. // -// In `VS Code` the configuration for this is `rust-analyzer.assist.importPrefix`. +// In `VS Code` the configuration for this is `rust-analyzer.imports.prefix`. // // image::https://user-images.githubusercontent.com/48062697/113020673-b85be580-917a-11eb-9022-59585f35d4f8.gif[] diff --git a/crates/ide-completion/src/completions/flyimport.rs b/crates/ide-completion/src/completions/flyimport.rs index 1c62347fb5b5..6dbcfb0a5d73 100644 --- a/crates/ide-completion/src/completions/flyimport.rs +++ b/crates/ide-completion/src/completions/flyimport.rs @@ -95,7 +95,7 @@ use super::Completions; // // .Import configuration // -// It is possible to configure how use-trees are merged with the `importMergeBehavior` setting. +// It is possible to configure how use-trees are merged with the `imports.granularity.group` setting. // Mimics the corresponding behavior of the `Auto Import` feature. // // .LSP and performance implications diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index f55dfd470332..5185218abd9e 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc @@ -308,9 +308,11 @@ nvim_lsp.rust_analyzer.setup({ on_attach=on_attach, settings = { ["rust-analyzer"] = { - assist = { - importGranularity = "module", - importPrefix = "self", + imports = { + granularity = { + group = "module", + }, + prefix = "self", }, cargo = { loadOutDirsFromCheck = true From 6e5571608bb689f64ecbfa8cadd4d2ea41c4e53c Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:36:36 +0900 Subject: [PATCH 2/6] Fix obsolete `loadOutDirsFromCheck` configs --- docs/user/manual.adoc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index 5185218abd9e..eb21bd15a01c 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc @@ -315,7 +315,9 @@ nvim_lsp.rust_analyzer.setup({ prefix = "self", }, cargo = { - loadOutDirsFromCheck = true + buildScripts = { + enable = true, + }, }, procMacro = { enable = true @@ -366,7 +368,9 @@ if executable('rust-analyzer') \ 'whitelist': ['rust'], \ 'initialization_options': { \ 'cargo': { - \ 'loadOutDirsFromCheck': v:true, + \ 'buildScripts': { + \ 'enable': v:true, + \ }, \ }, \ 'procMacro': { \ 'enable': v:true, @@ -529,7 +533,9 @@ For example, a very common configuration is to enable proc-macro support, can be ---- { "cargo": { - "loadOutDirsFromCheck": true, + "buildScripts": { + "enable": true, + }, }, "procMacro": { "enable": true, From 195ceea9101333e639b9f60126b8b0b55722dfec Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:37:46 +0900 Subject: [PATCH 3/6] Fix obsolete `diagnostics.experimental.enable` --- docs/user/manual.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index eb21bd15a01c..999a6437ab9e 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc @@ -713,7 +713,7 @@ include::./generated_assists.adoc[] == Diagnostics While most errors and warnings provided by rust-analyzer come from the `cargo check` integration, there's a growing number of diagnostics implemented using rust-analyzer's own analysis. -Some of these diagnostics don't respect `\#[allow]` or `\#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.enableExperimental` or `rust-analyzer.diagnostics.disabled` settings. +Some of these diagnostics don't respect `\#[allow]` or `\#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.experimental.enable` or `rust-analyzer.diagnostics.disabled` settings. include::./generated_diagnostic.adoc[] From f0649f2c199daa32664813207616063f3bb2445b Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:50:20 +0900 Subject: [PATCH 4/6] Fix `rustcSource` -> `rustc_source` This only fixes the comments in the internal source, which is not mandatory at all --- crates/project-model/src/workspace.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs index ad2f7e51bbfb..de4245835456 100644 --- a/crates/project-model/src/workspace.rs +++ b/crates/project-model/src/workspace.rs @@ -737,7 +737,7 @@ fn handle_rustc_crates( let root_pkg = rustc_workspace.packages().find(|package| rustc_workspace[*package].name == "rustc_driver"); // The rustc workspace might be incomplete (such as if rustc-dev is not - // installed for the current toolchain) and `rustcSource` is set to discover. + // installed for the current toolchain) and `rustc_source` is set to discover. if let Some(root_pkg) = root_pkg { // Iterate through every crate in the dependency subtree of rustc_driver using BFS let mut queue = VecDeque::new(); @@ -822,7 +822,7 @@ fn handle_rustc_crates( for (from, _) in pkg_crates.get(&pkg).into_iter().flatten() { // Avoid creating duplicate dependencies // This avoids the situation where `from` depends on e.g. `arrayvec`, but - // `rust_analyzer` thinks that it should use the one from the `rustcSource` + // `rust_analyzer` thinks that it should use the one from the `rustc_source` // instead of the one from `crates.io` if !crate_graph[*from].dependencies.iter().any(|d| d.name == name) { add_dep(crate_graph, *from, name.clone(), to); From dfcbed09d362cb7f994eab77fb47df769082e15d Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:52:35 +0900 Subject: [PATCH 5/6] Fix obsolete `enableRangeFormatting` config --- crates/rust-analyzer/src/handlers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 69a03850b5ce..e3875228a187 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -1798,7 +1798,7 @@ fn run_rustfmt( String::from( "rustfmt range formatting is unstable. \ Opt-in by using a nightly build of rustfmt and setting \ - `rustfmt.enableRangeFormatting` to true in your LSP configuration", + `rustfmt.rangeFormatting.enable` to true in your LSP configuration", ), ) .into()); From e3bde579c4a103a90572975902837d793ea8c60e Mon Sep 17 00:00:00 2001 From: TonalidadeHidrica <47710717+TonalidadeHidrica@users.noreply.github.com> Date: Mon, 11 Jul 2022 17:00:40 +0900 Subject: [PATCH 6/6] Fix obsolete `completion.snippets` config --- crates/ide-completion/src/snippet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ide-completion/src/snippet.rs b/crates/ide-completion/src/snippet.rs index a6bb3d0648bb..d2680c775838 100644 --- a/crates/ide-completion/src/snippet.rs +++ b/crates/ide-completion/src/snippet.rs @@ -6,12 +6,12 @@ // // rust-analyzer allows the user to define custom (postfix)-snippets that may depend on items to be accessible for the current scope to be applicable. // -// A custom snippet can be defined by adding it to the `rust-analyzer.completion.snippets` object respectively. +// A custom snippet can be defined by adding it to the `rust-analyzer.completion.snippets.custom` object respectively. // // [source,json] // ---- // { -// "rust-analyzer.completion.snippets": { +// "rust-analyzer.completion.snippets.custom": { // "thread spawn": { // "prefix": ["spawn", "tspawn"], // "body": [