diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-26 18:47:30 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-26 18:47:30 +0000 |
commit | c07b3b9bfcc00fb8b6dd8b2e9627257df4c8ed4f (patch) | |
tree | 95c5fba379b66df2634251d6e60cf5ba873286ef | |
parent | ae7cd2c0907573c9c4996296b642e547fd1ee04f (diff) | |
download | ale-c07b3b9bfcc00fb8b6dd8b2e9627257df4c8ed4f.zip |
Fix #1166 - Add an option for the rls toolchain
-rw-r--r-- | ale_linters/rust/rls.vim | 5 | ||||
-rw-r--r-- | doc/ale-rust.txt | 11 | ||||
-rw-r--r-- | test/command_callback/test_rust_rls_callbacks.vader | 11 |
3 files changed, 25 insertions, 2 deletions
diff --git a/ale_linters/rust/rls.vim b/ale_linters/rust/rls.vim index c49d2682..832fe3e2 100644 --- a/ale_linters/rust/rls.vim +++ b/ale_linters/rust/rls.vim @@ -2,6 +2,7 @@ " Description: A language server for Rust call ale#Set('rust_rls_executable', 'rls') +call ale#Set('rust_rls_toolchain', 'nightly') function! ale_linters#rust#rls#GetExecutable(buffer) abort return ale#Var(a:buffer, 'rust_rls_executable') @@ -9,8 +10,10 @@ endfunction function! ale_linters#rust#rls#GetCommand(buffer) abort let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer) + let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain') - return ale#Escape(l:executable) . ' +nightly' + return ale#Escape(l:executable) + \ . ' +' . ale#Escape(l:toolchain) endfunction function! ale_linters#rust#rls#GetLanguage(buffer) abort diff --git a/doc/ale-rust.txt b/doc/ale-rust.txt index 15ffef01..a32c90b0 100644 --- a/doc/ale-rust.txt +++ b/doc/ale-rust.txt @@ -70,6 +70,17 @@ g:ale_rust_rls_executable *g:ale_rust_rls_executable* This variable can be modified to change the executable path for `rls`. +g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain* + *b:ale_rust_rls_toolchain* + Type: |String| + Default: `'nightly'` + + This option can be set to change the toolchain used for `rls`. Possible + values include `'nightly'`, `'beta'`, and `'stable'`. + + The `rls` server will only be started once per executable. + + =============================================================================== 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 b01f8f06..e467fd96 100644 --- a/test/command_callback/test_rust_rls_callbacks.vader +++ b/test/command_callback/test_rust_rls_callbacks.vader @@ -1,7 +1,9 @@ Before: Save g:ale_rust_rls_executable + Save g:ale_rust_rls_toolchain unlet! g:ale_rust_rls_executable + unlet! g:ale_rust_rls_toolchain runtime ale_linters/rust/rls.vim @@ -16,7 +18,14 @@ After: Execute(The default executable path should be correct): AssertEqual 'rls', ale_linters#rust#rls#GetExecutable(bufnr('')) AssertEqual - \ ale#Escape('rls') . ' +nightly', + \ ale#Escape('rls') . ' +' . ale#Escape('nightly'), + \ ale_linters#rust#rls#GetCommand(bufnr('')) + +Execute(The toolchain should be configurable): + let g:ale_rust_rls_toolchain = 'stable' + + AssertEqual + \ ale#Escape('rls') . ' +' . ale#Escape('stable'), \ ale_linters#rust#rls#GetCommand(bufnr('')) Execute(The language string should be correct): |