ale icon indicating copy to clipboard operation
ale copied to clipboard

wrong match in ale#path#IsBufferPath for rust linter

Open lovebug356 opened this issue 7 years ago • 3 comments

Information

VIM version

NVIM v0.3.1
Build type: Release Operating System: macOS

What went wrong

The cargo linter, with clippy enabled, generates json lines with spacial "file_name" entries. See this example:

...
    "spans": [
      {
        "file_name": "<::alloc::macros::vec macros>",
        "byte_start": 197,
        "byte_end": 220,
...

when a buffer is checked to have this file_name with ale#path#IsBufferPath, it always returns true. The current implementation of ale#path#IsBufferPath accepts all names starting with a "<" under the assumption that it is a name for stdin.

:ALEInfo

 Current Filetype: 
Available Linters: []
  Enabled Linters: []
 Suggested Fixers: 
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 Linter Variables:

 Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
let g:ale_command_wrapper = v:null
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
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 g:ale_fix_on_save = 1
let g:ale_fixers = {'*': ['trim_whitespace'], 'rust': ['rustfmt']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = v:null
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 = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {'rust': ['cargo']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = v:null
let g:ale_list_window_size = v:null
let g:ale_loclist_msg_format = v:null
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = v:null
let g:ale_maximum_file_size = v:null
let g:ale_open_list = v:null
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
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 = v:null
let g:ale_sign_error = v:null
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = v:null
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:

lovebug356 avatar Dec 21 '18 22:12 lovebug356

Do you have any advice on how to interpret filenames like <::alloc::macros::vec macros>? Can we assume that anything like that doesn't match something in the buffer?

w0rp avatar Dec 25 '18 18:12 w0rp

While attempting to solve #1570 I came across this issue. I've done a brief search for documentation by reading through the seemingly relevant parts of https://doc.rust-lang.org/, but failed to see any mention of clippy generating these spacial "file_name" entries. Do we know if that behavior is documented somewhere?

rymdbar avatar Feb 04 '22 09:02 rymdbar

Is asked on urlo about this, and it seems this was a temporary thing which no longer happens. Details are in the linked thread, but the TL;DR is this ticket can be closed.

rymdbar avatar Feb 18 '22 13:02 rymdbar