1
0

handle all lines seperatly for multi-line comments

This commit is contained in:
Rokas Puzonas 2022-08-04 14:19:03 +03:00
parent e3e9386580
commit de8e5cc7ae

View File

@ -47,18 +47,20 @@ where
let parser = CommentParser::new(&file_contents, rules); let parser = CommentParser::new(&file_contents, rules);
for comment in parser { for comment in parser {
let text = comment.text().trim_start(); let text = comment.text().trim_start();
if !reminder_pattern.is_match(text) { continue; } for line in text.lines() {
if !reminder_pattern.is_match(line) { continue; }
let is_allowed = ALLOWED_VERBS.into_iter().any(|v| text.starts_with(v)); let is_allowed = ALLOWED_VERBS.into_iter().any(|v| line.starts_with(v));
if !is_allowed { continue; } if !is_allowed { continue; }
let (row, col) = get_row_and_column(&file_contents, text); let (row, col) = get_row_and_column(&file_contents, line);
reminders.push(Reminder { reminders.push(Reminder {
file: path.to_path_buf(), file: path.to_path_buf(),
row, row,
col, col,
contents: text.lines().next().unwrap().into() contents: line.into()
}) })
}
} }
} }