mirror of https://github.com/helix-editor/helix
better logging for coverage
parent
5fdd2e99b9
commit
c142d85f71
|
@ -89,7 +89,10 @@ pub fn get_coverage(document_path: &std::path::PathBuf) -> Option<FileCoverage>
|
|||
|
||||
log::debug!("document path: {:?}", document_path);
|
||||
|
||||
let file_coverage = coverage.files.get(document_path)?;
|
||||
let file_coverage = coverage.files.get(document_path).or_else(|| {
|
||||
log::warn!("file: {:?} not found in coverage", document_path);
|
||||
None
|
||||
})?;
|
||||
|
||||
let coverage_time = file_coverage.modified_time?;
|
||||
let document_metadata = document_path.metadata().ok()?;
|
||||
|
@ -159,6 +162,7 @@ impl From<RawCoverage> for Coverage {
|
|||
let raw_path: std::path::PathBuf =
|
||||
[&source.name, &class.filename].iter().collect();
|
||||
if let Ok(path) = std::fs::canonicalize(raw_path) {
|
||||
log::debug!("add file {:?} to coverage", path);
|
||||
files.insert(
|
||||
path,
|
||||
FileCoverage {
|
||||
|
@ -168,6 +172,7 @@ impl From<RawCoverage> for Coverage {
|
|||
);
|
||||
break;
|
||||
}
|
||||
log::warn!("could not add file {:?} to coverage", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ pub fn coverage<'doc>(
|
|||
|
||||
if let Some(document_path) = &doc.path {
|
||||
if let Some(file_coverage) = coverage::get_coverage(document_path) {
|
||||
log::debug!("return valid coverage gutter");
|
||||
log::info!("return valid coverage gutter for {:?}", document_path);
|
||||
return Box::new(
|
||||
move |line: usize, _selected: bool, _first_visual_line: bool, out: &mut String| {
|
||||
if let Some(line_coverage) = file_coverage.lines.get(&(line as u32)) {
|
||||
|
@ -172,7 +172,7 @@ pub fn coverage<'doc>(
|
|||
);
|
||||
}
|
||||
}
|
||||
log::debug!("return empty coverage gutter");
|
||||
log::info!("return empty coverage gutter for {:?}", document_path);
|
||||
return Box::new(move |_, _, _, _| None);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue