Skip to content

Commit 3cbadfa

Browse files
branchseerclaude
andcommitted
style: quote folder paths in cache miss messages
'file' added in 'src' instead of 'file' added in src. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 262af91 commit 3cbadfa

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

crates/vite_task/src/session/cache/display.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,17 @@ pub fn format_input_change_str(kind: InputChangeKind, path: &str) -> Str {
191191
InputChangeKind::ContentModified => vite_str::format!("'{path}' modified"),
192192
InputChangeKind::Added => {
193193
let (dir, filename) = split_path(path);
194-
vite_str::format!("'{filename}' added in {dir}")
194+
match dir {
195+
Some(dir) => vite_str::format!("'{filename}' added in '{dir}'"),
196+
None => vite_str::format!("'{filename}' added in workspace root"),
197+
}
195198
}
196199
InputChangeKind::Removed => {
197200
let (dir, filename) = split_path(path);
198-
vite_str::format!("'{filename}' removed from {dir}")
201+
match dir {
202+
Some(dir) => vite_str::format!("'{filename}' removed from '{dir}'"),
203+
None => vite_str::format!("'{filename}' removed from workspace root"),
204+
}
199205
}
200206
}
201207
}

crates/vite_task/src/session/cache/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ impl Display for FingerprintMismatch {
129129
}
130130

131131
/// Split a relative path into `(parent_dir, filename)`.
132-
/// Returns `("workspace root", path)` if there is no parent directory.
133-
pub fn split_path(path: &str) -> (&str, &str) {
132+
/// Returns `None` for the parent if the path has no `/` separator.
133+
pub fn split_path(path: &str) -> (Option<&str>, &str) {
134134
match path.rsplit_once('/') {
135-
Some((parent, filename)) => (parent, filename),
136-
None => ("workspace root", path),
135+
Some((parent, filename)) => (Some(parent), filename),
136+
None => (None, path),
137137
}
138138
}
139139

0 commit comments

Comments
 (0)