Allow checking for nREPL op

This commit is contained in:
Tim Pope 2014-04-12 20:06:12 -04:00
parent c48adc045b
commit 79c2a718da
2 changed files with 12 additions and 0 deletions

View File

@ -207,6 +207,10 @@ function! s:nrepl_message(msg, ...) dict abort
return call(self.call, [msg, ['done'], sel] + a:000, self)
endfunction
function! s:nrepl_has_op(op) dict abort
return has_key(self.describe.ops, a:op)
endfunction
let s:nrepl = {
\ 'close': s:function('s:nrepl_close'),
\ 'clone': s:function('s:nrepl_clone'),
@ -214,5 +218,6 @@ let s:nrepl = {
\ 'call': s:function('s:nrepl_call'),
\ 'message': s:function('s:nrepl_message'),
\ 'eval': s:function('s:nrepl_eval'),
\ 'has_op': s:function('s:nrepl_has_op'),
\ 'path': s:function('s:nrepl_path'),
\ 'process': s:function('s:nrepl_process')}

View File

@ -539,6 +539,13 @@ function! fireplace#message(payload, ...) abort
return call(client.message, [payload] + a:000, client)
endfunction
function! fireplace#op_available(op) abort
let client = fireplace#platform()
if has_key(client, 'connection')
return client.connection.has_op(a:op)
endif
endfunction
function! fireplace#findresource(resource, ...) abort
if a:resource ==# ''
return ''