Journal: British spellings in ltex-ls and Helix

While I wait for Helix to gain native spell-checking, I installed ltex-ls. This is a language server for the open source LanguageTool, which checks both spelling and grammar. By default, however, ltex-ls uses American English. As a Brit, accusatory little dots in the editor’s gutter because I had the temerity to use “u” in “favourite” quickly became irritating.

Fortunately, ltex-ls supports a lot of languages. However, I wasn’t sure how to to set en-GB as my language in the Helix configuration. In the end, I went to the languages.toml file in the Helix source code. This file is built into Helix, and sets its (programming) language defaults. It is a gold mine for understanding what’s possible in your own languages.toml file.

After poking about for a while, I figured it out. I’d read the Helix configuration documentation for language servers as saying that the config field in a language definition was usable only for passing formatting information to the language server. But that isn’t the case at all.

To set the language used for spell-checking, in your ~/.config/helix/languages.toml file (create it if it doesn’t exist), add the ltex.language option in the config block like this:

name = "markdown"
language-server = { command = "/Users/mike/bin/ltex-ls/bin/ltex-ls" }
config = { ltex.language = "en-GB" }

And there you have it 🌟

← Older
New Hires: Learn how the system breaks
→ Newer
Mini-project: mdanchored