Ale: Error detected while processing function ale#completion#HandleUserData when using deoplete and vim-go together with ale

Created on 1 Oct 2020  Â·  6Comments  Â·  Source: dense-analysis/ale

Information

VIM version


NVIM v0.4.4
Build type: Release

Operating System: latest arch linux.

What went wrong


Error detected while processing function ale#completion#HandleUserData

Reproducing the bug

Using golang autocomplete through deoplete and vim-go (gopls). Not using ale for completion( let g:ale_completion_enabled = 0 ).

relevant config for setting this up:

" deoplete stuff
call deoplete#custom#option('omni_patterns', {
\ 'go': '[^. *\t]\.\w*',
\})
" my ale stuff:
let g:ale_sign_error = '✘'
let g:ale_sign_warning = 'âš '

" use tsserver which then calls tslint for now
let g:ale_linters_ignore = {'typescript': ['tslint'], 'typescriptreact': ['tslint']}
let g:ale_linters = {
            \'go': ['go build', 'golangci-lint'],
            \}
let g:ale_go_golangci_lint_options = '--enable-all --disable wsl --disable lll --disable goimports --disable gochecknoinits --disable gochecknoglobals --disable gomnd --disable gofmt --disable unused --fix'
let g:ale_go_golangci_lint_package = 1
let g:ale_php_phpmd_ruleset = "~/.phpmd-ruleset.xml"
let g:airline#extensions#ale#enabled = 1

i typed log.Prior any other autocompleted function and scrolled through the list with down arrow and selected one with i always get the error.
It seems like the autocmd which calls HandleUserData does not contain json but the string? And why is that autocmd enabled when im not using completion in ale? Seems debugging info about this is missing from :ALEInfo

log using -V9logfile.log:

continuing in function go#complete#Complete[23]..<SNR>123_on_stdout[1]..<SNR>123_neocb[58]..26[13]..28[26]..<SNR>121_completionHandler-- Omni completion (^O^N^P) -- Searching...-- Omni completion (^O^N^P) Back at original
Executing TextChangedP Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedP')

Executing InsertCharPre Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedP')

Executing CompleteDone Autocommands for "*"
autocommand call <sid>on_window_changed('CompleteDone')

Executing CompleteDone Autocommands for "<buffer=1>"
autocommand call go#auto#complete_done()

Executing CompleteDone Autocommands for "*"
autocommand call s:on_complete_done()

Executing CompleteDone Autocommands for "*"
autocommand call ale#completion#HandleUserData(v:completed_item)

