Fix 3886 - Don't JSON decode completion user data if already a dict (#3894)

Co-authored-by: Horacio Sanson <horacio@allm.inc>
This commit is contained in:
Horacio Sanson 2021-09-08 21:45:19 +09:00 committed by GitHub
parent 35d0bd1519
commit 42aadf6a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -1001,12 +1001,11 @@ 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)
\ ? ale#util#FuzzyJSONDecode(l:user_data_json, v:null)
\ : v:null
let l:user_data = type(l:user_data_json) is v:t_dict
\ ? l:user_data_json
\ : ale#util#FuzzyJSONDecode(l:user_data_json, {})
if type(l:user_data) isnot v:t_dict
\|| get(l:user_data, '_ale_completion_item', 0) isnot 1
if !has_key(l:user_data, '_ale_completion_item')
return
endif