Skip to content

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

fix(core): false-positive after contraction (#3595)

Elijah Potterc08002e10291
diff --git a/harper-core/src/linting/disjoint_prefixes.rs b/harper-core/src/linting/disjoint_prefixes.rs
index 5f653fa02..3a1882014 100644
--- a/harper-core/src/linting/disjoint_prefixes.rs
+++ b/harper-core/src/linting/disjoint_prefixes.rs
@@ -77,7 +77,10 @@ where
let (pre, _) = ctx?;
// Cloud Native Pub-Sub System at Pinterest -> subsystem
- if pre.last().is_some_and(|p| p.kind.is_hyphen()) {
+ if pre
+ .last()
+ .is_some_and(|p| p.kind.is_hyphen() || p.kind.is_apostrophe())
+ {
return None;
}
@@ -169,6 +172,22 @@ mod tests {
);
}
+ #[test]
+ fn dont_join_contraction_suffix_after_ascii_apostrophe() {
+ assert_no_lints(
+ "you 're fresh so you don't neglect them",
+ DisjointPrefixes::new(FstDictionary::curated()),
+ );
+ }
+
+ #[test]
+ fn dont_join_contraction_suffix_after_typographic_apostrophe() {
+ assert_no_lints(
+ "you ’re fresh so you don’t neglect them",
+ DisjointPrefixes::new(FstDictionary::curated()),
+ );
+ }
+
#[test]
fn dont_join_open_co_op() {
assert_no_lints(