mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -17,7 +17,7 @@ endfunction
|
||||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'analyzer',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')},
|
||||
\ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')},
|
||||
\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
|
||||
\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),
|
||||
|
@ -23,6 +23,19 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#cargo#GetCwd(buffer) abort
|
||||
if ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace')
|
||||
let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h')
|
||||
|
||||
if l:nearest_cargo_dir isnot# '.'
|
||||
return l:nearest_cargo_dir
|
||||
endif
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
|
||||
let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check')
|
||||
\ && ale#semver#GTE(a:version, [0, 17, 0])
|
||||
@ -42,18 +55,6 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
|
||||
let l:include_features = ' --features ' . ale#Escape(l:include_features)
|
||||
endif
|
||||
|
||||
let l:avoid_whole_workspace = ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace')
|
||||
let l:nearest_cargo_prefix = ''
|
||||
|
||||
if l:avoid_whole_workspace
|
||||
let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h')
|
||||
|
||||
if l:nearest_cargo_dir isnot# '.'
|
||||
let l:nearest_cargo_prefix = 'cd '. ale#Escape(l:nearest_cargo_dir) .' && '
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior')
|
||||
|
||||
if l:default_feature_behavior is# 'all'
|
||||
@ -81,7 +82,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:nearest_cargo_prefix . 'cargo '
|
||||
return 'cargo '
|
||||
\ . l:subcommand
|
||||
\ . (l:use_all_targets ? ' --all-targets' : '')
|
||||
\ . (l:use_examples ? ' --examples' : '')
|
||||
@ -96,6 +97,7 @@ endfunction
|
||||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'cargo',
|
||||
\ 'executable': function('ale_linters#rust#cargo#GetCargoExecutable'),
|
||||
\ 'cwd': function('ale_linters#rust#cargo#GetCwd'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#rust#cargo#GetCargoExecutable(buffer),
|
||||
|
Reference in New Issue
Block a user