mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Try to find rustfmt in more places
This commit is contained in:
parent
f5584668db
commit
9617bb4f07
4 changed files with 7 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1395,6 +1395,7 @@ dependencies = [
|
||||||
"ra_project_model",
|
"ra_project_model",
|
||||||
"ra_syntax",
|
"ra_syntax",
|
||||||
"ra_text_edit",
|
"ra_text_edit",
|
||||||
|
"ra_toolchain",
|
||||||
"ra_tt",
|
"ra_tt",
|
||||||
"rand",
|
"rand",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
|
|
|
@ -15,6 +15,10 @@ pub fn rustup() -> PathBuf {
|
||||||
get_path_for_executable("rustup")
|
get_path_for_executable("rustup")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn rustfmt() -> PathBuf {
|
||||||
|
get_path_for_executable("rustfmt")
|
||||||
|
}
|
||||||
|
|
||||||
/// Return a `PathBuf` to use for the given executable.
|
/// Return a `PathBuf` to use for the given executable.
|
||||||
///
|
///
|
||||||
/// E.g., `get_path_for_executable("cargo")` may return just `cargo` if that
|
/// E.g., `get_path_for_executable("cargo")` may return just `cargo` if that
|
||||||
|
|
|
@ -41,6 +41,7 @@ ra_text_edit = { path = "../ra_text_edit" }
|
||||||
vfs = { path = "../vfs" }
|
vfs = { path = "../vfs" }
|
||||||
vfs-notify = { path = "../vfs-notify" }
|
vfs-notify = { path = "../vfs-notify" }
|
||||||
ra_cfg = { path = "../ra_cfg"}
|
ra_cfg = { path = "../ra_cfg"}
|
||||||
|
ra_toolchain = { path = "../ra_toolchain" }
|
||||||
|
|
||||||
# This should only be used in CLI
|
# This should only be used in CLI
|
||||||
ra_db = { path = "../ra_db" }
|
ra_db = { path = "../ra_db" }
|
||||||
|
|
|
@ -650,7 +650,7 @@ pub(crate) fn handle_formatting(
|
||||||
|
|
||||||
let mut rustfmt = match &snap.config.rustfmt {
|
let mut rustfmt = match &snap.config.rustfmt {
|
||||||
RustfmtConfig::Rustfmt { extra_args } => {
|
RustfmtConfig::Rustfmt { extra_args } => {
|
||||||
let mut cmd = process::Command::new("rustfmt");
|
let mut cmd = process::Command::new(ra_toolchain::rustfmt());
|
||||||
cmd.args(extra_args);
|
cmd.args(extra_args);
|
||||||
if let Some(&crate_id) = crate_ids.first() {
|
if let Some(&crate_id) = crate_ids.first() {
|
||||||
// Assume all crates are in the same edition
|
// Assume all crates are in the same edition
|
||||||
|
|
Loading…
Reference in a new issue