feat: Track path's column

This commit is contained in:
Ed Page 2020-03-31 19:52:53 -05:00 committed by Ed Page
parent f94c8c008f
commit 7c41be2c1a
2 changed files with 5 additions and 0 deletions

View file

@ -238,8 +238,10 @@ impl Checks {
if let Some(part) = path.file_name().and_then(|s| s.to_str()) {
for ident in parser.parse(part) {
if let Some(correction) = dictionary.correct_ident(ident) {
let col_num = ident.offset();
let msg = report::PathCorrection {
path,
col_num,
typo: ident.token(),
correction,
non_exhaustive: (),
@ -249,8 +251,10 @@ impl Checks {
} else {
for word in ident.split() {
if let Some(correction) = dictionary.correct_word(word) {
let col_num = word.offset();
let msg = report::PathCorrection {
path,
col_num,
typo: word.token(),
correction,
non_exhaustive: (),

View file

@ -40,6 +40,7 @@ pub struct Correction<'m> {
#[derive(Clone, Debug, serde::Serialize)]
pub struct PathCorrection<'m> {
pub path: &'m std::path::Path,
pub col_num: usize,
pub typo: &'m str,
pub correction: Cow<'m, str>,
#[serde(skip)]