From e4d2d0e54ddc484be95ba8988b7182ce17996d9e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 17 Mar 2023 23:47:25 -0500 Subject: [PATCH] fix: Actuall ignore ignored identifiers --- crates/typos-cli/src/dict.rs | 2 +- crates/typos-cli/src/policy.rs | 1 + .../typos-cli/tests/cmd/extend-ignore-identifiers-re.toml | 6 ------ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/typos-cli/src/dict.rs b/crates/typos-cli/src/dict.rs index 612f07e..e3eb16e 100644 --- a/crates/typos-cli/src/dict.rs +++ b/crates/typos-cli/src/dict.rs @@ -249,7 +249,7 @@ impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> { fn correct_ident<'s, 't>(&'s self, ident: typos::tokens::Identifier<'t>) -> Option> { for ignored in &self.ignored_identifiers { if ignored.is_match(ident.token()) { - return None; + return Some(Status::Valid); } } diff --git a/crates/typos-cli/src/policy.rs b/crates/typos-cli/src/policy.rs index fd4b71f..054729d 100644 --- a/crates/typos-cli/src/policy.rs +++ b/crates/typos-cli/src/policy.rs @@ -239,6 +239,7 @@ impl<'s> ConfigEngine<'s> { let dict = crate::dict::BuiltIn::new(dict_config.locale()); let mut dict = crate::dict::Override::new(dict); + dict.ignored_identifiers(dict_config.extend_ignore_identifiers_re()); dict.identifiers( dict_config .extend_identifiers() diff --git a/crates/typos-cli/tests/cmd/extend-ignore-identifiers-re.toml b/crates/typos-cli/tests/cmd/extend-ignore-identifiers-re.toml index cef8a56..60502eb 100644 --- a/crates/typos-cli/tests/cmd/extend-ignore-identifiers-re.toml +++ b/crates/typos-cli/tests/cmd/extend-ignore-identifiers-re.toml @@ -8,11 +8,5 @@ error: `hello` should be `goodbye` 1 | hello | ^^^^^ | -error: `hello` should be `goodbye` - --> ./file.ignore:1:1 - | -1 | hello - | ^^^^^ - | """ stderr = ""