From 8e2288b333f3eff4374d97bb5b93b4c57dcbbf92 Mon Sep 17 00:00:00 2001 From: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> Date: Tue, 19 May 2026 23:12:43 +0700 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20resolve=20#3362=20=E2=80=94=20sugges?= =?UTF-8?q?t=20`although`=20as=20a=20replacement=20for=20the=20typo=20`ath?= =?UTF-8?q?ough`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #3362 Signed-off-by: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> --- harper-core/src/linting/spell_check.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/harper-core/src/linting/spell_check.rs b/harper-core/src/linting/spell_check.rs index 715cc9a9b0..82876a0588 100644 --- a/harper-core/src/linting/spell_check.rs +++ b/harper-core/src/linting/spell_check.rs @@ -3,8 +3,8 @@ use std::num::NonZero; use lru::LruCache; use smallvec::ToSmallVec; -use super::Suggestion; use super::{Lint, LintKind, Linter}; +use super::{Suggestion, informal_laughter::is_informal_laughter}; use crate::document::Document; use crate::spell::{Dictionary, suggest_correct_spelling}; use crate::{CharString, CharStringExt, Dialect, TokenStringExt}; @@ -40,7 +40,7 @@ impl SpellCheck { } fn uncached_suggest_correct_spelling(&self, word: &[char]) -> Vec { // Back off until we find a match. - for dist in 2..5 { + for dist in 1..5 { let suggestions: Vec = suggest_correct_spelling(word, 200, dist, &self.dictionary) .into_iter() @@ -73,6 +73,10 @@ impl Linter for SpellCheck { for word in document.iter_words() { let word_chars = document.get_span_content(&word.span); + if is_informal_laughter(word_chars) { + continue; + } + if let Some(metadata) = word.kind.as_word().unwrap() && metadata.dialects.is_dialect_enabled(self.dialect) && (self.dictionary.contains_exact_word(word_chars) @@ -1007,4 +1011,14 @@ mod tests { "children's", ); } + + #[test] + fn allows_informal_laughter() { + for source in ["hahah", "hahaha", "hahahah", "Hahahah", "HAHAHA"] { + assert_no_lints( + source, + SpellCheck::new(FstDictionary::curated(), Dialect::American), + ); + } + } } From 9089a1a3db544cbe7cf6dab27d613282067c4e62 Mon Sep 17 00:00:00 2001 From: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> Date: Tue, 19 May 2026 23:12:44 +0700 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20resolve=20#3362=20=E2=80=94=20sugges?= =?UTF-8?q?t=20`although`=20as=20a=20replacement=20for=20the=20typo=20`ath?= =?UTF-8?q?ough`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #3362 Signed-off-by: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> --- harper-core/src/linting/spell_check.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/harper-core/src/linting/spell_check.rs b/harper-core/src/linting/spell_check.rs index 82876a0588..361bcf9cf4 100644 --- a/harper-core/src/linting/spell_check.rs +++ b/harper-core/src/linting/spell_check.rs @@ -40,7 +40,7 @@ impl SpellCheck { } fn uncached_suggest_correct_spelling(&self, word: &[char]) -> Vec { // Back off until we find a match. - for dist in 1..5 { + for dist in 2..5 { let suggestions: Vec = suggest_correct_spelling(word, 200, dist, &self.dictionary) .into_iter() @@ -154,6 +154,24 @@ mod tests { }; use crate::{DictWordMetadata, Document}; + #[test] + fn athough_suggests_although() { + assert_suggestion_result( + "athough it was late, we continued.", + SpellCheck::new(FstDictionary::curated(), Dialect::American), + "although it was late, we continued.", + ); + } + + #[test] + fn athough_suggests_although_capitalized() { + assert_suggestion_result( + "Athough it was late, we continued.", + SpellCheck::new(FstDictionary::curated(), Dialect::American), + "Although it was late, we continued.", + ); + } + // Capitalization tests #[test]