mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
feat: Track path's column
This commit is contained in:
parent
f94c8c008f
commit
7c41be2c1a
2 changed files with 5 additions and 0 deletions
|
@ -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: (),
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Reference in a new issue