80a48d01be
* Fix texlab GetProjectRoot * Fix indents in texlab#GetProjectRoot * Prevent texlab from starting on every tex file * Update texlab Vader tests * Fix GetProjectRoot to return parent of .git Previously, the function returned `../.git/`. We want the function to return the parent directory above that as the project root. This should help pass Vader tests.
24 lines
855 B
VimL
24 lines
855 B
VimL
" Author: Ricardo Liang <ricardoliang@gmail.com>
|
|
" Author: ourigen <ourigen [at] pm.me>
|
|
" 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
|
|
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
|
|
|
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
|
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'),
|
|
\})
|