Skip to content

Add spelling suggestions to the Integrated Browser context menu - #333043

Merged
Joaquín Ruales (jruales) merged 3 commits into
microsoft:mainfrom
davidbitton:fix/browser-spellcheck-context-menu
Aug 27, 2026
Merged

Add spelling suggestions to the Integrated Browser context menu#333043
Joaquín Ruales (jruales) merged 3 commits into
microsoft:mainfrom
davidbitton:fix/browser-spellcheck-context-menu

Conversation

@davidbitton

@davidbitton David B. Bitton (davidbitton) commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

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:

  • Prepend Chromium's suggestions (webContents.replaceMisspelling)
  • Offer Add to Dictionary only when session.isPersistent() is true (ephemeral sessions used for untrusted workspaces / workbench.browser.dataStorage: ephemeral cannot persist that API)
  • Omit an empty spelling section when there are no suggestions and the dictionary item is hidden

Inspect / Add Element to Chat are unchanged.

How to test

  1. Open an editable page in the Integrated Browser (trusted workspace, default storage).
  2. Type a misspelled word so it gets a red underline.
  3. Right-click the word.
  4. Confirm suggestions appear above the edit items, clicking one replaces the word, and Add to Dictionary clears the underline.
  5. Right-click a correctly spelled word and confirm the extra items are absent.
  6. Repeat in an untrusted workspace or with workbench.browser.dataStorage: ephemeral. Confirm suggestions still work and Add to Dictionary is not shown.

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.
Copilot AI balanced review requested due to automatic review settings August 27, 2026 21:17
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Kyle Cutler (@kycutler)

Matched files:

  • src/vs/platform/browserView/electron-main/browserViewMainService.ts

Joaquín Ruales (@jruales)

Matched files:

  • src/vs/platform/browserView/electron-main/browserViewMainService.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +577 to +580
menu.append(new MenuItem({
label: localize('browser.contextMenu.addToDictionary', 'Add to Dictionary'),
click: () => webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)
}));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@davidbitton

Copy link
Copy Markdown
Contributor Author

@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.
@davidbitton

Copy link
Copy Markdown
Contributor Author

copilot-pull-request-reviewer addressed in 8655718Add to Dictionary is gated on session.isPersistent() so it is not offered on ephemeral Integrated Browser sessions, where Electron would silently return false. Suggestions still work there via replaceMisspelling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@jruales Joaquín Ruales (jruales) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jruales
Joaquín Ruales (jruales) merged commit d03d523 into microsoft:main Aug 27, 2026
27 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 27, 2026
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.

Integrated Browser underlines misspellings but offers no way to fix them

4 participants