Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-analyzer no longer updates on save, starting with commit c7e3f1a #3996

Closed
AaronM04 opened this issue Nov 29, 2021 · 2 comments · Fixed by #4008
Closed

rust-analyzer no longer updates on save, starting with commit c7e3f1a #3996

AaronM04 opened this issue Nov 29, 2021 · 2 comments · Fixed by #4008
Labels

Comments

@AaronM04
Copy link

Information

VIM version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 15 2021 08:22:17)
macOS version - x86_64

Operating System: macOS Catalina

What went wrong

When I add code to a Rust file that adds a warning or an error, the warning/error never shows up. Any warnings or errors present when the file was opened never go away regardless of any changes I save.

Reproducing the bug

  1. Setup ALE to use rust-analyzer
  2. create an empty project with cargo new --bin foobar
  3. cd foobar
  4. vim src/main.rs
  5. Wait until the rust-analyzer process drops to single digit percentage CPU usage
  6. Add a line let x = 3; below the fn main line
  7. Wait a second.
  8. Observe no warning about an unused variable x (a warning is expected here).

:ALEInfo

 Current Filetype: rust
Available Linters: ['analyzer', 'cargo', 'rls', 'rustc']
  Enabled Linters: ['analyzer']
  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:

let g:ale_rust_analyzer_config = {}
let g:ale_rust_analyzer_executable = 'rust-analyzer'
 Global Variables:

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 = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {}
let g:ale_history_enabled = 1
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 = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'], 'rust': ['analyzer']}
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 = '[%linter%] %s [%severity%]'
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 = 1
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 = 1
let g:ale_sign_error = '=>'
let g:ale_sign_info = '->'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '=>'
let g:ale_sign_style_warning = '->'
let g:ale_sign_warning = '->'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(executable check - success) rust-analyzer
(started) ['/usr/local/bin/bash', '-c', '''rust-analyzer''']

Cause

After bisecting, I found that this is the commit that broke this functionality:

c7e3f1a0dd447eeafcbbd158974860c1918dbdd5 is the first bad commit
commit c7e3f1a0dd447eeafcbbd158974860c1918dbdd5
Author: Horacio Sanson <hsanson@gmail.com>
Date:   Fri Oct 15 08:42:07 2021 +0900

    Fix 3207 - do not send didSave notification if not supported (#3930)

 autoload/ale/lsp.vim               | 19 ++++++++++++-------
 autoload/ale/lsp_linter.vim        |  1 +
 test/lsp/test_did_save_event.vader | 24 ++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 7 deletions(-)
@AaronM04 AaronM04 added the bug label Nov 29, 2021
@AaronM04
Copy link
Author

This happens on Linux and OpenBSD as well, and doesn't seem to depend on the rust-analyzer version. I reproed it on macOS with this version though:

❯ rust-analyzer --version
rust-analyzer b641a6607 2021-08-17 dev

The commit message suggests it might be a bug in rust-analyzer though? I am happy to create an issue for that project if you all think that is appropriate.

@hsanson
Copy link
Contributor

hsanson commented Dec 9, 2021

@AaronM04 thanks for the report and for tracking the commit that caused the issue. This helped me unveil a silly mistake I made on that commit. I merged a fix so let me know if things are working back again for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants