improve rust lsp config

This commit is contained in:
sfigato 2024-06-22 23:14:37 +02:00
parent a4ac2e3d6d
commit 7db485bfaa
Signed by: blallo
GPG Key ID: C530464EEDCF489A
2 changed files with 21 additions and 4 deletions

View File

@ -9,13 +9,13 @@ let g:ale_sign_warning = '~>'
let g:ale_elixir_elixir_ls_release = '/usr/lib/elixir-ls/'
let g:ale_java_javalsp_executable = '/usr/bin/java-language-server'
"\ 'rust': ['rust-analyzer'],
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'javascriptreact': ['eslint'],
\ 'typescript': ['tsserver', 'tslint'],
\ 'typescriptreact': ['tsserver', 'tslint'],
\ 'python': ['pyright'],
\ 'rust': ['rust-analyzer'],
\ 'elixir': ['elixir-ls'],
\ 'go': ['gopls'],
\ 'json': ['jsonlint'],
@ -35,11 +35,11 @@ let g:ale_fixers = {
\ 'javascriptreact': ['prettier'],
\ 'typescriptreact': ['prettier'],
\ 'python': ['black'],
\ 'rust': ['rustfmt'],
\ 'elixir': ['mix_format'],
\ 'graphql': ['prettier'],
\ 'perl': ['perltidy'],
\ 'go': ['gofmt'],
\ 'rust': ['rustfmt'],
\ 'json': ['prettier'],
\ 'vala': ['uncrustify'],
\ 'dart': ['dartfmt'],
@ -48,7 +48,8 @@ let g:ale_fixers = {
let g:ale_rust_rls_config = {
\ 'rust': {
\ 'clippy_preference': 'on'
\ 'clippy_preference': 'on',
\ 'ale_rust_cargo_default_feature_behavior': 'all'
\ }
\ }

View File

@ -9,8 +9,23 @@ set hidden
" \ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'],
" \ }
if !empty($RUST_VERSION)
let g:LanguageClient_rustVersion = $RUST_VERSION
else
let g:LanguageClient_rustVersion = 'stable'
endif
let g:LanguageClient_serverCommands = {
\ 'rust': ['/usr/bin/rustup', 'run', 'stable', 'rls'],
"\ 'rust': ['/usr/bin/rustup', 'run', g:LanguageClient_rustVersion, 'rust-analyzer'],
\ 'rust': {
\ 'name': 'rust-analyzer',
\ 'command': ['/usr/bin/rustup', 'run', g:LanguageClient_rustVersion, 'rust-analyzer'],
\ 'initializationOptions': {
\ 'cargo': {
\ 'features': 'true',
\ }
\ },
\ },
\ 'elixir': ['/usr/lib/elixir-ls/language_server.sh'],
\ 'elm': ['/usr/bin/elm-language-server'],
\ 'python': ['/usr/bin/pyls'],
@ -25,6 +40,7 @@ let g:LanguageClient_rootMarkers = {
\ 'elm': ['elm.json'],
\ 'typescript': ['package.json'],
\ 'typescriptreact': ['package.json'],
\ 'rust': ['Cargo.toml'],
\ }
let g:LanguageClient_hoverPreview = 'always'