dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.43k forks source link

Add support for ltex-ls (latex grammar checking) #4040

Open f0rki opened 2 years ago

f0rki commented 2 years ago

Name: ltex-ls URL: https://valentjn.github.io/ltex/, (code at https://github.com/valentjn/ltex-ls)

LTEX LS (LTEX Language Server) implements a language server according to the Language Server Protocol (LSP) and provides grammar and spelling errors in markup documents (LATEX, Markdown, etc.). The documents are checked with LanguageTool.

At least the vscode client for ltex-ls seems to work pretty well. I haven't found a spell and grammar checking tool for latex that works well for me, but this one looks promising. There are also some neovim plugins using the built-in LSP support (here is a list of client editor plugins), but I don't use that so ALE integration would very nice :)

vm70 commented 2 months ago

I've been trying to get LTeX's LSP to work properly with ALE, but it's not reporting any diagnostics that its corresponding CLI tool ltex-cli does. Here's what I have so far.

" in ~/.vim/vimrc
call ale#linter#Define('markdown', {
\   'name': 'ltex',
\   'lsp': 'stdio',
\   'executable': '/opt/ltex-ls-16.0.0/bin/ltex-ls',
\   'command': '%e --server-type=StandardStream --log-file=ltex-log.out',
\   'project_root': '~',
\})
" in ~/.vim/ftplugin/markdown.vim
let b:ale_linters = ['ltex']
<!-- :ALEInfo Window -->

Command History:

(executable check - success) /opt/ltex-ls-16.0.0/bin/ltex-ls
vm70 commented 2 months ago

I'm not an expert on the language server protocol, but I think LTeX isn't working with ALE because ALE can't handle unknown JSON RPC requests (see #4610).