summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-09-08 21:45:19 +0900
committerGitHub <noreply@github.com>2021-09-08 21:45:19 +0900
commit42aadf6a263af953e206490b80d6b8b97ef08cf8 (patch)
tree83bd6e49deed2b9310327d2348553c39d668c5f6
parent35d0bd15194b95f0dc8483ee6e727fcf3d4c8b26 (diff)
downloadale-42aadf6a263af953e206490b80d6b8b97ef08cf8.zip
Fix 3886 - Don't JSON decode completion user data if already a dict (#3894)
Co-authored-by: Horacio Sanson <horacio@allm.inc>
-rw-r--r--autoload/ale/completion.vim9
1 files changed, 4 insertions, 5 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 5237288e..e139feaa 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -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