Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obsolete config keys #12742

Merged
merged 6 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/ide-assists/src/handlers/auto_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand All @@ -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[]

Expand Down
2 changes: 1 addition & 1 deletion crates/ide-completion/src/completions/flyimport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/ide-completion/src/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 2 additions & 2 deletions crates/project-model/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
22 changes: 15 additions & 7 deletions docs/user/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,16 @@ 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
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true
Expand Down Expand Up @@ -364,7 +368,9 @@ if executable('rust-analyzer')
\ 'whitelist': ['rust'],
\ 'initialization_options': {
\ 'cargo': {
\ 'loadOutDirsFromCheck': v:true,
\ 'buildScripts': {
\ 'enable': v:true,
\ },
\ },
\ 'procMacro': {
\ 'enable': v:true,
Expand Down Expand Up @@ -527,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,
Expand Down Expand Up @@ -705,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[]

Expand Down