Skip to content

Commit

Permalink
Run formatter from Document directory (#12315)
Browse files Browse the repository at this point in the history
Co-authored-by: Rob Gonnella <[email protected]>
  • Loading branch information
robgonnella and Rob Gonnella authored Jan 8, 2025
1 parent 931dd9c commit a83c23b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit a83c23b

Please sign in to comment.