Yorùbá Code Spell Checker
Adds a Yorùbá dictionary to Code Spell
Checker
so it stops flagging Yorùbá words in comments, strings, and identifiers as
misspelled. Both toned (yorùbá) and plain-ASCII (yoruba) spellings are
accepted, regardless of which form you actually type.
How this works
This extension depends on Code Spell Checker
(extensionDependencies: ["streetsidesoftware.code-spell-checker"]).
src/extension.js activates on startup, resolves an absolute path to the
bundled cspell-ext.json via context.asAbsolutePath(), and registers it
with Code Spell Checker's exported registerConfig(path) API.
cspell-ext.json in turn declares dictionaryDefinitions/dictionaries
pointing at dictionaries/yoruba.txt.
This replaced an earlier v1 approach that tried to register the dictionary
via a static configurationDefaults.cSpell.customDictionaries entry with a
relative path. That doesn't work: Code Spell Checker's path resolver only
recognizes ./~/${workspaceFolder}/${root} as leading tokens, all of
which resolve against the user's workspace folder, never the contributing
extension's own install directory - confirmed by reading Code Spell
Checker's source directly (WorkspacePathResolver.mts), and by comparing
against streetsidesoftware/vscode-cspell-dict-extensions, the official
reference implementation every real published dictionary extension (French,
Medical Terms, etc.) is built from. There's no static-JSON way to reference
"this extension's own directory" - context.asAbsolutePath() only exists
at runtime, which is why this needs real extension-host code, not just a
different path string.
The dictionary
dictionaries/yoruba.txt (~7,300 words as of DICT-1) is generated by
npm run generate:wordlist, which runs scripts/build-real-wordlist.mjs.
It combines the ~400 snippet-vocabulary words with a Yorùbá stopword list and
translated sentiment lexicon sourced from NaijaSenti (CC-BY 4.0,
hausanlp/NaijaSenti - vendored in scripts/corpus-sources/naijasenti/,
attribution and full sourcing notes in docs/DATA_SOURCES.md). Both the
as-sourced spelling and its tone-mark-stripped ascii form are included for
every word.
Unlike data/vocab-snippets.csv's hand-curated 220 entries, these
corpus-derived words don't carry individual confirmed/draft confidence
tags - there are thousands of them, not twenty. Native-speaker review is
still valuable here (see VOCAB-1 in docs/BACKLOG.md and
CONTRIBUTING.md), just at the level of spot-checking and flagging bad
entries rather than reviewing each one individually before anything ships.
Try it locally
- Make sure Code Spell Checker is installed in your VS Code.
- Open this folder (
packages/yoruba-code-spell-checker) in VS Code.
- Press F5 to launch an Extension Development Host.
- Open a file and type a Yorùbá word from the dictionary in a comment -
confirm the red squiggle doesn't appear. Try both a toned and a
plain-ASCII spelling of the same word.
- If it's still flagged: open the Output panel, "Code Spell Checker"
channel, and check whether the
yoruba dictionary shows up as loaded -
that'll tell you whether registerConfig fired at all versus the
dictionary loading but not covering that particular word.