Support new return value of completions operator

This commit is contained in:
Tim Pope 2014-11-30 00:46:33 -05:00
parent 04ce1b64af
commit 874505e9f2

View File

@ -91,11 +91,12 @@ function! fireplace#omnicomplete(findstart, base) abort
if fireplace#op_available('complete') if fireplace#op_available('complete')
let response = fireplace#message({'op': 'complete', 'symbol': a:base}) let response = fireplace#message({'op': 'complete', 'symbol': a:base})
let trans = '(v:val =~# ''\.'' ? "" : matchstr(a:base, ''^.\+/'')) . v:val' let trans = '(v:val =~# ''\.'' ? "" : matchstr(a:base, ''^.\+/'')) . v:val'
if type(get(response[0], 'value')) == type([]) let value = get(response[0], 'value', get(response[0], 'completions'))
if type(get(response[0].value, 0)) == type([]) if type(value) == type([])
return map(response[0].value[0], trans) if type(get(value, 0)) == type([])
elseif type(get(response[0].value, 0)) == type('') return map(value[0], trans)
return map(response[0].value, trans) elseif type(get(value, 0)) == type('')
return map(value, trans)
else else
return [] return []
endif endif