Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions autoload/llama.vim
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,16 @@ function! s:fim_on_response(hashes, job_id, data, event = v:null)
return
endif

" ensure the response is valid JSON, starting with a fast check before full decode
if l:raw !~# '^\s*{' || l:raw !~# '\v"content"\s*:"'
return
endif
try
let l:response = json_decode(l:raw)
catch
return
endtry

" put the response in the cache
for l:hash in a:hashes
call s:cache_insert(l:hash, l:raw)
Expand Down