Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): allow choosing spell check languages #15996

ClosedLuca-Lucidera(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/15996/headopened View on GitHub

Problem

The packaged Windows/Linux desktop app starts with en-US spell checking, so correct text in other languages receives false underlines. Users cannot choose another dictionary through the app.

Fixes #7742. The packaged build ships only the en-US Electron locale, so Electron seeds the spell checker with en-US; the composer editable still receives native spell checking.

Change

Add Settings → General → Spell check languages, with a searchable picker using Electron's supported languages. Users can select multiple dictionaries and remove selections while keeping at least one language.

Changes apply to the desktop session immediately. Existing underlines refresh on the next edit, and Chromium persists the selection. The picker shares state across settings mounts, lets only the newest change settle it, and re-reads desktop state after a failed update.

The IPC contract, preload bridge, settings search, focused tests, and composer guide support this same configuration option. The row and search result are hidden on macOS (the OS checker detects the language itself and Electron ignores the list there), in browsers, and in older desktop shells without the bridge methods.

Scope and approval

This uses CONTRIBUTING.md's focused-configuration exception: native spell checking already exists, and the option controls its dictionaries. Electron's existing default remains unchanged. There is no automatic locale selection, disable toggle, startup override, or app-managed persistence.

#7745 and #7866 were closed on September 7 because composer spell checking was believed to be disabled. Inspection of current main and commit 0d34579d67 shows spellCheck={false} on inline chips, not the composer editable. Those closures are history, not approval for this implementation.

Verification

Environment: Ubuntu 24.04.5 LTS, Linux 7.0.0, GNOME with X11 via Xwayland, Electron 44.4.2, and the dev desktop build from cf3e714b0f plus this change. System locale: it_IT.UTF-8. Before captures used LANG=en_US.UTF-8 to reproduce the packaged app's en-US behavior.

Manual checks:

  • Type Italian in the composer: correct words are underlined with en-US selected.
  • Search Settings for "spell", select Italian, and return to the composer: the false underlines disappear after editing.
  • An en-US selection stays en-US after restarting; startup does not change it.
  • Italian selected through the picker survives restarting after Chromium's approximately 10-second preference write window.
  • A standalone Electron experiment verified persistence after a clean app.quit() 1.5 seconds after the change. A crash or forced kill before the write completes can lose the selection.

Focused checks:

  • apps/desktop: vp test run src/ipc/methods/spellCheck.test.ts — 4 tests passed.
  • apps/web: vp test run src/state/desktopSpellCheck.test.ts src/components/settings/settingsSearch.test.ts — 66 tests passed.
  • tsc --noEmit passed in contracts, desktop, and web. Desktop reports an existing suggestion in DesktopClerk.test.ts.
  • Targeted vp lint passed, with existing warnings in unchanged SettingsPanels.tsx code.

Not checked: packaged artifacts or real Windows/macOS hardware. macOS behavior follows Electron's documented native-checker behavior. Browser and mobile spell checking are unchanged.

Before and after, top to bottom:

Composer before and after selecting Italian

General settings before and after adding the language picker

Picker with search and multiple selection:

Spell check language picker

Recording https://github.com/user-attachments/assets/fdd58298-6aad-4d30-88eb-b7d8f747ba51

Implementation: Claude Opus 5.5 (xhigh) via Claude Code in T3 Code. Review: GPT-6.1-Sol (high) via Codex in T3 Code.

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR introduces a new cross-layer desktop settings workflow for selecting and persisting spell-check dictionaries, including new UI, IPC handlers, bridge contracts, and shared state. The existing default remains unchanged, but the capability and integration are substantial enough to warrant human review.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: a3b0478f-c88e-440e-97f8-94577706d949
      📥 Commits

      Reviewing files that changed from the base of the PR and between cf3e714b0f58e29c8fa8660db50d2187e3263b65 and 5307f70bc80b1fff0a8dd2e743ea6c9437474652.

      📒 Files selected for processing (13)
      • apps/desktop/src/ipc/DesktopIpcHandlers.ts
      • apps/desktop/src/ipc/channels.ts
      • apps/desktop/src/ipc/methods/spellCheck.test.ts
      • apps/desktop/src/ipc/methods/spellCheck.ts
      • apps/desktop/src/preload.ts
      • apps/web/src/components/settings/SettingsPanels.tsx
      • apps/web/src/components/settings/SpellCheckSettings.tsx
      • apps/web/src/components/settings/settingsSearch.test.ts
      • apps/web/src/components/settings/settingsSearch.ts
      • apps/web/src/state/desktopSpellCheck.test.ts
      • apps/web/src/state/desktopSpellCheck.ts
      • docs/user/composer.md
      • packages/contracts/src/ipc.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      Adds desktop IPC and bridge support for spell-check state and language updates. Adds a language selector to desktop settings, with state management and search filtering, and documents spell-check behavior across platforms.

      Changes

      Desktop spell-check language selection

      Layer / File(s)Summary
      IPC contract and Electron session operations
      packages/contracts/src/ipc.ts, apps/desktop/src/ipc/channels.ts, apps/desktop/src/ipc/methods/spellCheck.ts, apps/desktop/src/ipc/DesktopIpcHandlers.ts, apps/desktop/src/preload.ts, apps/desktop/src/ipc/methods/spellCheck.test.ts
      Defines spell-check state and language-list contracts. Adds IPC handlers and desktop bridge methods to read and update Electron spell-check languages. macOS returns null; update failures use SpellCheckLanguagesError.
      Web spell-check state management
      apps/web/src/state/desktopSpellCheck.ts, apps/web/src/state/desktopSpellCheck.test.ts
      Adds shared spell-check state and language updates. The store ignores stale reads and replies and tests these cases, along with rejected updates and empty language lists.
      Settings and search integration
      apps/web/src/components/settings/SpellCheckSettings.tsx, apps/web/src/components/settings/SettingsPanels.tsx, apps/web/src/components/settings/settingsSearch.ts, apps/web/src/components/settings/settingsSearch.test.ts, docs/user/composer.md
      Adds a searchable language selector to General settings and filters its search entry by platform and bridge availability. Documents platform behavior and dictionary downloads.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~25 minutes

      Change: Feature · Severity of issue fixed: Low

      Sequence Diagram(s)

      sequenceDiagram
        participant SpellCheckLanguagesSetting
        participant desktopSpellCheckStore
        participant DesktopBridge
        participant DesktopIpcHandlers
        participant ElectronDefaultSession
        SpellCheckLanguagesSetting->>desktopSpellCheckStore: Refresh spell-check state
        desktopSpellCheckStore->>DesktopBridge: getSpellCheckState
        DesktopBridge->>DesktopIpcHandlers: Invoke state IPC channel
        DesktopIpcHandlers->>ElectronDefaultSession: Read available and configured languages
        ElectronDefaultSession-->>DesktopIpcHandlers: Return spell-check languages
        SpellCheckLanguagesSetting->>desktopSpellCheckStore: Submit selected languages
        desktopSpellCheckStore->>DesktopBridge: setSpellCheckLanguages
        DesktopBridge->>DesktopIpcHandlers: Invoke language update IPC channel
        DesktopIpcHandlers->>ElectronDefaultSession: Set spell-check languages

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 5307f

      This adds a spell-check language picker for Windows and Linux desktop. The control is hidden on macOS, in browsers, and in older shells without the bridge methods. No merge-blocking risk was found.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 5307f

      The new capability is limited to choosing spelling dictionaries for the desktop app. Validation and compatibility checks constrain its impact, and no material security issue was established. Native dictionary downloads and some failure-recovery behavior remain incompletely verified.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — A script already able to invoke desktopBridge gains access to language lists and the ability to change the local user's default-session spell-check preference. The new handler exposes no arbitrary session, cookie, credential, filesystem, or remote-environment operation. The preference is shared within that session and documented as persistent across restarts.

      Trust Boundaries and Controls

      • observed — The new methods use the existing IPC registration and schema-validation path, which forwards sender information without authorizing sender or origin. This inherited condition is unchanged by the PR. The inspected main application window remains sandboxed and context-isolated with Node integration disabled, denies new windows, and prevents cross-origin navigation.
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 12 files. (1 skipped: …Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ Passed#7742 requests a way to choose spell-check dictionaries, with a disable control as an alternative and both preferred. The General settings picker searches Electron’s available languages, supports mult…
      Out of Scope Changes check✅ PassedThe IPC contract, preload bridge, shared settings state, settings search filters, tests, and composer documentation all support the dictionary picker requested by #7742. The changes do not add unrelat…
      Title check✅ PassedThe title clearly and concisely describes the main change: allowing users to choose desktop spell-check languages.
      Description check✅ PassedThe description covers the required Problem, Change, Scope and approval, and Verification sections. It explains the focused-configuration exception, reports tests and manual checks, states limitations…
      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 12 files. (1 skipped: 1 unsupported.)

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. Note

      Written by gpt-6.1-sol on behalf of Maria

      Thanks for documenting the false spell-check underlines on Windows and Linux. Right now we are only taking focused bug fixes from outside contributors, and this unvouched submission exceeds our current 500-line review limit with 569 changed lines across 13 files. This is a review-capacity decision under Read this first, rather than a published size cutoff in the guide. Please keep the packaged-app reproduction in #7742 and discuss a smaller fix with maintainers before requesting reconsideration.

    6. maria-rcks closed this

Sign in to join this conversation.