dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.44k forks source link

Error on startup in v1.5.0 #907

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello,

I am seeing this error message when starting NVIM 0.1.7.

Error detected while processing function ale#Queue[9]..ale#CallWithCooldown[9]..<SNR>14_A
LEQueueImpl[41]..ale#Lint[12]..ale#CallWithCooldown[9]..<SNR>14_ALELintImpl[16]..ale#engi
ne#RunLinters[12]..<SNR>56_RunLinter[2]..<SNR>56_CheckWithLSP[2]..ale#linter#StartLSP[28]
..ale#lsp#StartProgram[28]..<SNR>63_RegisterProject:

I only see this error in v1.5.0. I am not able to reproduce this issue in v1.4.1, so this may be a regression.

Thanks for all your hard work, Alam

P.S. Here is the ALEInfo as requested.

  Enabled Linters: ['eslint', 'tslint', 'tsserver', 'typecheck']
 Linter Variables:
let g:ale_typescript_tslint_config_path = ''
let g:ale_typescript_tslint_executable = 'tslint'
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
 Global Variables:
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
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_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 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_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:
(executable check - failure) eslint
(executable check - success) <redacted path>/node_modules/.bin/
tslint
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''<redacted path>/src'' && <redacted path>/node_modules/.bin/tslint --format
json -c '<redacted path>/tslint.json'' ''/tmp/nvimbZw7G9/2/mai
n.ts''']
<<<OUTPUT STARTS>>>
[]
<<<OUTPUT ENDS>>>
w0rp commented 7 years ago

Do you have the full error message? I can't see the error there.

w0rp commented 7 years ago

Take a look at :mess

ghost commented 7 years ago

Running :messages is outputting the same thing. Is there an argument I'm missing to get the full output?

w0rp commented 7 years ago

See if you can include more of the message. There should at least be a part of the message saying what line the error happened on. Usually that information is also wrong, and there's an earlier error which is the real cause of the problem.

ghost commented 7 years ago

Ah yes, seems I didn't copy a part of it over, my bad. Here's an updated output.

"main.ts" 0L, 0C
Error detected while processing function ale#Queue[9]..ale#CallWithCooldown[9]..<SNR>14_A
LEQueueImpl[41]..ale#Lint[12]..ale#CallWithCooldown[9]..<SNR>14_ALELintImpl[16]..ale#engi
ne#RunLinters[12]..<SNR>56_RunLinter[2]..<SNR>56_CheckWithLSP[2]..ale#linter#StartLSP[28]
..ale#lsp#StartProgram[28]..<SNR>63_RegisterProject:
line    3:
E713: Cannot use empty key for Dictionary
w0rp commented 7 years ago

Cool. Thanks!

w0rp commented 7 years ago

That error is ridiculous. If you look at the online documentation for the error code, both the documentation for Vim and NeoVim say this:

The empty string can be used as a key.

Yet empty string keys work in Vim, but don't work in NeoVim.

I'll work around that by using a substitute key instead.

ghost commented 7 years ago

Hmm 🤔 . You wanna log this to NVIM? I can otherwise.

w0rp commented 7 years ago

It might be an idea to bring it up. I have fixed this now by using a substitute key for empty strings.

aakashsigdel commented 6 years ago

@w0rp I am still getting this error when opening a typescript file(.tsx)

NVIM v0.2.2

w0rp commented 6 years ago

@aakashsigdel Please share the full error message.

aakashsigdel commented 6 years ago

@w0rp here is the full error message:


ne#RunLinters[12]..<SNR>82_RunLinter[2]..<SNR>82_CheckWithLSP[2]..ale#linter#StartLSP[28]..ale#lsp#StartProgram[11]..ale#job#IsRunning:
line    4:
E474: Invalid argument```
w0rp commented 6 years ago

Try updating to the latest code.

aakashsigdel commented 6 years ago

@w0rp I am using vim-plug and I removed everything in .vim dir and did a PlugInstall. But I am still getting these errors

aakashsigdel commented 6 years ago

This was happening because I commented out the vimproc from my vimrc. Sorry for the trouble.

I thought vim8 and nvim both have async api, are you planning to port the code to use those?

w0rp commented 6 years ago

ALE is implemented using async features in Vim 8 and NeoVim. I've never worked with vimproc.

elclanrs commented 6 years ago

@aakashsigdel , I had this same issue after removing vim-proc thinking it was unnecessary, but that gave me the error. I added vim-proc back, and everything works fine again.

I'm using Tsuquyomi and nvim-typescript too, so it may be something to do with those packages in combination with Ale parhaps?

w0rp commented 6 years ago

ALE doesn't use vim-proc.

ohcibi commented 6 years ago

ALE doesn't use vim-proc.

While I absolutely believe you, I must say that I had the same error and it went away after I added vimproc to my plugins. Here is my setup:

Note that this happened with ts files only for me. I never had any issues with plain javascript files and eslint, so this issue must be specific to the typescript component of ALE. I also saw that this happens with the latest version of ALE. I had checked out an older version where this error did not happen as well.

Update:

I tested a bit around and its true that vimproc is not needed with a minimalvimrc and ale as the only plugin. I'm also using Tsuquyomi but not nvim-typescript. It appears as if tsuquyomi is the reason when I tested it in my normal setup however with the minimalvimrc they both work fine together. I'm using dein as a plugin manager. The minimal test was done by adding both plugins to packpath. Not sure where to continue to debug this now...

regexpressyourself commented 6 years ago

Hey all,

I got the same error after updating to the latest version of ale today. Same thing - works fine on everything but typescript files.

I also have the nvim-typescript plugin, but still got the error after removing it.

I can also attest to the fact that, for whatever reason, installing vimproc also fixed the issue.

Hate to add to the mystery, but wanted to add a data point to the debugging process. Happy to help any way I can from here. Ale is one of my favourite plugins. Thanks for all your work w0rp!!

w0rp commented 6 years ago

Could you copy and paste the error you saw? ALE doesn't use vimproc, and has never used vimproc, so that shouldn't make any difference.

regexpressyourself commented 6 years ago

Sure thing!

So when opening a .ts file I get the following:

"tmp.ts" 0L, 0C
Error detected while processing function ale#Queue[9]..ale#CallWithCooldown[9]..<SNR>48_ALEQueueImpl[41]..ale#Lint[12]..ale#CallWithCooldown[9]..<SNR>48_ALELintImpl[16]..ale#engine#RunLinters[14]..<SNR>109_RunLinter[2]..<SNR>109_CheckWithLSP[2]..ale#linter#StartLSP[29]..ale#lsp#StartProgram[11]..ale#job#IsRunning:
line    4:
E474: Invalid argument

1 line less; before #1  2 seconds ago
E474: Invalid argument

Running :ALEInfo gives the following:

 Current Filetype: typescript
Available Linters: ['eslint', 'tslint', 'tsserver', 'typecheck']
  Enabled Linters: ['eslint', 'tslint', 'tsserver', 'typecheck']
 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
 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 g:ale_fix_on_save = 0
let g:ale_fixers = {'typescript': ['tslint']}
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 = {}
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 = 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_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_type_map = {}
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(executable check - success) eslint
(finished - exit code 0) ['/usr/bin/zsh', '-c', '''eslint'' -f unix --stdin --stdin-filename ''/home/zookeeprr/tmp.ts'' < ''/tmp/nvimyVsAX9/3/tmp.ts''']

<<<NO OUTPUT RETURNED>>>

(executable check - success) tslint
(finished - exit code 0) ['/usr/bin/zsh', '-c', 'cd ''/home/zookeeprr'' && ''tslint'' --format json ''/tmp/nvimyVsAX9/4/tmp.ts''']

<<<OUTPUT STARTS>>>
[]
<<<OUTPUT ENDS>>>

I have a fair few plugins. It's not impossible that the ALE error is simply a symptom of another plugin's error. I'll clear out the rest of them and see what I find.

EDIT: Sure enough, running ALE as my only plugin kills the error. I'll try to find the true culprit.

regexpressyourself commented 6 years ago

Making a new comment as I found the culprit!!

Turns out the tsuquyomi plugin was to blame. Fortunately, I believe ALE offers much of the same functionality, so it should be able to be deleted.

I don't develop vim/nvim plugins, so I'm still not sure why those two wouldn't cooperate (or why vimproc made them work together), but that's definitely the issue.

Thanks again w0rp. You da man.

Edit: Another edit. Looks like twuquyomi is actually an aggregation of a bunch of other plugins. Probably one of those that's truly causing the error.

w0rp commented 6 years ago

Okay, that make sense. It might be because they both try to start the same kind of server process, and maybe it's not being started properly if it's already running in a certain way. Maybe installing vimproc makes the other plugin give up on using Vim's build in job control support, so it stops messing with something there.