diff options
-rw-r--r-- | ale_linters/tex/texlab.vim | 5 | ||||
-rw-r--r-- | test/command_callback/test_texlab_command_callbacks.vader | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/ale_linters/tex/texlab.vim b/ale_linters/tex/texlab.vim index 5ead74b4..dd26fa0a 100644 --- a/ale_linters/tex/texlab.vim +++ b/ale_linters/tex/texlab.vim @@ -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 diff --git a/test/command_callback/test_texlab_command_callbacks.vader b/test/command_callback/test_texlab_command_callbacks.vader index ca678d2b..c18793da 100644 --- a/test/command_callback/test_texlab_command_callbacks.vader +++ b/test/command_callback/test_texlab_command_callbacks.vader @@ -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' |