aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/handlers.rs17
-rw-r--r--crates/syntax/Cargo.toml2
2 files changed, 18 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 001f3a37d..42451cd2d 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -858,6 +858,23 @@ pub(crate) fn handle_formatting(
858 RustfmtConfig::Rustfmt { extra_args } => { 858 RustfmtConfig::Rustfmt { extra_args } => {
859 let mut cmd = process::Command::new(toolchain::rustfmt()); 859 let mut cmd = process::Command::new(toolchain::rustfmt());
860 cmd.args(extra_args); 860 cmd.args(extra_args);
861 // try to chdir to the file so we can respect `rustfmt.toml`
862 // FIXME: use `rustfmt --config-path` once
863 // https://github.com/rust-lang/rustfmt/issues/4660 gets fixed
864 match params.text_document.uri.to_file_path() {
865 Ok(mut path) => {
866 // pop off file name
867 if path.pop() && path.is_dir() {
868 cmd.current_dir(path);
869 }
870 }
871 Err(_) => {
872 log::error!(
873 "Unable to get file path for {}, rustfmt.toml might be ignored",
874 params.text_document.uri
875 );
876 }
877 }
861 if let Some(&crate_id) = crate_ids.first() { 878 if let Some(&crate_id) = crate_ids.first() {
862 // Assume all crates are in the same edition 879 // Assume all crates are in the same edition
863 let edition = snap.analysis.crate_edition(crate_id)?; 880 let edition = snap.analysis.crate_edition(crate_id)?;
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index 55b437a3a..24298fbfa 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
13[dependencies] 13[dependencies]
14itertools = "0.10.0" 14itertools = "0.10.0"
15rowan = "0.12" 15rowan = "0.12"
16rustc_lexer = { version = "697.0.0", package = "rustc-ap-rustc_lexer" } 16rustc_lexer = { version = "700.0.0", package = "rustc-ap-rustc_lexer" }
17rustc-hash = "1.1.0" 17rustc-hash = "1.1.0"
18arrayvec = "0.5.1" 18arrayvec = "0.5.1"
19once_cell = "1.3.1" 19once_cell = "1.3.1"