Skip to content

let g:ale_rust_analyzer_config = ... does not work. #4876

Open
@pozix604

Description

Information

VIM version

$ vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Nov 06 2024 19:04:03)
Included patches: 1-16, 647, 678, 697

$ uname -a
Linux abc 6.8.0-49-generic #49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov  4 02:06:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

What went wrong

The option g:ale_rust_analyzer_config does not work as described. Related rust-analyzer option rust-analyzer.cargo.features described here.

Reproducing the bug

Add let g:ale_rust_analyzer_config = { 'cargo': { 'features': ['all'] } } to ~/.vimrc.

Edit a rust project with code that enables a feature, e.g.:

#[cfg(feature = "abc")]
mod abc;

ALE/rust-analyzer flags the feature as disabled anyway despite the configuration otherwise.

:ALEInfo

 Current Filetype: rust
Available Linters: ['analyzer', 'cargo', 'cspell', 'rls', 'rustc']
   Linter Aliases:
'analyzer' -> ['rust_analyzer']
  Enabled Linters: ['analyzer', 'cargo']
  Ignored Linters: []
 Suggested Fixers:
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'rustfmt' - Fix Rust files with Rustfmt.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 
 Linter Variables:
" Press Space to read :help for a setting
let g:ale_rust_analyzer_config = {'cargo': {'features': ['all']}}
let g:ale_rust_analyzer_executable = 'rust-analyzer'
let g:ale_rust_cargo_avoid_whole_workspace = 1
let g:ale_rust_cargo_check_all_targets = 0
let g:ale_rust_cargo_check_examples = 0
let g:ale_rust_cargo_check_tests = 0
let g:ale_rust_cargo_clippy_options = ''
let g:ale_rust_cargo_default_feature_behavior = 'default'
let g:ale_rust_cargo_include_features = ''
let g:ale_rust_cargo_target_dir = ''
let g:ale_rust_cargo_use_check = 1
let g:ale_rust_cargo_use_clippy = 0
let b:ale_rust_cargo_use_clippy = 1
let g:ale_rust_ignore_error_codes = []
let g:ale_rust_ignore_secondary_spans = 0
 
 Global Variables:
" Press Space to read :help for a setting
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
let g:ale_completion_max_suggestions = 50
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {}
let b:ale_fixers = ['rustfmt']
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let b:ale_linters = ['analyzer', 'cargo']
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E'
let g:ale_sign_info = 'I'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E'
let g:ale_sign_style_warning = 'W'
let g:ale_sign_warning = 'W'
let g:ale_sign_highlight_linenrs = 0
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
 
  Command History:

(executable check - success) rust-analyzer
(executable check - success) cargo
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/home/box/a'' && ''cargo'' --version']

<<<OUTPUT STARTS>>>
cargo 1.83.0 (5ffbef321 2024-10-29)
<<<OUTPUT ENDS>>>

(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/home/box/a'' && cargo clippy --frozen --message-format=json -q']

<<<OUTPUT STARTS>>>
...
<<<OUTPUT ENDS>>>

(started) ['/bin/bash', '-c', '''rust-analyzer''']

The rust-analyzer executable is not executed with the expected option.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions