summaryrefslogtreecommitdiff
path: root/cli/file_watcher.rs
diff options
context:
space:
mode:
authorYusuke Tanaka <yusuktan@maguro.dev>2021-01-12 16:53:58 +0900
committerGitHub <noreply@github.com>2021-01-11 23:53:58 -0800
commit5c6ab75de1e5817df3620a5cdd85eba748b2a8a6 (patch)
tree4ff1e1f2777d09cbcf0e40a42da567b4f8d4bf42 /cli/file_watcher.rs
parentf18ae461a81f9323aef1a4a8c4b945fb58f63499 (diff)
fix(watcher): keep working even when imported file has invalid syntax (#9091)
Diffstat (limited to 'cli/file_watcher.rs')
-rw-r--r--cli/file_watcher.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/file_watcher.rs b/cli/file_watcher.rs
index 699a27864..d9681af7f 100644
--- a/cli/file_watcher.rs
+++ b/cli/file_watcher.rs
@@ -172,7 +172,7 @@ where
let mut debounce = Debounce::new();
// Store previous data. If module resolution fails at some point, the watcher will try to
// continue watching files using these data.
- let mut paths;
+ let mut paths = Vec::new();
let mut module = None;
loop {
@@ -185,7 +185,10 @@ where
module = Some(module_info);
}
ModuleResolutionResult::Fail { source_path, error } => {
- paths = vec![source_path];
+ if paths.is_empty() {
+ paths = vec![source_path];
+ }
+
if module.is_none() {
eprintln!("{}: {}", colors::red_bold("error"), error);
}