Skip to content

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

feat: separate joined "afew" and "infact" (#1755)

Andrew Dunbar1d04da89d4d5
diff --git a/harper-core/src/linting/open_compounds.rs b/harper-core/src/linting/open_compounds.rs
index 2764121f3..2bc241084 100644
--- a/harper-core/src/linting/open_compounds.rs
+++ b/harper-core/src/linting/open_compounds.rs
@@ -1,6 +1,4 @@
-use crate::expr::Expr;
-use crate::expr::LongestMatchOf;
-use crate::expr::SequenceExpr;
+use crate::expr::{Expr, LongestMatchOf, SequenceExpr};
use crate::{Lrc, Token, patterns::WordSet};
use super::{ExprLinter, Lint, LintKind, Suggestion};
@@ -14,12 +12,14 @@ pub struct OpenCompounds {
impl Default for OpenCompounds {
fn default() -> Self {
let phrases = [
+ "a few",
"a lot",
"a while",
"as well",
"at least",
"each other",
"in case",
+ "in fact",
"in front",
];
let mut compound_to_phrase = HashMap::new();
@@ -239,6 +239,17 @@ mod tests {
);
}
+ // A few
+
+ #[test]
+ fn correct_afew_atomic() {
+ assert_suggestion_result(
+ "ITK code to generate anisotropic metrics, mostly Riemannian metrics and afew particular cases of Finslerian metrics.",
+ OpenCompounds::default(),
+ "ITK code to generate anisotropic metrics, mostly Riemannian metrics and a few particular cases of Finslerian metrics.",
+ );
+ }
+
// A lot
#[test]
@@ -406,4 +417,15 @@ mod tests {
0,
);
}
+
+ // In fact
+
+ #[test]
+ fn correct_infact_atomic() {
+ assert_suggestion_result(
+ "Yes I do infact exist :O",
+ OpenCompounds::default(),
+ "Yes I do in fact exist :O",
+ );
+ }
}