Skip to content

Surface next-word predictions after a commit#44

Open
mkpoli wants to merge 1 commit into
feat/next-word-prediction-corefrom
feat/next-word-prediction-wiring
Open

Surface next-word predictions after a commit#44
mkpoli wants to merge 1 commit into
feat/next-word-prediction-corefrom
feat/next-word-prediction-wiring

Conversation

@mkpoli

@mkpoli mkpoli commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Stacked on #43 (targets feat/next-word-prediction-core; retarget to master once #43 merges).

Why

#43 added the prediction logic but nothing consumed it. This wires it into the live IME so the engine keeps working after a word is committed — the actual fix for "it only completes one word." Previously, once you committed a word the suggestion engine went dormant (key_event_sink.rs gated everything on a non-empty buffer) until you typed the next partial word.

What

After each commit (Kana mode, context_aware on), a popup shows the likely next words — no active composition. Per the chosen UX, acceptance is number-key only so normal typing is 100% untouched:

  • 1-9 → insert that prediction as finalized text, then chain into the prediction for the following word (the sentence-building feel);
  • Esc → dismiss;
  • Space / Enter / any other key → passes through unchanged and drops the popup (a space stays a space).

Implementation notes:

  • predicting state flag distinguishes the predictive popup from the completion popup.
  • The popup anchors to the focus caret via the existing GetGUIThreadInfo path (candidate_window.rs), so it positions correctly with no composition.
  • insert_committed mirrors commit but opens its own short-lived composition (there is none while predicting).
  • context_aware is the natural off-switch — no new config surface.

Verification

  • ✅ Builds and links the cdylib for x86_64-pc-windows-msvc (cargo xwin build --release); exports intact.
  • cargo clippy -D warnings clean on the MSVC target.
  • ⚠️ Behavioral verification on Windows is pending — TSF interaction (the popup, accept-and-insert, key gating) can't be exercised from Linux. Needs a Windows eyeball before we claim it works, same as the settings dialog.

To verify on Windows

  1. Switch to Kana mode, type + commit a word (Space).
  2. A numbered popup of likely next words should appear at the caret.
  3. Press a number → it inserts that word and immediately offers the next prediction.
  4. Confirm Space/Enter/typing behave exactly as before (popup just disappears).
  5. Toggle suggestions.context_aware = false → popup should not appear.

Wires `CandidateList::predictions` into the live IME so the suggestion
engine keeps working after a word is committed, instead of going dormant
until the next partial word is typed.

After each commit (Kana mode, `context_aware` on), a popup shows the
likely next words with no active composition. Acceptance is number-key
only, so normal typing is untouched:

  * 1-9 inserts that prediction as finalized text, then chains into the
    prediction for the following word (the sentence-building feel);
  * Esc dismisses the popup;
  * Space / Enter / any other key passes through unchanged and drops the
    popup (a space stays a space).

The popup anchors to the focus caret via the existing `GetGUIThreadInfo`
path, so it positions correctly without a composition. `insert_committed`
mirrors `commit` but opens its own short-lived composition since there is
none while predicting. `context_aware` is the natural off-switch.

Behavioral verification on Windows is still pending — TSF interaction
can't be exercised on Linux. Builds and links for the MSVC target and is
clippy-clean under `-D warnings`.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff3df12b-049e-42fb-b92c-23dd59610a98

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/next-word-prediction-wiring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant