Skip to content

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

fix: skip PronounVerbAgreement for hyphenated compounds (#3095)

Matt Van Horna55f1c30428a
diff --git a/harper-core/src/linting/pronoun_verb_agreement.rs b/harper-core/src/linting/pronoun_verb_agreement.rs
index 2940742c8..e0d020d53 100644
--- a/harper-core/src/linting/pronoun_verb_agreement.rs
+++ b/harper-core/src/linting/pronoun_verb_agreement.rs
@@ -185,6 +185,13 @@ where
let pron_tok = &toks[0];
let is_3psg = pron_tok.kind.is_third_person_singular_pronoun();
+ // Skip when the pronoun is part of a hyphenated compound (e.g. "co-founded").
+ // The tokenizer splits "co-founded" into separate tokens, but "co" as a prefix
+ // is not acting as a pronoun.
+ if pron_tok.span.end < src.len() && src[pron_tok.span.end] == '-' {
+ return None;
+ }
+
let verb_tok = toks.last()?;
if let Some((before, _)) = ctx