coc-ltex-plus 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -0
  3. package/lib/index.js +2319 -0
  4. package/package.json +700 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 SeniorMars
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,197 @@
1
+ # coc-ltex-plus
2
+
3
+ Grammar, spelling, and prose checking for coc.nvim powered by
4
+ [ltex-ls-plus](https://github.com/ltex-plus/ltex-ls-plus).
5
+
6
+ This extension starts `ltex-ls-plus` as a normal Coc language client and keeps
7
+ the standard `ltex.*` configuration surface used by LTEX.
8
+
9
+ The manifest includes the old extension's LTEX configuration keys for
10
+ completion and validation in `coc-settings.json`, including BibTeX fields,
11
+ LaTeX commands/environments, Markdown nodes, additional LanguageTool model
12
+ paths, Java heap sizing, and legacy LanguageTool aliases.
13
+
14
+ ## Install
15
+
16
+ Install from npm:
17
+
18
+ ```vim
19
+ :CocInstall coc-ltex-plus
20
+ ```
21
+
22
+ Install from a local tarball while developing:
23
+
24
+ ```sh
25
+ cd ~/.config/coc/extensions
26
+ npm install --ignore-scripts --no-package-lock --omit=dev --legacy-peer-deps --no-global /path/to/coc-ltex-plus-0.1.0.tgz
27
+ ```
28
+
29
+ Then restart Coc with `:CocRestart`.
30
+
31
+ You can let the extension manage `ltex-ls-plus`:
32
+
33
+ ```vim
34
+ :CocCommand ltex.installServer
35
+ :CocCommand ltex.updateServer
36
+ ```
37
+
38
+ Managed installs are stored in Coc extension storage. When `ltex.ltex-ls.path`
39
+ is unset, the extension resolves the server in this order:
40
+
41
+ 1. managed `ltex-ls-plus`
42
+ 2. `ltex-ls-plus` or `ltex-ls` from `$PATH`
43
+
44
+ If you prefer a manually installed server, install `ltex-ls-plus` separately
45
+ from the upstream releases and point the extension at either the extracted
46
+ directory or the executable:
47
+
48
+ ```jsonc
49
+ {
50
+ "ltex.ltex-ls.path": "~/Downloads/ltex-ls-plus-18.7.0/",
51
+ "ltex.java.path": "~/Downloads/ltex-ls-plus-18.7.0/jdk-21.0.10+7/",
52
+ "ltex.enabled": [
53
+ "bibtex",
54
+ "context",
55
+ "context.tex",
56
+ "html",
57
+ "latex",
58
+ "markdown",
59
+ "mdx",
60
+ "typst",
61
+ "org",
62
+ "quarto",
63
+ "rsweave",
64
+ "restructuredtext",
65
+ "mail",
66
+ "neorg",
67
+ "norg",
68
+ "help"
69
+ ],
70
+ "ltex.language": "en-US",
71
+ "ltex.additionalRules.motherTongue": "en-US",
72
+ "ltex.additionalRules.enablePickyRules": true,
73
+ "ltex.completionEnabled": false,
74
+ "ltex.sentenceCacheSize": 6000,
75
+ "ltex.languageToolHttpServerUri": "https://api.languagetoolplus.com",
76
+ "ltex.languageToolOrg.username": "your-email@example.com",
77
+ "ltex.languageToolOrg.apiKey": "your-api-key",
78
+ "ltex.latex.environments": {
79
+ "lstlisting": "ignore",
80
+ "verbatim": "ignore",
81
+ "minted": "ignore",
82
+ "leancode": "ignore"
83
+ },
84
+ "ltex.diagnosticSeverity": {
85
+ "MORFOLOGIK_RULE_EN_US": "error",
86
+ "EN_CONTRACTION_SPELLING": "error",
87
+ "EN_A_VS_AN": "error",
88
+ "CONFUSED_WORDS": "warning",
89
+ "UPPERCASE_SENTENCE_START": "warning",
90
+ "DATE_WEEKDAY": "warning",
91
+ "IN_A_X_MANNER": "hint",
92
+ "PASSIVE_VOICE": "hint",
93
+ "EN_SPECIFIC_CASE": "hint",
94
+ "APOS_AR": "hint",
95
+ "DOUBLE_HYPHEN": "hint",
96
+ "AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA": "hint",
97
+ "SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA": "hint",
98
+ "default": "information"
99
+ },
100
+ "ltex.configurationTarget": {
101
+ "dictionary": "userExternalFile",
102
+ "disabledRules": "userExternalFile",
103
+ "hiddenFalsePositives": "userExternalFile"
104
+ },
105
+ "ltex.checkFrequency": "save",
106
+ "ltex.trace.server": "verbose"
107
+ }
108
+ ```
109
+
110
+ Do not also configure `languageserver.ltex` or `languageserver.ltex-plus`;
111
+ that would start a second server outside this extension.
112
+
113
+ ## Persistence
114
+
115
+ LTEX code actions such as "Add to dictionary", "Disable rule", and "Hide false
116
+ positive" are persisted through the normal `ltex.configurationTarget` setting.
117
+ When an external file target is used, `coc-ltex-plus` caches the file contents,
118
+ watches existing files for changes, and appends only new entries. This keeps the
119
+ VS Code-style `ltex.dictionary.*.txt`, `ltex.disabledRules.*.txt`, and
120
+ `ltex.hiddenFalsePositives.*.txt` files as the source of truth without re-reading
121
+ or rewriting them unnecessarily.
122
+
123
+ Use `:CocList ltexSettings` to inspect, edit, or delete persisted dictionary,
124
+ disabled-rule, and hidden-false-positive entries for the current buffer. The
125
+ list includes both external-file entries and inline settings entries. It also
126
+ marks hidden false positives as `active`, `obsolete`, or `unknown`, can jump to
127
+ available diagnostic/context locations, and has a
128
+ `cleanupObsoleteHiddenFalsePositives` action. After an edit, deletion, or
129
+ cleanup, the extension reloads its external-file cache and notifies the server.
130
+ The `obsolete` label means the stored sentence was not found in the current
131
+ buffer; shared settings may still apply to other files.
132
+
133
+ Use `:CocCommand ltex.reloadExternalSettings` when external settings are edited
134
+ outside Coc. This clears and reloads the extension cache for open documents and
135
+ sends a configuration-change notification to `ltex-ls-plus`.
136
+
137
+ Additional runtime dictionary files can be loaded with:
138
+
139
+ ```jsonc
140
+ {
141
+ "ltex.dictionary.externalFiles": ["."]
142
+ }
143
+ ```
144
+
145
+ For each configured file or directory, `default.txt` entries apply to the
146
+ current buffer's relevant LTEX language set, and `<LANG>.txt` entries apply only
147
+ to that LTEX language. Directories also check a nested `dict/` directory, so a
148
+ project can keep shared terms in `dict/default.txt` and language-specific terms
149
+ in files such as `dict/en-US.txt`. Runtime dictionary entries are shown in
150
+ `:CocList ltexSettings`, but they are read-only there.
151
+
152
+ If you want LTEX to also use Vim/Neovim spell additions, enable:
153
+
154
+ ```jsonc
155
+ {
156
+ "ltex.dictionary.useSpellFile": true,
157
+ "ltex.languageFromSpellLang": true
158
+ }
159
+ ```
160
+
161
+ When enabled, `coc-ltex-plus` reads the current buffer's `spellfile` and
162
+ `spelllang` options and adds those spellfile entries to the LTeX dictionary for
163
+ that buffer's language. `ltex.languageFromSpellLang` additionally sends the
164
+ first supported `spelllang` value as the buffer's LTeX language. Both settings
165
+ are opt-in because not every Vim spell setup is meant to drive prose linting.
166
+
167
+ ## Commands
168
+
169
+ - `ltex.activateExtension`
170
+ - `ltex.restart`
171
+ - `ltex.resetAndRestart`
172
+ - `ltex.checkCurrentDocument`
173
+ - `ltex.checkSelection`
174
+ - `ltex.checkAllDocumentsInWorkspace`
175
+ - `ltex.clearDiagnosticsInCurrentDocument`
176
+ - `ltex.clearAllDiagnostics`
177
+ - `ltex.toggleDiagnostics`
178
+ - `ltex.showStatusInformation`
179
+ - `ltex.serverStatus`
180
+ - `ltex.showOutputChannel`
181
+ - `ltex.disableHere`
182
+ - `ltex.reloadExternalSettings`
183
+ - `ltex.installServer`
184
+ - `ltex.updateServer`
185
+ - `ltex.checkDuplicateServer`
186
+
187
+ ## Development
188
+
189
+ ```sh
190
+ npm run typecheck
191
+ npm test
192
+ npm run build
193
+ ```
194
+
195
+ ## License
196
+
197
+ MIT