Auto merge of #1899 - oblitum:empty-insertion-text, r=oblitum
Allows empty insertion text. This is useful for hints for example, whose purpose is information display solely. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1899) <!-- Reviewable:end -->
This commit is contained in:
commit
ea3e207643
@ -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' ] ),
|
||||
'dup' : 1,
|
||||
'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:
|
||||
|
@ -52,12 +52,13 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'doc_string': 'DOC STRING',
|
||||
},
|
||||
}, {
|
||||
'word': 'INSERTION TEXT',
|
||||
'abbr': 'MENU TEXT',
|
||||
'menu': 'EXTRA MENU INFO',
|
||||
'kind': 'k',
|
||||
'info': 'DETAILED INFO\nDOC STRING',
|
||||
'dup' : 1,
|
||||
'word' : 'INSERTION TEXT',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO\nDOC STRING',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -69,12 +70,13 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'kind': 'K',
|
||||
'detailed_info': 'DETAILED INFO',
|
||||
}, {
|
||||
'word': 'INSERTION TEXT',
|
||||
'abbr': 'MENU TEXT',
|
||||
'menu': 'EXTRA MENU INFO',
|
||||
'kind': 'k',
|
||||
'info': 'DETAILED INFO',
|
||||
'dup' : 1,
|
||||
'word' : 'INSERTION TEXT',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'info' : 'DETAILED INFO',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -88,12 +90,13 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'doc_string': 'DOC STRING',
|
||||
},
|
||||
}, {
|
||||
'word': 'INSERTION TEXT',
|
||||
'abbr': 'MENU TEXT',
|
||||
'menu': 'EXTRA MENU INFO',
|
||||
'kind': 'k',
|
||||
'info': 'DOC STRING',
|
||||
'dup' : 1,
|
||||
'word' : 'INSERTION TEXT',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'info' : 'DOC STRING',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -106,11 +109,12 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'extra_data': {
|
||||
},
|
||||
}, {
|
||||
'word': 'INSERTION TEXT',
|
||||
'abbr': 'MENU TEXT',
|
||||
'menu': 'EXTRA MENU INFO',
|
||||
'kind': 'k',
|
||||
'dup' : 1,
|
||||
'word' : 'INSERTION TEXT',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'kind' : 'k',
|
||||
'dup' : 1,
|
||||
'empty': 1,
|
||||
} )
|
||||
|
||||
|
||||
@ -124,10 +128,52 @@ class ConvertCompletionResponseToVimDatas_test:
|
||||
'extra_data': {
|
||||
},
|
||||
}, {
|
||||
'word': 'INSERTION TEXT',
|
||||
'abbr': 'MENU TEXT',
|
||||
'menu': 'EXTRA MENU INFO',
|
||||
'kind': 'k',
|
||||
'info': 'DETAILED INFO',
|
||||
'dup' : 1,
|
||||
'word' : 'INSERTION TEXT',
|
||||
'abbr' : 'MENU TEXT',
|
||||
'menu' : 'EXTRA MENU INFO',
|
||||
'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