change line  col text
  100     5    0 
   99     2    0 
   98     7    0 -invalid-
   97     5    0 
   96     2    0 
   95     8    0 -invalid-
   94     5    0 
   93     2    0 
   92     8    0 -invalid-
   91     5    0 
   90     2    0 
   89     7    0 -invalid-
   88     5    0 
   87     2   13 
   86     8   13 -invalid-
   85     5   13 
   84     2   13 
   83     8   13 -invalid-
   82     5   13 
   81     2   13 
   80     7   13 -invalid-
   79     5   13 
   78     2   13 
   77     8   13 -invalid-
   76     5   13 
   75     2   13 
   74     8   13 -invalid-
   73     5   13 
   72     2   13 
   71     7   13 -invalid-
   70     5   13 
   69     2    0 
   68     8    0 -invalid-
   67     5    0 
   66     2    0 
   65     8    0 -invalid-
   64     5    0 
   63     2    0 
   62     7    0 -invalid-
   61     5    0 
   60     2    0 
   59     8    0 -invalid-
   58     5    0 
   57     2    0 
   56     8    0 -invalid-
   55     5    0 
   54     2    0 
   53     7    0 -invalid-
   52     5    0 
   51     2   15 
   50     3   15 func main() {
   49     2   15 
   48     3   15 func main() {
   47     2   15 
   46     3   15 func main() {
   45     2   15 
   44     3   15 func main() {
   43     2   15 
   42     3   15 func main() {
   41     2   15 
   40     3   15 func main() {
   39     2    0 
   38     3    0 func main() {
   37     2    0 
   36     3    0 func main() {
   35     2    0 
   34     3    0 func main() {
   33     2    0 
   32     3    0 func main() {
   31     2    0 
   30     3    0 func main() {
   29     2    0 
   28     3    0 func main() {
   27     2    0 
   26     5    0 
   25     2    0 
   24     5    0 
   23     2    0 
   22     5    0 
   21     2    0 
   20     5    0 
   19     2    0 
   18     5    0 
   17     2    0 
   16     5    0 
   15     2    0 
   14     3    0 func main() {
   13     2    0 
   12     3    0 func main() {
   11     2    0 
   10     3    0 func main() {
    9     2    0 
    8     3    0 func main() {
    7     2    0 
    6     3    0 func main() {
    5     2    0 
    4     3    0 func main() {
    3     6   12 }
    2     7    0 -invalid-
    1     4    8 logrus.I
>
vim-go: [completion] SUCCESS
Executing TextChangedP Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedP')
-- Omni completion (^O^N^P) Back at original
Executing InsertCharPre Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedP')

Executing CompleteDone Autocommands for "*"
autocommand call <sid>on_window_changed('CompleteDone')

Executing CompleteDone Autocommands for "<buffer=1>"
autocommand call go#auto#complete_done()

Executing CompleteDone Autocommands for "*"
autocommand call s:on_complete_done()

Executing CompleteDone Autocommands for "*"
autocommand call ale#completion#HandleUserData(v:completed_item)

vim-go: [completion] SUCCESS-- Omni completion (^O^N^P) -- Searching...-- Omni completion (^O^N^P) Back at original
Executing TextChangedP Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedP')
-- Omni completion (^O^N^P)-- Omni completion (^O^N^P)-- Omni completion (^O^N^P) match 1 of 8
Executing TextChangedP Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedP Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedP')

Executing CompleteDone Autocommands for "*"
autocommand call <sid>on_window_changed('CompleteDone')

Executing CompleteDone Autocommands for "<buffer=1>"
autocommand call go#auto#complete_done()

vim-go: Info func(args ...interface{}) (from "github.com/sirupsen/logrus")
Executing CompleteDone Autocommands for "*"
autocommand call s:on_complete_done()

Executing CompleteDone Autocommands for "*"
autocommand call ale#completion#HandleUserData(v:completed_item)

Error detected while processing function ale#completion#HandleUserData:
line    2:
E474: Unidentified byte: Info func(args ...interface{}) (from "github.com/sirupsen/logrus")
Error detected while processing function ale#completion#HandleUserData:
line    2:
E474: Failed to parse Info func(args ...interface{}) (from "github.com/sirupsen/logrus")
Executing InsertCharPre Autocommands for "*"
autocommand call UltiSnips#TrackChange()
-- INSERT --
Executing CursorMovedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing TextChangedI Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing TextChangedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing TextChangedI Autocommands for "*"
autocommand call s:completion_timer_start('TextChangedI')

Executing CursorMovedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMovedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing InsertCharPre Autocommands for "*"
autocommand call UltiSnips#TrackChange()

Executing CursorMovedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()


:ALEInfo


 Current Filetype: go
Available Linters: ['bingo', 'gobuild', 'gofmt', 'golangci-lint', 'golint', 'gometalinter', 'gopls', 'gosimple', 'gotype', 'govet', 'golangserver', 'revive', 'staticcheck']
   Linter Aliases:
'gobuild' -> ['go build']
'govet' -> ['go vet']
  Enabled Linters: ['gobuild', 'golangci-lint']
  Ignored Linters: []
 Suggested Fixers: 
  'gofmt' - Fix Go files with go fmt.
  'goimports' - Fix Go files imports with goimports.
  '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:

let g:ale_go_go_executable = 'go'
let g:ale_go_gobuild_options = ''
let g:ale_go_golangci_lint_executable = 'golangci-lint'
let g:ale_go_golangci_lint_options = '--enable-all --disable wsl --disable lll --disable goimports --disable gochecknoinits --disable gochecknoglobals --disable gomnd --disable gofmt --disable unused --fix'
let g:ale_go_golangci_lint_package = 1
let g:ale_go_langserver_executable = 'go-langserver'
let g:ale_go_langserver_options = ''
 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 = 0
let g:ale_completion_max_suggestions = 50
let g:ale_disable_lsp = 0
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 = {}
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 = {'go': ['go build', 'golangci-lint']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {'typescriptreact': ['tslint'], 'typescript': ['tslint']}
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:

(executable check - success) go
(finished - exit code 2) ['/bin/bash', '-c', 'cd ''/home/jonaz/git/fnxctl'' && go test -c -o /dev/null ./']

<<<OUTPUT STARTS>>>
# go.fnox.se/fnx/fnxctl
./test.go:3:6: main redeclared in this block
    previous declaration at ./fnx.go:29:6
<<<OUTPUT ENDS>>>

(executable check - success) golangci-lint
(finished - exit code 3) ['/bin/bash', '-c', 'cd ''/home/jonaz/git/fnxctl'' && ''golangci-lint'' run --enable-all --disable wsl --disable lll --disable goimports --disable gochecknoinits --disable gochecknoglobals --disable gomnd --disable gofmt --disable unused --fix']

<<<NO OUTPUT RETURNED>>>


bug

Most helpful comment

Thanks for raising this! I'm seeing the same issue when using deoplete with neovim's built-in LSP, also with ALE's completion disabled.

All 6 comments

Just tried commenting out this and the problem is resolved. Why is ALECompletionActions enabled when ale completion is disabled?

diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index ecd93600..8dbbf4b3 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -1021,11 +1021,11 @@ function! ale#completion#Done() abort
     let s:last_done_pos = getpos('.')[1:2]
 endfunction

-augroup ALECompletionActions
-    autocmd!
+"augroup ALECompletionActions
+    "autocmd!

-    autocmd CompleteDone * call ale#completion#HandleUserData(v:completed_item)
-augroup END
+    "autocmd CompleteDone * call ale#completion#HandleUserData(v:completed_item)
+"augroup END

 function! s:Setup(enabled) abort
     augroup ALECompletionGroup

The problem is introduced in 396fba7cc when autocmd! was added to the group.

Thanks for raising this! I'm seeing the same issue when using deoplete with neovim's built-in LSP, also with ALE's completion disabled.

I can confirm this issue while using ale with vim-go and YCM.

Experienced the same issue with _deoplete_ and golang completion:

Error detected while processing CompleteDone Autocommands for "*"..function ale#completion#HandleUserData:
line    4:
E491: json decode error at 'Println func(a ...interface{}) (n int, err error)'

My quickfix is just to catch json_decode error and exit that method in that case without doing anything:

diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 39bfc09..d8b37ff 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -993,9 +993,14 @@ endfunction

 function! ale#completion#HandleUserData(completed_item) abort
     let l:user_data_json = get(a:completed_item, 'user_data', '')
-    let l:user_data = !empty(l:user_data_json)
-    \   ? json_decode(l:user_data_json)
-    \   : v:null
+
+    try
+        let l:user_data = !empty(l:user_data_json)
+        \   ? json_decode(l:user_data_json)
+        \   : v:null
+    catch
+        return
+    endtry

     if type(l:user_data) isnot v:t_dict
     \|| get(l:user_data, '_ale_completion_item', 0) isnot 1

I don't get why we even want that code called if we are not using ale completion. Should only affect performance negative. When I commented out the augroup ALECompletionActions nvim felt more responsive immediately.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glepnir picture glepnir  Â·  3Comments

alexlafroscia picture alexlafroscia  Â·  4Comments

sodiumjoe picture sodiumjoe  Â·  4Comments

aressler38 picture aressler38  Â·  3Comments

ilyakopy picture ilyakopy  Â·  4Comments