dsh-spell-suggestions
osman3n/dsh-spell-suggestions
Right-click menu inside the message composer: for the word under the cursor it checks a bundled English frequency dictionary of about 30,000 words plus a curated list of 182 common misspellings, and offers corrections ranked by edit distance and then word frequency. The same menu keeps add-to-dictionary, cut, copy, paste, select all, undo and redo. The dictionary and the menu are local, so nothing is sent over the network.
설치
dsh plugin --profile web add github:osman3n/dsh-spell-suggestionsREADME
Composer spellcheck
Right-click a word in the message composer and get spelling suggestions, with the usual editing commands in the same menu.
Install
The browser half is prebuilt and committed (client.js), so there is no build
step and no network access at runtime.
- In the app, open the plugin manager (Settings → Plugins) and install from a local folder, pointing at a checkout of this repository.
- Reload the window (
Ctrl+R). The browser half is loaded per page load, so the menu only appears after a reload.
For scripted installs, dsh plugin --profile <name> add <path-or-git-url>
installs the package half; the profile's dsh.profile.bundles list also needs
this package (the plugin manager does both steps).
What it does
- Adds a capture-phase
contextmenulistener ondocument. It only claims events whose target sits inside the composer ([data-composer-input], the Lexical editor), so every other right-click in the app behaves exactly as before. - Works out the word under the pointer, checks it against a bundled dictionary,
and opens the shared Web context menu (
ctx.contextMenus) with:- up to five suggestions, ranked by edit distance and then word frequency;
- Add to dictionary — remembered in
localStorageunderdsh.composer-spellcheck.user-words; - a separator, then Cut, Copy, Paste, Select all, Undo, Redo, so the default menu functions the shell would otherwise offer are still available.
- A word that is already known still gets the editing block, so the menu is useful for correct text too. Words the dictionary cannot match show “No suggestions” plus the same editing commands.
- Suggestions keep the original capitalisation:
Recieve→Receive.
The composer is a Lexical editor; Chromium's own squiggles are untouched. This plugin supplies the menu that makes them actionable in the desktop shell, which has no native context menu at all.
Files
| Path | Purpose |
|---|---|
index.js | Host half — no service, exists so the Loader entry mounts. |
client.js | Built browser half: listener, suggestion engine, menu contribution. |
src/client.template.js | Source template with __WORDS__ / __EXTRA__ / __DROP__ / __TYPOS__ placeholders. |
src/allowlist.txt | Extra known words for technical writing (one per line). |
src/typos.json | Curated misspelling → correction pairs, including typed contractions (dont → don't). |
tools/prepare-words.mjs | Downloads the frequency list once into .tmp/, filters and writes .tmp/words.json. |
tools/build-client.mjs | Injects the word data into the template and writes client.js. |
tools/test-client.mjs | Loads the built bundle through a stub loader, applies it to a fake contextMenus, and checks suggestions and timing. |
Rebuild
# from the repository root
node tools/prepare-words.mjs --limit=30000 --min-count=2 # only when refreshing the word list
node tools/build-client.mjs
node tools/test-client.mjs
prepare-words.mjs downloads the frequency list once into .tmp/ (git-ignored);
the other two scripts need nothing beyond Node.js, so a fresh clone can rebuild
client.js offline.
Reload the app window afterwards; the browser half is loaded per page load.
Dictionary
~30k words from the FrequencyWords
English list (CC-BY-SA), plus the allowlist, plus the curated corrections.
Informal spellings that the corpus contains (dont, cant, youre, …) are
dropped, because the curated map treats them as misspellings and they would
otherwise never get suggestions.
Limits
- Only the composer is covered. Menu entries appear at the pointer; the menu itself is the app's shared Web menu, so keyboard navigation and dismissal are the platform's.
- Suggestions come from the bundled dictionary, not from the operating system's spellchecker, so the set of underlined words and the set of words with suggestions can differ slightly.
License
MIT — see LICENSE.
The bundled word list comes from
FrequencyWords, which is
distributed under CC-BY-SA; the curated misspelling table in src/typos.json is
original to this project.