Skip to content

Commit

Permalink
Tweak codes to work covimerage
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz committed May 12, 2019
1 parent 85c3771 commit 28462c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion autoload/iced.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function! s:json_resp(resp) abort
endtry
endfunction

function! s:callback(callback, resp) abort
return a:callback(s:json_resp(a:resp))
endfunction

function! iced#eval_and_read(code, ...) abort
let msg = {
\ 'id': iced#nrepl#id(),
Expand All @@ -41,7 +45,10 @@ function! iced#eval_and_read(code, ...) abort
\ }
let Callback = get(a:, 1, '')
if type(Callback) == v:t_func
let msg['callback'] = {resp -> Callback(s:json_resp(resp))}
" HACK: let msg['callback'] = {resp -> Callback(s:json_resp(resp))}
" This code will fail when calculating coverage by covimerage.
let msg['callback'] = function('s:callback', [Callback])

call iced#nrepl#send(msg)
return v:true
else
Expand Down

0 comments on commit 28462c5

Please sign in to comment.