feat(grammar): inline grammar checking via self-hosted LanguageTool #656

Merged
raisondetredev merged 1 commit from refs/pull/656/head into main 2026-06-21 14:14:45 +02:00
raisondetredev commented 2026-06-21 14:12:43 +02:00 (Migrated from codeberg.org)

Inline grammar checking via self-hosted LanguageTool (app side)

Adds inline spell/grammar checking to the AppFlowy editors, reached through the new check-grammar Supabase Edge Function that fronts a private self-hosted LanguageTool instance (mirrors execute-code -> Judge0). The device never sees the LanguageTool URL.

Included

  • grammar feature (lib/src/feature/grammar/): GrammarGateway + SupabaseGrammarGateway, models, language-code mapping, per-paragraph segmentation, GrammarCheckController (debounce on pause/blur, clear-on-edit), and a CustomPaint squiggle overlay with tap-to-apply fixes. The saved document is never mutated.
  • per-side languages: studysets gain front_language / back_language (Drift schema v47 + model/gateway/sync), set via pickers in the studyset edit sheet.
  • settings: a "Writing" on/off toggle (default on); when off, no check-grammar requests are made.
  • wired into: flashcard creator, edit sheet, answers editor, PDF flashcard editor, studyset description, and the note editor — gated by the toggle (off when no gateway is passed, so existing screens are unchanged).

Verification

  • flutter analyze clean (pre-existing issues only); new unit tests + existing widget suites pass.

Companion PR

Backend (function + migrations + LanguageTool container): project-halkyon/halkyon-infra#60 — required for a live run.

## Inline grammar checking via self-hosted LanguageTool (app side) Adds inline spell/grammar checking to the AppFlowy editors, reached through the new `check-grammar` Supabase Edge Function that fronts a private self-hosted LanguageTool instance (mirrors `execute-code` -> Judge0). The device never sees the LanguageTool URL. ### Included - **grammar feature** (`lib/src/feature/grammar/`): `GrammarGateway` + `SupabaseGrammarGateway`, models, language-code mapping, per-paragraph segmentation, `GrammarCheckController` (debounce on pause/blur, clear-on-edit), and a `CustomPaint` squiggle overlay with tap-to-apply fixes. **The saved document is never mutated.** - **per-side languages**: studysets gain `front_language` / `back_language` (Drift schema **v47** + model/gateway/sync), set via pickers in the studyset edit sheet. - **settings**: a "Writing" on/off toggle (default on); when off, no `check-grammar` requests are made. - **wired into**: flashcard creator, edit sheet, answers editor, PDF flashcard editor, studyset description, and the note editor — gated by the toggle (off when no gateway is passed, so existing screens are unchanged). ### Verification - `flutter analyze` clean (pre-existing issues only); new unit tests + existing widget suites pass. ### Companion PR Backend (function + migrations + LanguageTool container): project-halkyon/halkyon-infra#60 — required for a live run.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
project-halkyon/halkyon-learn!656
No description provided.