summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/rust/rls.vim2
-rw-r--r--doc/ale-rust.txt14
-rw-r--r--test/command_callback/test_rust_rls_callbacks.vader5
3 files changed, 21 insertions, 0 deletions
diff --git a/ale_linters/rust/rls.vim b/ale_linters/rust/rls.vim
index cf34b43c..0e5c326c 100644
--- a/ale_linters/rust/rls.vim
+++ b/ale_linters/rust/rls.vim
@@ -3,6 +3,7 @@
call ale#Set('rust_rls_executable', 'rls')
call ale#Set('rust_rls_toolchain', 'nightly')
+call ale#Set('rust_rls_config', {})
function! ale_linters#rust#rls#GetCommand(buffer) abort
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
@@ -19,6 +20,7 @@ endfunction
call ale#linter#Define('rust', {
\ 'name': 'rls',
\ 'lsp': 'stdio',
+\ 'lsp_config': {b -> ale#Var(b, 'rust_rls_config')},
\ 'executable': {b -> ale#Var(b, 'rust_rls_executable')},
\ 'command': function('ale_linters#rust#rls#GetCommand'),
\ 'project_root': function('ale_linters#rust#rls#GetProjectRoot'),
diff --git a/doc/ale-rust.txt b/doc/ale-rust.txt
index 7510dfbd..3393b9c0 100644
--- a/doc/ale-rust.txt
+++ b/doc/ale-rust.txt
@@ -172,6 +172,20 @@ g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain*
The `rls` server will only be started once per executable.
+g:ale_rust_rls_config *g:ale_rust_rls_config*
+ *b:ale_rust_rls_config*
+ Type: |Dictionary|
+ Default: `{}`
+
+ Dictionary with configuration settings for rls. For example, to force
+ using clippy as linter: >
+ {
+ \ 'rust': {
+ \ 'clippy_preference': 'on'
+ \ }
+ \ }
+
+
===============================================================================
rustc *ale-rust-rustc*
diff --git a/test/command_callback/test_rust_rls_callbacks.vader b/test/command_callback/test_rust_rls_callbacks.vader
index a710161d..ef4735d2 100644
--- a/test/command_callback/test_rust_rls_callbacks.vader
+++ b/test/command_callback/test_rust_rls_callbacks.vader
@@ -23,3 +23,8 @@ Execute(The project root should be detected correctly):
call ale#test#SetFilename('rust-rls-project/test.rs')
AssertLSPProject ale#path#Simplify(g:dir . '/rust-rls-project')
+
+Execute(Should accept configuration settings):
+ AssertLSPConfig {}
+ let b:ale_rust_rls_config = {'rust': {'clippy_preference': 'on'}}
+ AssertLSPConfig {'rust': {'clippy_preference': 'on'}}