Allows empty insertion text.
This is useful for hints for example, whose purpose is information display solely.
This commit is contained in:
parent
f25e1c9a48
commit
9fdd465c26
@ -64,8 +64,9 @@ class CompletionRequest( BaseRequest ):
|
||||
def ConvertCompletionDataToVimData( completion_data ):
|
||||
# see :h complete-items for a description of the dictionary fields
|
||||
vim_data = {
|
||||
'word' : ToUtf8IfNeeded( completion_data[ 'insertion_text' ] ),
|
||||
'word' : '',
|
||||
'dup' : 1,
|
||||
'empty' : 1,
|
||||
}
|
||||
|
||||
if ( 'extra_data' in completion_data and
|
||||
@ -75,6 +76,8 @@ def ConvertCompletionDataToVimData( completion_data ):
|
||||
else:
|
||||
doc_string = ""
|
||||
|
||||
if 'insertion_text' in completion_data:
|
||||
vim_data[ 'word' ] = ToUtf8IfNeeded( completion_data[ 'insertion_text' ] )
|
||||
if 'menu_text' in completion_data:
|
||||
vim_data[ 'abbr' ] = ToUtf8IfNeeded( completion_data[ 'menu_text' ] )
|
||||
if 'extra_menu_info' in completion_data:
|
||||
|
@ -58,6 +58,7 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO\nDOC STRING',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -75,6 +76,7 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -94,6 +96,7 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'kind' : 'k',
|
||||
'info' : 'DOC STRING',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -111,6 +114,7 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -130,4 +134,46 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
def Empty_Insertion_Text_test( self ):
|
||||
self._Check( {
|
||||
'insertion_text': '',
|
||||
'menu_text': 'MENU TEXT',
|
||||
'extra_menu_info': 'EXTRA MENU INFO',
|
||||
'kind': 'K',
|
||||
'detailed_info': 'DETAILED INFO',
|
||||
'extra_data': {
|
||||
'doc_string': 'DOC STRING',
|
||||
},
|
||||
}, {
|
||||
'word' : '',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO\nDOC STRING',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
def No_Insertion_Text_test( self ):
|
||||
self._Check( {
|
||||
'menu_text': 'MENU TEXT',
|
||||
'extra_menu_info': 'EXTRA MENU INFO',
|
||||
'kind': 'K',
|
||||
'detailed_info': 'DETAILED INFO',
|
||||
'extra_data': {
|
||||
'doc_string': 'DOC STRING',
|
||||
},
|
||||
}, {
|
||||
'word' : '',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO\nDOC STRING',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
Loading…
Reference in New Issue
Block a user