feat: support spell checker#1168
Open
PraveenDevamane wants to merge 13 commits intoAppFlowy-IO:mainfrom
Open
Conversation
LucasXu0
reviewed
Nov 25, 2025
There was a problem hiding this comment.
Pull request overview
This PR implements a comprehensive spell checking feature for the AppFlowy Editor, adding real-time dictionary-based spell checking with visual underlines, hover-based suggestion menus, and autocorrect functionality for desktop platforms.
Key Changes
- Dictionary-based spell checker with a 10,000-word dictionary and smart exclusion rules for technical terms, proper nouns, and code identifiers
- Visual spell check indicators with red wavy underlines for misspelled words integrated into the rich text rendering
- Interactive suggestion system with hover-based popup menus for word corrections and automatic word replacement
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
lib/src/service/spell_check/spell_checker.dart |
Core spell checker implementation with dictionary loading, word validation, Levenshtein-based suggestions, and grammatical variation detection |
lib/src/editor/block_component/rich_text/appflowy_rich_text.dart |
Integration of spell checking into rich text rendering with word tokenization, async checking, and visual underlines |
lib/src/editor/block_component/rich_text/spell_check_overlay.dart |
Hover-based overlay widget for displaying spell check suggestions and handling word replacements |
lib/src/editor/block_component/rich_text/spell_hover.dart |
Reusable hover widget for managing suggestion popups with mouse region handling |
lib/src/editor/editor_component/service/ime/delta_input_on_replace_impl.dart |
Desktop autocorrect integration that automatically applies top suggestions during text input |
test/spell_checker_test.dart |
Comprehensive test suite covering dictionary lookup, exclusion rules, suggestions, and grammatical variations |
pubspec.yaml |
Asset configuration to include the dictionary file |
assets/dictionary/words.txt |
10,000-word English dictionary for spell checking |
example/macos/Runner.xcodeproj/project.pbxproj |
macOS deployment target update from 10.14 to 10.15 |
example/macos/Podfile |
Podfile platform version update to match deployment target |
devtools_options.yaml |
New DevTools configuration file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/src/editor/block_component/rich_text/spell_check_overlay.dart
Outdated
Show resolved
Hide resolved
lib/src/editor/editor_component/service/ime/delta_input_on_replace_impl.dart
Outdated
Show resolved
Hide resolved
lib/src/editor/editor_component/service/ime/delta_input_on_replace_impl.dart
Show resolved
Hide resolved
- Add error logging for dictionary load failures - Extract spell check text span building into separate method - Add validation before auto-correct suggestions - Simplify hover handler with helper methods - Add cache size management (1000 items limit) - Replace magic numbers with named constants
Introduce AppFlowySpellCheckConfiguration class with: - minWordLength: control minimum characters to check (default: 3) - checkOnlyCompletedWords: check only after whitespace/punctuation - debounceDelay: delay before showing spell check underline - excludePatterns: regex patterns to exclude from checking - customDictionary: replace bundled dictionary with custom words This allows users to customize spell checking behavior for different use cases like code editing, technical writing, or non-English content.
Cancel all pending debounce timers in dispose() to prevent memory leaks and potential crashes when the widget is disposed during active spell checking.
Convert words.txt from 10,000 lines to a single line with space-separated words for better compactness. Update spell checker to split by whitespace instead of newlines.
Fix custom_lint warnings by adding blank lines before return statements as per newline_before_return rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the feature described in issue #1165: a real-time spell checker in the AppFlowy Editor. It includes dictionary loading, word scanning & suggestion generation, visual underlines for misspelled words, hover suggestion menus, and word replacement functionality — all integrated in a performant, non-intrusive way.