Merge pull request #2500 from rliang/texlab

[lsp] Add Texlab support
This commit is contained in:
w0rp 2019-05-13 20:17:35 +01:00 committed by GitHub
commit 70604828fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,21 @@
" Author: Ricardo Liang <ricardoliang@gmail.com>
" Description: Texlab language server (Rust rewrite)
call ale#Set('tex_texlab_executable', 'texlab')
call ale#Set('tex_texlab_options', '')
function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort
return ''
endfunction
function! ale_linters#tex#texlab#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'tex_texlab_options'))
endfunction
call ale#linter#Define('tex', {
\ 'name': 'texlab',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')},
\ 'command': function('ale_linters#tex#texlab#GetCommand'),
\ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'),
\})

View File

@ -236,6 +236,7 @@ Notes:
* `lacheck`
* `proselint`
* `redpen`
* `texlab`
* `textlint`
* `vale`
* `write-good`

View File

@ -53,5 +53,25 @@ g:ale_tex_latexindent_options *g:ale_tex_latexindent_options*
===============================================================================
texlab *ale-tex-texlab*
g:ale_tex_texlab_executable *g:ale_tex_texlab_executable*
*b:ale_tex_texlab_executable*
Type: |String|
Default: `'texlab'`
This variable can be changed to change the path to texlab.
g:ale_tex_texlab_options *g:ale_tex_texlab_options*
*b:ale_tex_texlab_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to texlab.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -2245,6 +2245,7 @@ documented in additional help files.
chktex................................|ale-tex-chktex|
lacheck...............................|ale-tex-lacheck|
latexindent...........................|ale-tex-latexindent|
texlab................................|ale-tex-texlab|
texinfo.................................|ale-texinfo-options|
write-good............................|ale-texinfo-write-good|
text....................................|ale-text-options|

View File

@ -245,6 +245,7 @@ formatting.
* [lacheck](https://www.ctan.org/pkg/lacheck)
* [proselint](http://proselint.com/)
* [redpen](http://redpen.cc/)
* [texlab](https://texlab.netlify.com) ([Rust rewrite](https://github.com/latex-lsp/texlab/tree/rust))
* [textlint](https://textlint.github.io/)
* [vale](https://github.com/ValeLint/vale)
* [write-good](https://github.com/btford/write-good)

View File

@ -0,0 +1,27 @@
Before:
call ale#assert#SetUpLinterTest('tex', 'texlab')
Save &filetype
let &filetype = 'tex'
After:
call ale#assert#TearDownLinterTest()
Execute(The language string should be correct):
AssertLSPLanguage 'tex'
Execute(The default executable path should be correct):
AssertLinter 'texlab', ale#Escape('texlab')
Execute(The project root should be detected correctly):
AssertLSPProject ''
Execute(The executable should be configurable):
let b:ale_tex_texlab_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar')
Execute(The options should be configurable):
let b:ale_tex_texlab_options = '-v'
AssertLinter 'texlab', ale#Escape('texlab') . ' ' . b:ale_tex_texlab_options