diff --git a/src/main.rs b/src/main.rs index 5be3bb0..792f426 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,6 @@ use comment_parser::CommentParser; use ignore::Walk; use regex::Regex; -// TODO: Line number location breaks when multiple remainders exist with same content - // TODO: Add language support for tsx, jsx, lua #[derive(Debug)] @@ -17,17 +15,15 @@ struct Reminder { static ALLOWED_VERBS: [&str; 3] = ["TODO", "FIXME", "BUG"]; -fn get_row_and_column(contents: &str, substr: &str) -> (u32, u32) { - let occurence = contents.find(substr).unwrap(); +fn get_row_and_column(contents: &str, substr: &str, from: usize) -> (u32, u32) { + let occurence = contents[from..].find(substr).unwrap() + from; let row = (contents.chars().take(occurence).filter(|c| *c == '\n').count()+1) as u32; let col = (occurence - contents[..occurence].rfind('\n').unwrap_or(0)) as u32; (row, col) } -fn list_reminders
(path: P) -> Vec