This commit is contained in:
Folkert 2020-03-31 23:54:14 +02:00
parent 48832ffa84
commit 8e8f93955e
3 changed files with 6 additions and 146 deletions

View file

@ -67,7 +67,7 @@ impl Color {
}
}
pub fn can_problem(filename: PathBuf, file_content: &str, problem: Problem) -> Report {
pub fn can_problem(filename: PathBuf, problem: Problem) -> Report {
let mut texts = Vec::new();
match problem {
@ -187,6 +187,7 @@ pub fn url(str: &str) -> ReportText {
Url(Box::from(str))
}
#[allow(dead_code)]
fn newline() -> ReportText {
plain_text("\n")
}
@ -508,28 +509,3 @@ impl ReportText {
}
}
}
pub fn region_slice<'a>(region: roc_region::all::Region, buffer: &'a str) -> &'a str {
let mut start = 0;
let mut end = 0;
let it = (0..).zip(buffer.lines());
for (index, line) in it {
if index < region.start_line as usize {
let size = line.len() + 1;
start += size;
} else if index < region.end_line as usize {
let size = line.len() + 1;
end += size;
} else {
break;
}
}
end += start;
start += region.start_col as usize;
end += region.end_col as usize;
&buffer[start..end]
}