diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2020-05-10 08:21:02 -0400 |
---|---|---|
committer | Ben Boeckel <mathstuf@gmail.com> | 2020-08-13 10:22:33 -0400 |
commit | 506a8532d07fd7e15e9a6cc37d490f7b7088aef5 (patch) | |
tree | 0c4cc7182e7c8595a96eff07e11d3a0e8de9bf63 /ale_linters | |
parent | 0b7776633764ab4a3c25b73e8ef8a604bebdd638 (diff) | |
download | ale-506a8532d07fd7e15e9a6cc37d490f7b7088aef5.zip |
rust/cargo: add support for a custom target directory
This can avoid having to wait for ALE or ALE being blocked on other
cargo actions within the same crate.
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/rust/cargo.vim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim index 99178585..3407abed 100644 --- a/ale_linters/rust/cargo.vim +++ b/ale_linters/rust/cargo.vim @@ -11,6 +11,7 @@ call ale#Set('rust_cargo_default_feature_behavior', 'default') call ale#Set('rust_cargo_include_features', '') call ale#Set('rust_cargo_use_clippy', 0) call ale#Set('rust_cargo_clippy_options', '') +call ale#Set('rust_cargo_target_dir', '') function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' @@ -31,6 +32,9 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests') \ && ale#semver#GTE(a:version, [0, 22, 0]) + let l:target_dir = ale#Var(a:buffer, 'rust_cargo_target_dir') + let l:use_target_dir = !empty(l:target_dir) + \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') @@ -82,6 +86,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort \ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_examples ? ' --examples' : '') \ . (l:use_tests ? ' --tests' : '') + \ . (l:use_target_dir ? (' --target-dir ' . ale#Escape(l:target_dir)) : '') \ . ' --frozen --message-format=json -q' \ . l:default_feature \ . l:include_features |