ale icon indicating copy to clipboard operation
ale copied to clipboard

Capture errors from other files for cargo and rustc

Open MarkSwanson opened this issue 6 years ago • 6 comments

Information

VIM version

PASTE JUST THE FIRST TWO LINES OF :version HERE. VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 10 2018 16:58:20) Included patches: 1-1809

Operating System: WHAT OS WERE YOU USING?

Ubuntu 16.04

:ALEInfo

PASTE OUTPUT OF :ALEInfo HERE. YOU CAN TRY :ALEInfoToClipboard. ALEInfo Current Filetype: rust Available Linters: ['cargo', 'rls', 'rustc'] Enabled Linters: ['cargo'] Linter Variables:

let g:ale_rust_cargo_check_all_targets = 1 let g:ale_rust_cargo_default_feature_behavior = 'default' let g:ale_rust_cargo_include_features = 'clippy' let g:ale_rust_cargo_use_check = 1 Global Variables:

let g:ale_cache_executable_check_failures = 0 let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 0 let g:ale_completion_max_suggestions = 50 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 b:ale_enabled = 0 let g:ale_fix_on_save = 0 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_save = 1 let g:ale_lint_on_text_changed = 'always' let g:ale_lint_on_insert_leave = 0 let g:ale_linter_aliases = {} let g:ale_linters = {'rust': ['cargo']} let g:ale_linters_explicit = 0 let g:ale_list_window_size = 10 let g:ale_list_vertical = 0 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 = 0 let g:ale_open_list = 0 let g:ale_pattern_options = {} let g:ale_pattern_options_enabled = 0 let g:ale_set_balloons = 1 let g:ale_set_highlights = 1 let g:ale_set_loclist = 0 let g:ale_set_quickfix = 1 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 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_statusline_format = ['%d error(s)', '%d warning(s)', 'OK'] let g:ale_type_map = {} let g:ale_use_global_executables = v:null let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1

What went wrong

WRITE WHAT WENT WRONG HERE.

Only errors for the current file were shown.

Reproducing the bug

Steps for repeating the bug:

  1. Write a list of steps.
  2. Otherwise nobody will fix the bug.

Let's say I have 2 files: src/A.rs and src/B.rs B.rs has errors (and Cargo check tells me so) When I edit src/A.rs, ale does a cargo check but for some reason ale never shows me the errors in src/B.rs.

MarkSwanson avatar May 11 '18 03:05 MarkSwanson

I would like to ask about the same thing.

I generally like ale more than neomake but this detail is ruining everything for me.

dpc avatar Jul 02 '18 05:07 dpc

The problems from other files are thrown away at the moment. If you want to fix that, submit a pull request. If the filenames returned by cargo are relative paths, they'll have to be converted into absolute paths and then included in the loclist info with the filename key, and then the errors will appear in the quickfix list.

w0rp avatar Jul 02 '18 08:07 w0rp

I had a go at this in wip/cargo_multifile and got something which essentially seems to work on my machine.

The test cases fail however, which might very likely be due to not handling everything correctly. The main problematic detail is an expectation that some output should have it's filename set to <anon> rather than an actual filename. No other ale-code seem to use this string, and it is not passed from any linter but invented by the handler.

An explanation from someone (possibly @EinfachToll who initially introduced it half a decade ago?) on how <anon> is supposed to work would be great, as would actual rust code to trigger the same conditions as the test cases build up using captured linter output.

nospam2998 avatar Feb 03 '22 10:02 nospam2998

As one might learn from either reading the source code comments of path.vim or from the description of #2157, any file_name starting with < is considered by ale to be stdin.

To my eyes nothing in neither rustc's nor cargo's documentation suggests that those tools would ever use such syntax.

nospam2998 avatar Feb 04 '22 09:02 nospam2998

Without much knowledge of how rustc/cargo work all I can recommend is that those special entries are filtered out (skipped) by the handler. Such entries are useless anyways for ALE/Vim.

hsanson avatar Feb 04 '22 12:02 hsanson

As mentioned in #2157, a thread on urlo straightened out the largest question mark. Thus, I had another look at this today, adding a few commits to wip/cargo_multifile. No attempt at properly updating the failing Vader tests yet though.

nospam2998 avatar Feb 18 '22 16:02 nospam2998