diff options
author | eyenseo <eyenseo@gmail.com> | 2018-04-12 20:42:38 +0200 |
---|---|---|
committer | eyenseo <eyenseo@gmail.com> | 2018-04-12 20:42:38 +0200 |
commit | 6c93cded648f835a23ca5b5a1ed4bfefb81c7fd2 (patch) | |
tree | 3b002e1bf68971c8e84d84f6d66993a8a269fc62 | |
parent | f064ba48f5893f25c1af9459b309a919a392db7c (diff) | |
download | ale-6c93cded648f835a23ca5b5a1ed4bfefb81c7fd2.zip |
Fix rust rls linter toolchain argument
This removes the argument if the specified toolchain is empty.
As far as I can tell there is no +nighly (or similar) option [1] leading to
the termination of the server. But since people needed this option and
have yet to complain about it it stays the default for now.
[1] https://github.com/rust-lang-nursery/rls/blob/master/src/main.rs#L87
-rw-r--r-- | ale_linters/rust/rls.vim | 7 | ||||
-rw-r--r-- | test/command_callback/test_rust_rls_callbacks.vader | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ale_linters/rust/rls.vim b/ale_linters/rust/rls.vim index 832fe3e2..24316b04 100644 --- a/ale_linters/rust/rls.vim +++ b/ale_linters/rust/rls.vim @@ -12,8 +12,11 @@ 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) - \ . ' +' . ale#Escape(l:toolchain) + if empty(l:toolchain) + return ale#Escape(l:executable) + else + return ale#Escape(l:executable) . ' +' . ale#Escape(l:toolchain) + endif endfunction function! ale_linters#rust#rls#GetLanguage(buffer) abort diff --git a/test/command_callback/test_rust_rls_callbacks.vader b/test/command_callback/test_rust_rls_callbacks.vader index 693d6e9f..d537bccb 100644 --- a/test/command_callback/test_rust_rls_callbacks.vader +++ b/test/command_callback/test_rust_rls_callbacks.vader @@ -28,6 +28,13 @@ Execute(The toolchain should be configurable): \ ale#Escape('rls') . ' +' . ale#Escape('stable'), \ ale_linters#rust#rls#GetCommand(bufnr('')) +Execute(The toolchain should be ommitted if not given): + let g:ale_rust_rls_toolchain = '' + + AssertEqual + \ ale#Escape('rls'), + \ ale_linters#rust#rls#GetCommand(bufnr('')) + Execute(The language string should be correct): AssertEqual 'rust', ale_linters#rust#rls#GetLanguage(bufnr('')) |