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)
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 through Issues for relevant help. I have not put it on Stack Overflow since the feature is rather new.
:ALERename. Then I put in a new name and hit enter.
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''']
<<
(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
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 l:lines[l:end_line - 1] and l:lines[l:end_line :] are valid index accesses. With l:end_line being the line after the last line that isn't true and yields a list index out of range.
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:
Error detected while processing function <SNR>114_NeoVimCallback[4]..ale#util#JoinNeovimOutput[
2]..<lambda>13[1]..ale#lsp#HandleMessage[30]..ale#rename#HandleLSPResponse[48]..ale#code_action
#HandleCodeAction[15]..ale#code_action#ApplyChanges:
line 67:
E684: list index out of range: 155
Press ENTER or type command to continue
Error detected while processing function <SNR>114_NeoVimCallback[4]..ale#util#JoinNeovimOutput[
2]..<lambda>13[1]..ale#lsp#HandleMessage[30]..ale#rename#HandleLSPResponse[48]..ale#code_action
#HandleCodeAction[15]..ale#code_action#ApplyChanges:
line 67:
E15: Invalid expression: l:lines[l:end_line - 1][l:end_column - 1 :]
I also get the same error
Error detected while processing function <SNR>84_NeoVimCallback[4]..ale#util#JoinNeovimOutput[2]..<lambda>11[1]..ale#lsp#HandleMessage[30]..ale#rename#HandleLSPResponse[48]..ale#code_action#HandleCodeAction[22]..ale
#code_action#ApplyChanges:
line 67:
E684: list index out of range: 96
Error detected while processing function <SNR>84_NeoVimCallback[4]..ale#util#JoinNeovimOutput[2]..<lambda>11[1]..ale#lsp#HandleMessage[30]..ale#rename#HandleLSPResponse[48]..ale#code_action#HandleCodeAction[22]..ale
#code_action#ApplyChanges:
line 67:
E15: Invalid expression: l:lines[l:end_line - 1][l:end_column - 1 :]
I got the same error, and confirm that https://github.com/dense-analysis/ale/pull/3344 fixes it
I've merged that pull request now, so that should fix that.
Thanks to @dfn-certling :+1:.
Amazing! Thanks for sorting this 馃憤
Thanks @w0rp @dfn-certling 馃憤
Most helpful comment
I just made a pull request #3344 that fixes that error for me.
For completeness the previous error messages are: