emacs-languagetool / lsp-ltex Goto Github PK
View Code? Open in Web Editor NEWlsp-mode ❤️ LTEX
License: GNU General Public License v3.0
lsp-mode ❤️ LTEX
License: GNU General Public License v3.0
When one uses lsp-use-plists
(set-up according to the lsp-mode documentation), an error occurs while trying to use any code action. For example, trying to include XMonad
in the dictionary results in
lsp-ltex--code-action-add-to-dictionary: Wrong type argument: hash-table-p, (:uri "file:<URL>" :words (:en-US ["XMonad"]))
This seems to be because lsp-ltex--action-add-to-rules
expects (as the same suggests) action-ht
to be a hash-table
(defun lsp-ltex--action-add-to-rules (action-ht key rules-plist &optional store)
"Execute action ACTION-HT by getting KEY and storing it in the RULES-PLIST.
When STORE is non-nil, this will also store the new plist in the directory
`lsp-ltex-user-rules-path'."
(let ((args-ht (gethash key action-ht)))
(dolist (lang (hash-table-keys args-ht))
(mapc (lambda (rule)
(lsp-ltex--add-rule lang rule rules-plist)
(when store
(lsp-ltex--serialize-symbol rules-plist lsp-ltex-user-rules-path)))
(gethash lang args-ht)))))
However, this is a plist with the above configuration. Instead of e.g. gethash
, the generic lsp-get
should be used.
I’m using Doom Emacs and I want to use LTeX on windows (native) and WSL.
On WSL, everything works fine. But on native, I can’t install ltex. I’ve downloaded the latest version, but I don’t know how to put files with new paths
I use the .config structure, so
.config/doom for configuration files
.config/emacs for doom emacs
I’ve put LTeX in .local/cache, .local/cache/.cache, with latest or ltex-1.6.0.0, but none works. Any idea ?
I could set lsp-ltex-check-frequency
to "manual" but then how could I trigger a manual check? It seems there's command that invokes https://valentjn.github.io/ltex/vscode-ltex/commands.html#ltex-check-current-document .
ltex-ls
is already installed on my machine at /usr/bin/ltex-ls
(with the AUR’s ltex-ls-bin
package), yet each time I try to launch lsp in my org-mode buffer it tries to install the server. Thing is, it fails every time as it tries to install in the same path as the already existing ltex-ls
, regardless of the value of lsp-ltex-server-store-path
, even if ltex-ls
is not already installed.
I tried the following configurations:
(use-package lsp-ltex
:ensure t
:defer t
:straight (:build t)
:config
(setq lsp-ltex-mother-tongue "fr-FR"
lsp-ltex-server-store-path (executable-find "ltex-ls")
lsp-ltex-version
(gethash "ltex-ls"
(json-parse-string (shell-command-to-string "ltex-ls -V")))))
And
(use-package lsp-ltex
:defer t
:straight (:build t)
:config
(setq lsp-ltex-mother-tongue "fr-FR"
lsp-ltex-server-store-path (expand-file-name ".cache/lsp/ltex-ls" user-emacs-directory)
lsp-ltex-version
(gethash "ltex-ls"
(json-parse-string (shell-command-to-string "ltex-ls -V")))))
Both with the same result.
First of all, thank you for the initiative to publish lsp-ltex
that I have just discovered.
I take the initiative to open this issue because I tested lsp-ltex
with a text-mode
hook (which includes org-mode
) and I noticed that lsp-ltex
(or LanguageTool) cannot deal well when a file got a too many (~2653) of errors as shown below.
At each "edit" (can also be for each save) of the file, lsp-ltex
contacts LanguageTool with all the content of this file, which takes time and heats up my CPU. To avoid this issue, maybe it would be nice to propose to the user a variable to limit the use of LanguageTool for a file that contains a number of errors reaching a certain threshold. In other words, if lsp-ltex
would encounters a file that exceeds a certain number of errors, then it should does nothing or disables itself.
If you wondering, this is the config of lsp-ltex
that I use.
(use-package lsp-ltex
:hook (text-mode . lsp-deferred)
:custom
(lsp-ltex-enabled t)
(lsp-ltex-mother-tongue "fr"))
It is also possible that I can work around this problem by creating my own function that I hook and blacklist some files manually. However, probably an abstract solution to the user would be better.
Error (use-package): lsp-ltex/:catch: Symbol’s function definition is void: lsp-ltex--current-version
(setq lsp-ltex-latex-commands `((,(intern "\\code{}") . "dummy")))
Does not stop the server from marking spelling "mistakes" inside \code{someSymbol}
Basically, I want to use lsp-ltex in a directory with Spanish content. I put this into the .dir-local.el
inside the folder
;;; Directory Local Variables -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")
((markdown-mode . ((lsp-ltex-language . "es")
(ispell-local-dictionary . "spanish"))))
However, the variable lsp-ltex-language
is still on "en_US"
How could I set the language locally?
I would like to set up a list of technical words for the dictionary used by ltex.
I've tried
(setq lsp-ltex-dictionary "{\"en-US\": [\":~/myConfig/my-words.txt\"]}")
and
(setq lsp-ltex-dictionary "{\"en-US\": [\"quasiparticle\"]}")
but none of them works.
Does anyone know how to set up such a list? Thanks.
For example, the WHITESPACE_RULE
is useful many times, but not in a Git commit buffer.
Link to valentjn/ltex-ls#65
It would be great if lsp-ltex could work with eglot, thinking that it will be merged into master anytime soon.
Best.
Thank you for lsp-ltex!
I've got one question: how to make lsp-ltex org-mode aware? Regarding the documentation of the ltex server, org-mode should work out of the box, but for me it does not. lsp-ltex marks org-mode tags (e.g., “#+OPTIONS: …”) as spelling error.
Hi, I noticed the newer version of ltex-ls
has been released.
Will it be updated automatically?
I frequently edit .txt
or .md
files on remote machines. Could you please share an example on how to configure and use the package over Tramp? Thanks.
I get the following error when opening a Markdown file:
Error: JAVA_HOME is not defined correctly.
We cannot execute
Process ltex-ls stderr finished
I've downloaded ltex-ls-16.0.0-linux-x64.tar.gz
and extracted it in the right place, so I think it should work.
I'm on Ubuntu 22.04.2 LTS, on WSL2.
My config w.r.t. this package looks like this:
(use-package
lsp-ltex
:hook
(markdown-mode . lsp)
(rst-mode . lsp)
:init (setq lsp-ltex-version "16.0.0"))
My config looks like this:
(use-package
lsp-ltex
:hook
(markdown-mode . lsp)
(rst-mode . lsp)
:init (setq lsp-ltex-version "16.0.0"))
but when I open a .rst
file I get:
LSP :: There are no language servers supporting current mode `rst-mode' registered with `lsp-mode'.
I thought ltex-ls
supported reStructuredText.
First of all thanks for lsp-ltex
!
I got it running in mu4e's mu4e-compose-mode
on doomemacs with the following steps:
Before (use-package! lsp-ltex ...)
, pre-defining lsp-ltex-active-modes
makes lsp-ltex take the change. In my case:
(defcustom lsp-ltex-active-modes
'(text-mode
bibtex-mode context-mode
latex-mode LaTeX-mode ;; AUCTeX 14+ has renamed latex-mode to LaTeX-mode
markdown-mode org-mode
rst-mode
mu4e-compose-mode)
"List of major mode that work with LTEX Language Server."
:type 'list
:group 'lsp-ltex)
At that point lsp works when composing, with the following warning:
Warning (lsp-mode): Unable to calculate the languageId for buffer ‘XXX’. Take a look at ‘lsp-language-id-configuration’. The ‘major-mode’ is mu4e-compose-mode
So adding
(after! lsp-ltex
(appendq! lsp-language-id-configuration
'((mu4e-compose-mode . "plaintext"))))
gets that solved.
Could there be a more generic setting for the list of modes activated?
Hello,
can this package take advantage of LanguageTool's Premium features?
This is likely a problem with ltex-ls
but I thought I would report it here first and maybe someone can confirm it or help me get more info on the problem.
To maybe reproduce write the following in a buffer with ltex-ls
connected
We are looking for a semijoin equivalence.
The word semijoin will be underlined. C-c l a a
> Add 'semijoin' to dictionary
should make the the occurances of semijoin to be accepted but nothing happens.
Several days ago I updated all packages, including this one.
I found lsp-ltex
is not started after the update, without error messages.
It was fine before. Is there change that could possibly cause this issue?
Thanks!
lsp-ltex keep prompting me to install the language server after installing it.
follow the instruction and downloaded the server and extract it to "~/.emacs.d/.cache/lsp/ltex-ls/ltex-ls-15.2.0"
and yet the package can't seem to find the language server
Emacs version: GNU Emacs 28.0.90 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H1519)) of 2021-12-13
lsp-ltex version: 20211024.809
ltex-ls often offers suggestions, but these are not shown by lsp-ltex
. For example, with a file that contains this
She go home
running ltex-ls
(actually, ltex-cli
) from the command line will give
The pronoun 'she' is usually used with a third-person or a past tense verb. [HE_VERB_AGR]
she go home
Use 'goes'
Use 'went'
However, in Emacs I do not see the suggestions for using "goes" or "went".
The following is a screen capture
Minor suggestion to the README.md, that says "P.S. LanguageTool is built with Java, make sure you have environment variable JAVA_HOME set up"
Actually, lsp-ltex
runs just fine without setting JAVA_HOME if you download the standalone archives (for example, ltex-ls-15.2.0-linux-x64.tar.gz
from https://github.com/valentjn/ltex-ls/releases/download/15.2.0/ltex-ls-15.2.0-linux-x64.tar.gz). I simply downloaded and decompressed under ~/.emacs.d/.cache/lsp/ltex-ls/
.
I'm wondering, is it possible to read a dictionary of spellcheck-words to ignore from a file?
I've tried using one in a .vscode directory (actually the one VSCode generates), since the ltex-ls docs seem to indicate it will look for that file automatically. But it doesn't seem to find it in emacs.
Ideally, it would also be possible to add words, like #4 is asking about.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.