Run formatter from Document directory (#12315)

Co-authored-by: Rob Gonnella <rob.gonnella@papayapay.com>
This commit is contained in:
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

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