Web UI: do not rewrite the typed word when accepting an equal suggestion#109106
Conversation
In play.html, when the highlighted completion is the already-typed word in a different case (an "empty completion", e.g. HASH offered for a typed `hash`), pressing Right/Tab/Enter rewrote the word to the canonical case instead of doing nothing. Broaden the "nothing to do" guard in acceptCompletion so it fires whenever the completion adds no characters (the same word ignoring case), while still rewriting casing for real extensions (e.g. `se` -> `SELECT`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Workflow [PR], commit [d1b4001] Summary: ✅
AI ReviewSummaryThis PR updates Missing context / blind spots
Final Verdict✅ No new findings. |
Accepting the already-typed word (e.g. `HASH` offered for a typed `hash`) is a visible no-op, but it still incremented `completionUsage` for that word before the early return. That re-ranked later suggestions (the scorer would prefer `HASH` the next time `ha` was typed) even though nothing was inserted, so it was not a true no-op. Move the usage bump below the equal-word early return so acceptance is recorded only when we actually replace text. Real extensions such as `se` -> `SELECT` still record usage and rewrite casing as before. Addresses review feedback on `programs/server/play.html`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed The only non-flake-free CI red was |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Web UI (Play): when the highlighted completion is the same word that is already typed, just in a different case (e.g.
HASHoffered for a typedhash), pressing Right/Tab/Enter no longer rewrites the word to the canonical spelling — it is now a no-op.Details
In
programs/server/play.html, the suggestion popup keeps an "empty completion" for the word you have already typed so you can see it is recognized. That candidate is selected first and renders as empty text (nothing visible on the cursor line), while real extensions are shown below.Accepting a completion (Right / Tab / Enter, or click) replaces the typed identifier with the canonical-cased completion word, so that
sebecomesSELECT. But the guard that skipped this for the already-typed word only matched when the case was identical (word === prefix). If you typedhashandHASHwas the (invisible, selected) candidate, pressing Right silently rewrote yourhashintoHASH.This broadens the guard so accepting adds nothing whenever the completion is the same word ignoring case (an empty suffix — every candidate starts with the prefix, so equal length means equal word). Real extensions such as
se->SELECTstill rewrite casing as before.Version info
26.7.1.442(included in26.7and later)