summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2022-01-05 22:19:32 +0900
committerGitHub <noreply@github.com>2022-01-05 22:19:32 +0900
commit7b8e711877449478796306be9124c1fdd690b987 (patch)
tree32663ce0a1db0d0f8561374385af65c999847a54
parent11a90ad0ff0893118cd0b09de914c53f5683eeef (diff)
downloadale-7b8e711877449478796306be9124c1fdd690b987.zip
Fix 4025 - Allow to configure texlab LSP settings (#4027)
* Fix 4025 - Allow to configure texlab LSP settings * Fix ale_tex_texlab_config type in help
-rw-r--r--ale_linters/tex/texlab.vim2
-rw-r--r--doc/ale-tex.txt17
-rw-r--r--test/linter/test_texlab.vader5
3 files changed, 23 insertions, 1 deletions
diff --git a/ale_linters/tex/texlab.vim b/ale_linters/tex/texlab.vim
index 0794bf51..8e96b80b 100644
--- a/ale_linters/tex/texlab.vim
+++ b/ale_linters/tex/texlab.vim
@@ -4,6 +4,7 @@
call ale#Set('tex_texlab_executable', 'texlab')
call ale#Set('tex_texlab_options', '')
+call ale#Set('tex_texlab_config', {})
function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
@@ -21,4 +22,5 @@ call ale#linter#Define('tex', {
\ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')},
\ 'command': function('ale_linters#tex#texlab#GetCommand'),
\ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'),
+\ 'lsp_config': {b -> ale#Var(b, 'tex_texlab_config')},
\})
diff --git a/doc/ale-tex.txt b/doc/ale-tex.txt
index d5ef4783..147aacc4 100644
--- a/doc/ale-tex.txt
+++ b/doc/ale-tex.txt
@@ -73,8 +73,23 @@ g:ale_tex_texlab_options *g:ale_tex_texlab_options*
Type: |String|
Default: `''`
- This variable can be changed to modify flags given to texlab.
+ This variable can be changed to modify flags given to texlab command.
+g:ale_tex_texlab_config *g:ale_tex_texlab_config*
+ *b:ale_tex_texlab_config*
+ Type: |Dictionary|
+ Default: `{}`
+
+ Dictionary containing LSP configuration settings used to initialize texlab
+ language server. Refer to texlab documentation for possible settings:
+
+ https://github.com/latex-lsp/texlab/blob/master/docs/options.md
+
+ For example to set build onSave initialization setting:
+
+>
+ let g:ale_tex_texlab_config = {"build":{"onSave":v:true}}
+<
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/test/linter/test_texlab.vader b/test/linter/test_texlab.vader
index 75fc2f25..72b78745 100644
--- a/test/linter/test_texlab.vader
+++ b/test/linter/test_texlab.vader
@@ -28,3 +28,8 @@ Execute(The options should be configurable):
let b:ale_tex_texlab_options = '-v'
AssertLinter 'texlab', ale#Escape('texlab') . ' ' . b:ale_tex_texlab_options
+
+Execute(Should accpet configuration settings):
+ AssertLSPConfig {}
+ let b:ale_tex_texlab_config = {'build':{'onSave':v:true}}
+ AssertLSPConfig {'build':{'onSave':v:true}}