Fix #1166 - Add an option for the rls toolchain
This commit is contained in:
parent
ae7cd2c090
commit
c07b3b9bfc
@ -2,6 +2,7 @@
|
|||||||
" Description: A language server for Rust
|
" Description: A language server for Rust
|
||||||
|
|
||||||
call ale#Set('rust_rls_executable', 'rls')
|
call ale#Set('rust_rls_executable', 'rls')
|
||||||
|
call ale#Set('rust_rls_toolchain', 'nightly')
|
||||||
|
|
||||||
function! ale_linters#rust#rls#GetExecutable(buffer) abort
|
function! ale_linters#rust#rls#GetExecutable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'rust_rls_executable')
|
return ale#Var(a:buffer, 'rust_rls_executable')
|
||||||
@ -9,8 +10,10 @@ endfunction
|
|||||||
|
|
||||||
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
|
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
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#rust#rls#GetLanguage(buffer) abort
|
function! ale_linters#rust#rls#GetLanguage(buffer) abort
|
||||||
|
@ -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`.
|
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*
|
rustc *ale-rust-rustc*
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
Before:
|
Before:
|
||||||
Save g:ale_rust_rls_executable
|
Save g:ale_rust_rls_executable
|
||||||
|
Save g:ale_rust_rls_toolchain
|
||||||
|
|
||||||
unlet! g:ale_rust_rls_executable
|
unlet! g:ale_rust_rls_executable
|
||||||
|
unlet! g:ale_rust_rls_toolchain
|
||||||
|
|
||||||
runtime ale_linters/rust/rls.vim
|
runtime ale_linters/rust/rls.vim
|
||||||
|
|
||||||
@ -16,7 +18,14 @@ After:
|
|||||||
Execute(The default executable path should be correct):
|
Execute(The default executable path should be correct):
|
||||||
AssertEqual 'rls', ale_linters#rust#rls#GetExecutable(bufnr(''))
|
AssertEqual 'rls', ale_linters#rust#rls#GetExecutable(bufnr(''))
|
||||||
AssertEqual
|
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(''))
|
\ ale_linters#rust#rls#GetCommand(bufnr(''))
|
||||||
|
|
||||||
Execute(The language string should be correct):
|
Execute(The language string should be correct):
|
||||||
|
Loading…
Reference in New Issue
Block a user