mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Add lsp_config support for rls (#2332)
* Add lsp_config for rls * Add working config example and test
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
call ale#Set('rust_rls_executable', 'rls')
|
call ale#Set('rust_rls_executable', 'rls')
|
||||||
call ale#Set('rust_rls_toolchain', 'nightly')
|
call ale#Set('rust_rls_toolchain', 'nightly')
|
||||||
|
call ale#Set('rust_rls_config', {})
|
||||||
|
|
||||||
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
||||||
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
|
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
|
||||||
@@ -19,6 +20,7 @@ endfunction
|
|||||||
call ale#linter#Define('rust', {
|
call ale#linter#Define('rust', {
|
||||||
\ 'name': 'rls',
|
\ 'name': 'rls',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'lsp_config': {b -> ale#Var(b, 'rust_rls_config')},
|
||||||
\ 'executable': {b -> ale#Var(b, 'rust_rls_executable')},
|
\ 'executable': {b -> ale#Var(b, 'rust_rls_executable')},
|
||||||
\ 'command': function('ale_linters#rust#rls#GetCommand'),
|
\ 'command': function('ale_linters#rust#rls#GetCommand'),
|
||||||
\ 'project_root': function('ale_linters#rust#rls#GetProjectRoot'),
|
\ 'project_root': function('ale_linters#rust#rls#GetProjectRoot'),
|
||||||
|
|||||||
@@ -172,6 +172,20 @@ g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain*
|
|||||||
The `rls` server will only be started once per executable.
|
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*
|
rustc *ale-rust-rustc*
|
||||||
|
|
||||||
|
|||||||
@@ -23,3 +23,8 @@ Execute(The project root should be detected correctly):
|
|||||||
call ale#test#SetFilename('rust-rls-project/test.rs')
|
call ale#test#SetFilename('rust-rls-project/test.rs')
|
||||||
|
|
||||||
AssertLSPProject ale#path#Simplify(g:dir . '/rust-rls-project')
|
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'}}
|
||||||
|
|||||||
Reference in New Issue
Block a user