Add spelling suggestions to the Integrated Browser context menu - #333043
Conversation
The custom context menu replaced Chromium's, so misspelled words still get red underlines but right-click only showed Cut/Copy/Paste/Inspect. Surface dictionarySuggestions and Add to Dictionary via Electron's replaceMisspelling / addWordToSpellCheckerDictionary APIs.
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Kyle Cutler (@kycutler)Matched files:
Joaquín Ruales (@jruales)Matched files:
|
There was a problem hiding this comment.
Pull request overview
Adds spelling correction actions to the Integrated Browser context menu.
Changes:
- Displays Chromium spelling suggestions.
- Adds a localized Add to Dictionary action.
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| menu.append(new MenuItem({ | ||
| label: localize('browser.contextMenu.addToDictionary', 'Add to Dictionary'), | ||
| click: () => webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord) | ||
| })); |
There was a problem hiding this comment.
Fixed in 8655718. Add to Dictionary is only shown when webContents.session.isPersistent() is true (global persist / workspace-fromPath). Ephemeral sessions still get Chromium suggestions via replaceMisspelling. If there are no suggestions and the session cannot persist a dictionary word, the spelling section is omitted entirely.
|
@microsoft-github-policy-service agree company="Code No Evil, LLC" |
Electron's addWordToSpellCheckerDictionary returns false for ephemeral partitions, which Integrated Browser uses for untrusted workspaces and workbench.browser.dataStorage=ephemeral. Hide that item unless session.isPersistent(), and skip an empty spelling section when there are no suggestions either.
|
copilot-pull-request-reviewer addressed in 8655718 — Add to Dictionary is gated on |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Joaquín Ruales (jruales)
left a comment
There was a problem hiding this comment.
Thanks!
Fixes #333042
Problem
The Integrated Browser spellchecks editable fields (red underlines), but the custom context menu never reads
params.misspelledWord/params.dictionarySuggestions. Right-clicking a misspelled word only shows Cut / Copy / Paste / Inspect.Change
When the click is on a misspelled word:
webContents.replaceMisspelling)session.isPersistent()is true (ephemeral sessions used for untrusted workspaces /workbench.browser.dataStorage: ephemeralcannot persist that API)Inspect / Add Element to Chat are unchanged.
How to test
workbench.browser.dataStorage: ephemeral. Confirm suggestions still work and Add to Dictionary is not shown.