Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(core): ignore blocking word-likes

Elijah Potter731d551a3b57
diff --git a/harper-core/src/linting/an_a.rs b/harper-core/src/linting/an_a.rs
index fb1e32716..2fe05e1b3 100644
--- a/harper-core/src/linting/an_a.rs
+++ b/harper-core/src/linting/an_a.rs
@@ -14,8 +14,13 @@ impl Linter for AnA {
for chunk in document.iter_chunks() {
for (first_idx, second_idx) in chunk.iter_word_indices().tuple_windows() {
- // [`TokenKind::Unlintable`] might be semantic words.
- if chunk[first_idx..second_idx].iter_unlintables().count() > 0 {
+ // [`TokenKind::Unlintable`] might have semantic meaning.
+ if chunk[first_idx..second_idx].iter_unlintables().count() > 0
+ || chunk[first_idx + 1..second_idx]
+ .iter_word_like_indices()
+ .count()
+ > 0
+ {
continue;
}
@@ -265,4 +270,9 @@ mod tests {
1,
);
}
+
+ #[test]
+ fn allow_issue_751() {
+ assert_lint_count("He got a 52% approval rating.", AnA, 0);
+ }
}