coc-ltex-plus
v0.1.0
Published
Grammar and prose checking for coc.nvim powered by ltex-ls-plus
Maintainers
Readme
coc-ltex-plus
Grammar, spelling, and prose checking for coc.nvim powered by ltex-ls-plus.
This extension starts ltex-ls-plus as a normal Coc language client and keeps
the standard ltex.* configuration surface used by LTEX.
The manifest includes the old extension's LTEX configuration keys for
completion and validation in coc-settings.json, including BibTeX fields,
LaTeX commands/environments, Markdown nodes, additional LanguageTool model
paths, Java heap sizing, and legacy LanguageTool aliases.
Install
Install from npm:
:CocInstall coc-ltex-plusInstall from a local tarball while developing:
cd ~/.config/coc/extensions
npm install --ignore-scripts --no-package-lock --omit=dev --legacy-peer-deps --no-global /path/to/coc-ltex-plus-0.1.0.tgzThen restart Coc with :CocRestart.
You can let the extension manage ltex-ls-plus:
:CocCommand ltex.installServer
:CocCommand ltex.updateServerManaged installs are stored in Coc extension storage. When ltex.ltex-ls.path
is unset, the extension resolves the server in this order:
- managed
ltex-ls-plus ltex-ls-plusorltex-lsfrom$PATH
If you prefer a manually installed server, install ltex-ls-plus separately
from the upstream releases and point the extension at either the extracted
directory or the executable:
{
"ltex.ltex-ls.path": "~/Downloads/ltex-ls-plus-18.7.0/",
"ltex.java.path": "~/Downloads/ltex-ls-plus-18.7.0/jdk-21.0.10+7/",
"ltex.enabled": [
"bibtex",
"context",
"context.tex",
"html",
"latex",
"markdown",
"mdx",
"typst",
"org",
"quarto",
"rsweave",
"restructuredtext",
"mail",
"neorg",
"norg",
"help"
],
"ltex.language": "en-US",
"ltex.additionalRules.motherTongue": "en-US",
"ltex.additionalRules.enablePickyRules": true,
"ltex.completionEnabled": false,
"ltex.sentenceCacheSize": 6000,
"ltex.languageToolHttpServerUri": "https://api.languagetoolplus.com",
"ltex.languageToolOrg.username": "[email protected]",
"ltex.languageToolOrg.apiKey": "your-api-key",
"ltex.latex.environments": {
"lstlisting": "ignore",
"verbatim": "ignore",
"minted": "ignore",
"leancode": "ignore"
},
"ltex.diagnosticSeverity": {
"MORFOLOGIK_RULE_EN_US": "error",
"EN_CONTRACTION_SPELLING": "error",
"EN_A_VS_AN": "error",
"CONFUSED_WORDS": "warning",
"UPPERCASE_SENTENCE_START": "warning",
"DATE_WEEKDAY": "warning",
"IN_A_X_MANNER": "hint",
"PASSIVE_VOICE": "hint",
"EN_SPECIFIC_CASE": "hint",
"APOS_AR": "hint",
"DOUBLE_HYPHEN": "hint",
"AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA": "hint",
"SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA": "hint",
"default": "information"
},
"ltex.configurationTarget": {
"dictionary": "userExternalFile",
"disabledRules": "userExternalFile",
"hiddenFalsePositives": "userExternalFile"
},
"ltex.checkFrequency": "save",
"ltex.trace.server": "verbose"
}Do not also configure languageserver.ltex or languageserver.ltex-plus;
that would start a second server outside this extension.
Persistence
LTEX code actions such as "Add to dictionary", "Disable rule", and "Hide false
positive" are persisted through the normal ltex.configurationTarget setting.
When an external file target is used, coc-ltex-plus caches the file contents,
watches existing files for changes, and appends only new entries. This keeps the
VS Code-style ltex.dictionary.*.txt, ltex.disabledRules.*.txt, and
ltex.hiddenFalsePositives.*.txt files as the source of truth without re-reading
or rewriting them unnecessarily.
Use :CocList ltexSettings to inspect, edit, or delete persisted dictionary,
disabled-rule, and hidden-false-positive entries for the current buffer. The
list includes both external-file entries and inline settings entries. It also
marks hidden false positives as active, obsolete, or unknown, can jump to
available diagnostic/context locations, and has a
cleanupObsoleteHiddenFalsePositives action. After an edit, deletion, or
cleanup, the extension reloads its external-file cache and notifies the server.
The obsolete label means the stored sentence was not found in the current
buffer; shared settings may still apply to other files.
Use :CocCommand ltex.reloadExternalSettings when external settings are edited
outside Coc. This clears and reloads the extension cache for open documents and
sends a configuration-change notification to ltex-ls-plus.
Additional runtime dictionary files can be loaded with:
{
"ltex.dictionary.externalFiles": ["."]
}For each configured file or directory, default.txt entries apply to the
current buffer's relevant LTEX language set, and <LANG>.txt entries apply only
to that LTEX language. Directories also check a nested dict/ directory, so a
project can keep shared terms in dict/default.txt and language-specific terms
in files such as dict/en-US.txt. Runtime dictionary entries are shown in
:CocList ltexSettings, but they are read-only there.
If you want LTEX to also use Vim/Neovim spell additions, enable:
{
"ltex.dictionary.useSpellFile": true,
"ltex.languageFromSpellLang": true
}When enabled, coc-ltex-plus reads the current buffer's spellfile and
spelllang options and adds those spellfile entries to the LTeX dictionary for
that buffer's language. ltex.languageFromSpellLang additionally sends the
first supported spelllang value as the buffer's LTeX language. Both settings
are opt-in because not every Vim spell setup is meant to drive prose linting.
Commands
ltex.activateExtensionltex.restartltex.resetAndRestartltex.checkCurrentDocumentltex.checkSelectionltex.checkAllDocumentsInWorkspaceltex.clearDiagnosticsInCurrentDocumentltex.clearAllDiagnosticsltex.toggleDiagnosticsltex.showStatusInformationltex.serverStatusltex.showOutputChannelltex.disableHereltex.reloadExternalSettingsltex.installServerltex.updateServerltex.checkDuplicateServer
Development
npm run typecheck
npm test
npm run buildLicense
MIT
