summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-10-19 07:05:00 +0200
committerGitHub <noreply@github.com>2023-10-19 07:05:00 +0200
commit8d9fef3b8955eadfd4820455b422b5bec1cdad0a (patch)
tree7114c3e3c329c83ce1d9c90e8fab5c7104bd1579 /cli/tools/fmt.rs
parent5095af78018f1d77374bc06cbb58231e631056b9 (diff)
refactor: add WatcherCommunicator helper struct (#20927)
This commit introduces "WatcherCommunicator" struct that is used facilitate bi-directional communication between CLI file watcher and the watched function. Prerequisite for https://github.com/denoland/deno/pull/20876
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 284f20dda..b9525b7b2 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -68,7 +68,7 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> {
job_name: "Fmt".to_string(),
clear_screen: !watch_flags.no_clear_screen,
},
- move |flags, sender, changed_paths| {
+ move |flags, watcher_communicator, changed_paths| {
let fmt_flags = fmt_flags.clone();
Ok(async move {
let factory = CliFactory::from_flags(flags).await?;
@@ -82,7 +82,7 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> {
Ok(files)
}
})?;
- _ = sender.send(files.clone());
+ _ = watcher_communicator.watch_paths(files.clone());
let refmt_files = if let Some(paths) = changed_paths {
if fmt_options.check {
// check all files on any changed (https://github.com/denoland/deno/issues/12446)