Add support for LTeX-LS non-standard commands #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
There are two commands provided by LTeX-LS,
_ltex.checkDocument
and_ltex.getServerStatus
. This adds an initial implementation of the two.The idea of this draft is to try to fix an issue with the current
lsp-ltex
.The problem
I'm using
lsp-ltex
while writing Org files, I've noticed it to be too slow when editing big files, which is very annoying.An idea to mitigate this issue
I don't know much about how LSP mode works internally, even for
lsp-ltex
, I don't see how LSP figures out what command to call when requesting corrections for the document. However, the_ltex.checkDocument
have an interesting feature (maybe, the same behavior can be achieved with other means) which allows requesting document checks for regions of the file.Here is the interface to send to LTeX-LS when requesting the command execution of
_ltex.checkDocument
:The idea is to leverage this to check the document incrementally, while typing, there is no interest to re-check the whole document if all we care about is the current paragraph! So we can send only the current paragraph (in the
:range
parameter) to avoid rechecking all the document even if it didn't change!The current implementation for
lsp-ltex-check-document
allows checking a region (for now, it is implemented synchronously, which should be changed to an aync implementation later). However, after checking a region, I need to disable and enableflycheck-mode
to see the wrong words (I don't know how to forceflycheck
to take new changes into account).This is just an idea, discussions are welcome, note that I might be slow to respond these days!