Fix texlab#GetProjectRoot (#3610)

* 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.
This commit is contained in:
ourigen 2021-03-12 11:40:40 +00:00 committed by GitHub
parent c21d6afd2f
commit 80a48d01be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -1,11 +1,14 @@
" 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
return ''
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

View file

@ -14,7 +14,10 @@ Execute(The default executable path should be correct):
AssertLinter 'texlab', ale#Escape('texlab')
Execute(The project root should be detected correctly):
AssertLSPProject ''
call ale#test#SetFilename('tex_paths/sample1.tex')
silent! call mkdir('tex_paths/.git')
AssertLSPProject ale#path#Simplify(g:dir . '/tex_paths')
Execute(The executable should be configurable):
let b:ale_tex_texlab_executable = 'foobar'