2017-03-28 18:25:44 -04:00
|
|
|
===============================================================================
|
|
|
|
ALE Rust Integration *ale-rust-options*
|
|
|
|
*ale-integration-rust*
|
|
|
|
|
2017-07-08 09:17:26 -04:00
|
|
|
===============================================================================
|
2017-03-28 18:25:44 -04:00
|
|
|
Integration Information
|
|
|
|
|
|
|
|
Since Vim does not detect the rust file type out-of-the-box, you need the
|
|
|
|
runtime files for rust from here: https://github.com/rust-lang/rust.vim
|
|
|
|
|
2017-08-07 08:00:17 -04:00
|
|
|
Note that there are three possible linters for Rust files:
|
2017-03-28 18:25:44 -04:00
|
|
|
|
|
|
|
1. rustc -- The Rust compiler is used to check the currently edited file.
|
|
|
|
So, if your project consists of multiple files, you will get some errors
|
|
|
|
when you use e.g. a struct which is defined in another file. You can use
|
|
|
|
|g:ale_rust_ignore_error_codes| to ignore some of these errors.
|
|
|
|
2. cargo -- If your project is managed by Cargo, the whole project is
|
|
|
|
checked. That means that all errors are properly shown, but cargo can
|
2017-03-28 19:34:03 -04:00
|
|
|
only operate on the files written on disk, so errors will not be reported
|
|
|
|
while you type.
|
2017-08-07 08:00:17 -04:00
|
|
|
3. rls -- If you have `rls` installed, you might prefer using this linter
|
|
|
|
over cargo. rls implements the Language Server Protocol for incremental
|
2017-10-02 12:11:54 -04:00
|
|
|
compilation of Rust code, and can check Rust files while you type. `rls`
|
2017-08-07 08:00:17 -04:00
|
|
|
requires Rust files to contained in Cargo projects.
|
2017-10-21 13:31:49 -04:00
|
|
|
4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
|
|
|
|
consistently reformat your Rust code.
|
2017-03-28 18:25:44 -04:00
|
|
|
|
|
|
|
Only cargo is enabled by default. To switch to using rustc instead of cargo,
|
|
|
|
configure |g:ale_linters| appropriately: >
|
|
|
|
|
|
|
|
" See the help text for the option for more information.
|
|
|
|
let g:ale_linters = {'rust': ['rustc']}
|
|
|
|
<
|
|
|
|
|
|
|
|
Also note that rustc 1.12. or later is needed.
|
|
|
|
|
|
|
|
|
2017-07-08 09:17:26 -04:00
|
|
|
===============================================================================
|
2017-03-28 18:25:44 -04:00
|
|
|
cargo *ale-rust-cargo*
|
|
|
|
|
|
|
|
g:ale_rust_cargo_use_check *g:ale_rust_cargo_use_check*
|
2017-04-27 17:04:34 -04:00
|
|
|
*b:ale_rust_cargo_use_check*
|
2017-03-28 18:25:44 -04:00
|
|
|
Type: |Number|
|
2017-11-05 13:37:44 -05:00
|
|
|
Default: `1`
|
2017-03-28 18:25:44 -04:00
|
|
|
|
2017-11-05 13:37:44 -05:00
|
|
|
When set to `1`, this option will cause ALE to use `cargo check` instead of
|
|
|
|
`cargo build` . `cargo check` is supported since version 1.16.0 of Rust.
|
|
|
|
|
|
|
|
ALE will never use `cargo check` when the version of `cargo` is less than
|
|
|
|
0.17.0.
|
|
|
|
|
|
|
|
|
|
|
|
g:ale_rust_cargo_check_all_targets *g:ale_rust_cargo_check_all_targets*
|
|
|
|
*b:ale_rust_cargo_check_all_targets*
|
|
|
|
Type: |Number|
|
|
|
|
Default: `1`
|
|
|
|
|
|
|
|
When set to `1`, ALE will set the `--all-targets` option when `cargo check`
|
|
|
|
is used. See |g:ale_rust_cargo_use_check|,
|
2017-03-28 18:25:44 -04:00
|
|
|
|
|
|
|
|
2017-08-07 08:00:17 -04:00
|
|
|
===============================================================================
|
|
|
|
rls *ale-rust-rls*
|
|
|
|
|
|
|
|
g:ale_rust_rls_executable *g:ale_rust_rls_executable*
|
|
|
|
*b:ale_rust_rls_executable*
|
|
|
|
Type: |String|
|
|
|
|
Default: `'rls'`
|
|
|
|
|
|
|
|
This variable can be modified to change the executable path for `rls`.
|
|
|
|
|
|
|
|
|
2017-07-08 09:17:26 -04:00
|
|
|
===============================================================================
|
2017-03-28 18:25:44 -04:00
|
|
|
rustc *ale-rust-rustc*
|
|
|
|
|
|
|
|
g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes*
|
2017-04-27 17:04:34 -04:00
|
|
|
*b:ale_rust_ignore_error_codes*
|
2017-03-28 18:25:44 -04:00
|
|
|
Type: |List| of |String|s
|
2017-08-07 08:00:17 -04:00
|
|
|
Default: `[]`
|
2017-03-28 18:25:44 -04:00
|
|
|
|
|
|
|
This variable can contain error codes which will be ignored. For example, to
|
|
|
|
ignore most errors regarding failed imports, put this in your .vimrc
|
|
|
|
>
|
|
|
|
let g:ale_rust_ignore_error_codes = ['E0432', 'E0433']
|
|
|
|
|
|
|
|
|
2017-10-21 13:31:49 -04:00
|
|
|
===============================================================================
|
|
|
|
rustfmt *ale-rust-rustfmt*
|
|
|
|
|
|
|
|
g:ale_rust_rustfmt_options *g:ale_rust_rustfmt_options*
|
|
|
|
*b:ale_rust_rustfmt_options*
|
|
|
|
Type: |String|
|
|
|
|
Default: `''`
|
|
|
|
|
|
|
|
This variable can be set to pass additional options to the rustfmt fixer.
|
|
|
|
|
|
|
|
|
2017-07-08 09:17:26 -04:00
|
|
|
===============================================================================
|
2017-03-28 18:25:44 -04:00
|
|
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|