Khmer for VS Code: spellcheck with word segmentation in any document, the Khmer NiDA keyboard (typing mode and on-screen keyboard), visible zero-width spaces, and Khmer fonts for other extensions.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Khmer (ខ្មែរ) for VS Code, in any file: a spellchecker with word segmentation,
the Khmer NiDA keyboard — typing mode and on-screen keyboard — visible
zero-width spaces, and Khmer fonts for other extensions to use.
Features
Khmer spellcheck of every document — only its Khmer text is looked at.
It uses the Hunspell km_KH dictionary of the Open Lyric web editor, and
accepts an unspaced run of Khmer when it splits into dictionary words.
Quick Fixes on a flagged word (Ctrl+. / Cmd+.):
Try Khmer Segmentation — split the run at the dictionary words found
in it, separated by zero-width spaces;
up to three spelling suggestions;
Add to Custom Dictionary — stored in khmerLint.spellcheck.customWords.
Commands (Command Palette, Khmer Lint:):
Try Khmer Segmentation — segment every Khmer run in the selection (or
the whole document); also in the editor context menu with a selection.
Replace Spaces Between Khmer Words with Zero-Width Spaces — in the
selection, or the whole document.
Switch Keyboard (Ctrl+Alt+K, or the keyboard item in the status
bar): EN → ខ្មែរ → None → EN.
Show On-Screen Khmer Keyboard.
Khmer NiDA keyboard: in the ខ្មែរ mode, the keys of a text editor type the
NiDA layout — by key position, whatever the system keyboard layout is —
with Shift, Alt (Option) and Alt+Shift layers. Space types a zero-width
space (the Khmer word break) and Shift+Space a normal space. Ctrl/Cmd
shortcuts keep working.
On-screen Khmer keyboard: the Khmer Keyboard view in the panel is
the Open Lyric web editor's NiDA keyboard. Click its keys to type into your
editor; its layout menu (Khmer NiDA / English) switches between ខ្មែរ and
EN. It appears in EN and ខ្មែរ, and is gone in None.
Visible zero-width spaces: the zero-width space (the Khmer word break),
ZWNJ and ZWJ have no width of their own; Khmer Lint draws each one as a thin
bar where it sits, and two or more in a row as a red block, like the web
editor. (VS Code's own box around these three characters is turned off, so
they are not marked twice.)
Khmer fonts (the Battambang faces) for other extensions' webviews,
through the API — Open Lyric Khmer uses them in the Open Lyric preview.
Messages and Quick Fix titles spell out the invisible characters inside a word
as [ZWSP], [ZWNJ], [ZWJ].
Settings
Setting
Default
Effect
khmerLint.spellcheck.enable
true
Spellcheck Khmer text.
khmerLint.spellcheck.excludeLanguages
[]
Language ids not to spellcheck, e.g. ["log"].
khmerLint.spellcheck.diagnosticLevel
"warning"
error, warning, information or hint.
khmerLint.spellcheck.customWords
[]
Khmer words the spellchecker accepts.
khmerLint.highlightZeroWidthCharacters
true
Draw zero-width spaces, ZWNJ and ZWJ.
khmerLint.keyboard.showOnScreenKeyboard
true
Show the on-screen keyboard when switching to EN or ខ្មែរ.