Unnamed repository; edit this file 'description' to name the repository.
Run formatter from Document directory (#12315)
Co-authored-by: Rob Gonnella <[email protected]>
Rob Gonnella 2025-01-09
parent 931dd9c · commit a83c23b
-rw-r--r--helix-view/src/document.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 29fd736a..edbc96b0 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -774,7 +774,13 @@ impl Document {
{
use std::process::Stdio;
let text = self.text().clone();
+
let mut process = tokio::process::Command::new(&fmt_cmd);
+
+ if let Some(doc_dir) = self.path.as_ref().and_then(|path| path.parent()) {
+ process.current_dir(doc_dir);
+ }
+
process
.args(fmt_args)
.stdin(Stdio::piped())