From 506a8532d07fd7e15e9a6cc37d490f7b7088aef5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 10 May 2020 08:21:02 -0400 Subject: 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. --- ale_linters/rust/cargo.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ale_linters/rust/cargo.vim') 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 -- cgit v1.2.3