From 9ccaea1f2baee22078d39b15b64120b93966c92f Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Fri, 15 May 2015 22:54:08 +0300 Subject: [PATCH] Request extra-metadata for completion candidates In cider-nrepl 0.9.0 there is new extra-metadata option for complete op [1]. It can be used to enrich the candiate results with additional properties like arglists and docstring. This commit adds extra-metadata option to complete call and changes the candidate function to set fields in omnicomplete result so that arglists are shown on omnicomplete menu and docstring is shown in preview window. [1]: https://github.com/clojure-emacs/cider-nrepl/pull/195/files --- plugin/fireplace.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/fireplace.vim b/plugin/fireplace.vim index c207e1a..1643505 100644 --- a/plugin/fireplace.vim +++ b/plugin/fireplace.vim @@ -91,9 +91,12 @@ let s:short_types = { function! s:candidate(val) abort let type = get(a:val, 'type', '') + let arglists = get(a:val, 'arglists', []) return { \ 'word': get(a:val, 'candidate'), - \ 'kind': get(s:short_types, type, type) + \ 'kind': get(s:short_types, type, type), + \ 'info': get(a:val, 'doc', ''), + \ 'menu': empty(arglists) ? '' : '(' . join(arglists, ' ') . ')' \ } endfunction @@ -105,7 +108,7 @@ function! fireplace#omnicomplete(findstart, base) abort try if fireplace#op_available('complete') - let response = fireplace#message({'op': 'complete', 'symbol': a:base}) + let response = fireplace#message({'op': 'complete', 'symbol': a:base, 'extra-metadata': ['arglists', 'doc']}) let trans = '{"word": (v:val =~# ''[./]'' ? "" : matchstr(a:base, ''^.\+/'')) . v:val}' let value = get(response[0], 'value', get(response[0], 'completions')) if type(value) == type([])