From b500600c56c42a190bff12b9560c9f46a81a45b9 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 4 Feb 2018 18:11:52 +0900 Subject: [PATCH] Fix #413 parse problem --- autoload/neosnippet/parser.vim | 17 ++++++++++------- test/functions.vim | 5 ----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/autoload/neosnippet/parser.vim b/autoload/neosnippet/parser.vim index 0c03be8..3824235 100644 --- a/autoload/neosnippet/parser.vim +++ b/autoload/neosnippet/parser.vim @@ -295,15 +295,18 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, cur_text, nex endif " Set abbr - let abbr = (item.abbr != '') ? item.abbr : item.word - if len(item.menu) > 5 - " Combine menu. - let abbr .= ' ' . item.menu - endif - if item.info != '' - let abbr .= split(item.info, '\n')[0] + let abbr = '' + if get(item, 'info', '') =~# '^.\+(' + let abbr = matchstr(item.info, '^\_s*\zs.*') + elseif get(item, 'abbr', '') =~# '^.\+(' + let abbr = item.abbr + elseif get(item, 'menu', '') =~# '^.\+(' + let abbr = item.menu + elseif item.word =~# '^.\+(' || get(item, 'kind', '') == 'f' + let abbr = item.word endif let abbr = escape(abbr, '\') + let pairs = neosnippet#util#get_buffer_config( \ &filetype, '', \ 'g:neosnippet#completed_pairs', 'g:neosnippet#_completed_pairs', {}) diff --git a/test/functions.vim b/test/functions.vim index d1f6db9..7ecce41 100644 --- a/test/functions.vim +++ b/test/functions.vim @@ -92,11 +92,6 @@ function! s:suite.get_completed_snippet() abort \ 'menu' : '', 'info' : '' \ }, 'foo{', ''), '${1}}${2}') - call s:assert.equals(neosnippet#parser#_get_completed_snippet({ - \ 'word' : 'foo{', 'abbr' : 'foo{piyo}', - \ 'menu' : '', 'info' : '' - \ }, 'foo{', ''), '${1:#:piyo}}${2}') - call s:assert.equals(neosnippet#parser#_get_completed_snippet({ \ 'word' : 'Dictionary', 'abbr' : 'Dictionary(foo)', \ 'menu' : '', 'info' : ''