Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): don't merge with capital letters
Elijah Potterd781bf615cfb
diff --git a/harper-core/src/linting/compound_nouns/mod.rs b/harper-core/src/linting/compound_nouns/mod.rsindex 15c4a573e..466cb608c 100644--- a/harper-core/src/linting/compound_nouns/mod.rs+++ b/harper-core/src/linting/compound_nouns/mod.rs@@ -267,12 +267,6 @@ mod tests {);}- #[test]- fn allows_issue_722() {- assert_lint_count("Leaving S and K alone.", CompoundNouns::default(), 0);- assert_lint_count("Similarly an S with a line.", CompoundNouns::default(), 0);- }-#[test]fn allows_issue_721() {assert_lint_count(diff --git a/harper-core/src/linting/merge_words.rs b/harper-core/src/linting/merge_words.rsindex f9aa9ca56..7e945a9fc 100644--- a/harper-core/src/linting/merge_words.rs+++ b/harper-core/src/linting/merge_words.rs@@ -38,6 +38,12 @@ impl Linter for MergeWords {let a_chars = document.get_span_content(a.span);let b_chars = document.get_span_content(b.span);+ if (a_chars.len() == 1 && a_chars[0].is_uppercase())+ || (b_chars.len() == 1 && b_chars[0].is_uppercase())+ {+ continue;+ }+// Not super helpful in this case, so we skip itif matches!(a_chars, ['a']) || matches!(b_chars, ['a']) {continue;@@ -118,4 +124,10 @@ mod tests {fn that_is_contraction() {assert_suggestion_result("That s", MergeWords::default(), "That's");}++ #[test]+ fn allows_issue_722() {+ assert_lint_count("Leaving S and K alone.", MergeWords::default(), 0);+ assert_lint_count("Similarly an S with a line.", MergeWords::default(), 0);+ }}