-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Renaming symbols via ALERename gives a "list index out of range" error #2801
Comments
Can you create a small sample project you can reliably repeat this bug in? I've seen this bug appear only once before, and I've never been able to repeat it since. |
https://github.com/geoyws/test-ts Hope it's something that's wrong on my end instead. Looking forward to not having to use another plugin. 😅 |
I know the error does happen now and then, but I can't repeat it with that project. I'm interested to know how to repeat the bug consistently. |
Maybe there's something wrong on my end. Let me run a few tests :). Thanks for your kind attention! |
I'll reopen as I know this is an an issue, it just doesn't happen all of the time, and I can't repeat it consistently. |
I'm rushing a project currently so am really busy, but I have an inkling it has to do with when we forget to save the buffer we're working on and invoke FZF... |
I have a similar problem with neovim and python-language-server. As far as I debugged it, the problem lies in handling a range that falls at the end of the file. With a rename python-language-server (at least in my current case) returns the whole file as a change. Thus the range of the edit ends with character 0 on the first line after the last line of the file. This breaks the logic in ale#code_action#ApplyChanges that assumes that Looking now at geoyws screenshot, I realize that it may be a different cause for the same error, as in my case the index being out of range is not 0. |
@dfn-certling Could you attach a diff for that, and the complete error message that you see? If so, I can add a test for that and make sure that doesn't happen again. |
I just made a pull request #3344 that fixes that error for me. For completeness the previous error messages are:
|
I also get the same error
|
I got the same error, and confirm that #3344 fixes it |
I've merged that pull request now, so that should fix that. Thanks to @dfn-certling 👍. |
Amazing! Thanks for sorting this 👍 |
Thanks @w0rp @dfn-certling 👍 |
I encountered the same problem when renaming the rust function.
Reproduce the code.
mod test;
use test::*;
fn main() {
let a = test1();
}
pub fn test1() {} |
@gmg137 Could you |
@w0rp Hi, there is no error output after pull the latest version of ale, but the contents of other files are overwritten. The contents of main.rs are overwritten after executing ALERename. |
Could you upload that example Rust project to GitHub so I can try it out? I can install Rust pretty easily on my machine to test it and figure out how to fix it. |
Hello, the rust example has been uploaded. This is my ale configuration let g:ale_linters = {
\ 'rust': ['analyzer', 'cargo', 'rustc'],
\ 'go': ['golint', 'gopls', 'go build', 'go vet', 'gofmt'],
\ 'json': ['jq'],
\}
let g:ale_linters_explicit = 1
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'rust': ['rustfmt'],
\ 'go': ['gofmt'],
\ 'json': ['jq'],
\}
let g:ale_rust_rls_config = {
\ 'rust': {
\ 'clippy_preference': 'on'
\ }
\ }
let g:ale_rust_analyzer_config = {
\ 'diagnostics': { 'disabled': ['unresolved-import'] },
\ 'cargo': { 'loadOutDirsFromCheck': v:true },
\ 'procMacro': { 'enable': v:true },
\ 'checkOnSave': { 'command': 'clippy', 'enable': v:true }
\ }
let g:ale_fix_on_save = 1
let g:ale_rust_rustfmt_options = "--edition 2018" |
Information
VIM version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 21 2019 22:54:00)
macOS version
Included patches: 1-1722
Compiled by Homebrew
Operating System:
masOS Mojave 10.14.6 (18G95)
What went wrong
Oftentimes when using
:ALERename
, the error "list index out of range" would flash for less than a second" and the symbol would not be renamed in the other files. I've already searched throughIssues
for relevant help. I have not put it on Stack Overflow since the feature is rather new.Reproducing the bug
:ALERename
. Then I put in a new name and hit enter.:ALEInfo
Current Filetype: typescript
Available Linters: ['eslint', 'tslint', 'tsserver', 'typecheck', 'xo']
Enabled Linters: ['eslint', 'tslint', 'tsserver', 'typecheck', 'xo']
Suggested Fixers:
'eslint' - Apply eslint --fix to a file.
'prettier' - Apply prettier to a file.
'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.
'tslint' - Fix typescript files with tslint --fix.
'xo' - Fix JavaScript/TypeScript files using xo --fix.
Linter Variables:
let g:ale_typescript_tslint_config_path = ''
let g:ale_typescript_tslint_executable = 'tslint'
let g:ale_typescript_tslint_ignore_empty_files = 0
let g:ale_typescript_tslint_rules_dir = ''
let g:ale_typescript_tslint_use_global = 0
let g:ale_typescript_tsserver_config_path = ''
let g:ale_typescript_tsserver_executable = 'tsserver'
let g:ale_typescript_tsserver_use_global = 0
let g:ale_typescript_xo_executable = 'xo'
let g:ale_typescript_xo_options = ''
let g:ale_typescript_xo_use_global = 0
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 = 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 = {'markdown': ['prettier'], 'scss': ['prettier'], '*': ['remove_trailing_lines', 'trim_whitespace'], 'javascript': ['prettier', 'eslint'], 'css': ['prettier']}
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 = {'javascript': ['eslint']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
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_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 = '>>'
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:
(finished - exit code 0) ['/bin/bash', '-c', '''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts'' < ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/164/index.ts''']
<<>>
[{"filePath":"/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models'' && ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/.bin/tslint'' --format json -c ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/tslint.json'' ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/165/index.ts''']
<<>>
[]
<<>>
(executable check - failure) typecheck
(executable check - failure) xo
(finished - exit code 0) ['/bin/bash', '-c', '''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts'' < ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/166/index.ts''']
<<>>
[{"filePath":"/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models'' && ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/.bin/tslint'' --format json -c ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/tslint.json'' ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/167/index.ts''']
<<>>
[]
<<>>
(executable check - failure) typecheck
(executable check - failure) xo
(finished - exit code 0) ['/bin/bash', '-c', '''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts'' < ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/168/index.ts''']
<<>>
[{"filePath":"/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models'' && ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/.bin/tslint'' --format json -c ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/tslint.json'' ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/169/index.ts''']
<<>>
[]
<<>>
(executable check - failure) typecheck
(executable check - failure) xo
(finished - exit code 0) ['/bin/bash', '-c', '''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts'' < ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/170/index.ts''']
<<>>
[{"filePath":"/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models'' && ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/.bin/tslint'' --format json -c ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/tslint.json'' ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/171/index.ts''']
<<>>
[]
<<>>
(executable check - failure) typecheck
(executable check - failure) xo
(finished - exit code 0) ['/bin/bash', '-c', '''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts'' < ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/172/index.ts''']
<<>>
[{"filePath":"/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/src/models'' && ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/node_modules/.bin/tslint'' --format json -c ''/Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react/tslint.json'' ''/var/folders/4y/003h9qqs4yb21ww1yfc6rtp80000gn/T/vgYxNJc/173/index.ts''']
<<>>
[]
<<>>
(executable check - failure) typecheck
(executable check - failure) xo
The text was updated successfully, but these errors were encountered: