diff --git a/README.md b/README.md index 9f0dbb4..5918d9a 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ Add the following to your `settings.json`: "Cargo.toml" ] }, + "rust-analyzer.check.invocationStrategy": "once", "rust-analyzer.check.overrideCommand": [ "cargo-subspace", "check", // You can also use "clippy" here @@ -115,6 +116,7 @@ also be set via lspconfig. ```lua ["rust-analyzer"] = { check = { + invocationStrategy = "once", overrideCommand = { "cargo-subspace", "clippy", @@ -149,6 +151,7 @@ These settings should be specified in `Settings --> LSP Client --> User Server S "useWorkspace": false, "initializationOptions": { "check": { + "invocationStrategy": "once", "overrideCommand": [ "cargo-subspace", "clippy", diff --git a/src/main.rs b/src/main.rs index ccfa76e..9e88a82 100644 --- a/src/main.rs +++ b/src/main.rs @@ -217,23 +217,8 @@ fn discover(ctx: &Context, discover_args: DiscoverArgs, manifest_path: FilePath< let metadata = cmd.exec()?; let project = compute_project_json(ctx, discover_args, metadata, manifest_path)?; - let root = ctx - .cargo() - .arg("locate-project") - .arg("--workspace") - .arg("--manifest-path") - .arg(manifest_path) - .arg("--message-format") - .arg("plain") - .output()?; - let buildfile: PathBuf = String::from_utf8(root.stdout)?.trim().into(); let output = DiscoverProjectData::Finished { - buildfile: Utf8PathBuf::from_path_buf(buildfile).map_err(|e| { - anyhow!( - "Manifest path `{}` contains non-UTF-8 characters", - e.display() - ) - })?, + buildfile: manifest_path.to_path_buf(), project, }; let json = if ctx.is_tty {