Run formatter from Document directory (#12315)

Co-authored-by: Rob Gonnella <rob.gonnella@papayapay.com>
pull/12471/head
Rob Gonnella 2025-01-08 13:36:40 -05:00 committed by GitHub
parent 931dd9c1dc
commit a83c23bb03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -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())