Auto merge of #3265 - micbou:omnifunc-adjust-candidate-insertion-text, r=bstaletic
[READY] Fix insertion adjustment for omnifunc candidates The assumption that the `abbr` field always exist does not hold when candidates are from Vim's omnifunc. Fixes #3264. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/3265) <!-- Reviewable:end -->
This commit is contained in:
commit
5083c8be22
@ -103,7 +103,7 @@ def AdjustCandidateInsertionText( candidates ):
|
|||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
new_candidate = candidate.copy()
|
new_candidate = candidate.copy()
|
||||||
|
|
||||||
if not new_candidate[ 'abbr' ]:
|
if not new_candidate.get( 'abbr' ):
|
||||||
new_candidate[ 'abbr' ] = new_candidate[ 'word' ]
|
new_candidate[ 'abbr' ] = new_candidate[ 'word' ]
|
||||||
|
|
||||||
new_candidate[ 'word' ] = NewCandidateInsertionText(
|
new_candidate[ 'word' ] = NewCandidateInsertionText(
|
||||||
|
@ -130,6 +130,13 @@ def AdjustCandidateInsertionText_DontTouchAbbr_test():
|
|||||||
{ 'word': 'foobar', 'abbr': '1234' } ] ) )
|
{ 'word': 'foobar', 'abbr': '1234' } ] ) )
|
||||||
|
|
||||||
|
|
||||||
|
def AdjustCandidateInsertionText_NoAbbr_test():
|
||||||
|
with MockTextAfterCursor( 'bar' ):
|
||||||
|
eq_( [ { 'word': 'foo', 'abbr': 'foobar' } ],
|
||||||
|
base.AdjustCandidateInsertionText( [
|
||||||
|
{ 'word': 'foobar' } ] ) )
|
||||||
|
|
||||||
|
|
||||||
def OverlapLength_Basic_test():
|
def OverlapLength_Basic_test():
|
||||||
eq_( 3, base.OverlapLength( 'foo bar', 'bar zoo' ) )
|
eq_( 3, base.OverlapLength( 'foo bar', 'bar zoo' ) )
|
||||||
eq_( 3, base.OverlapLength( 'foobar', 'barzoo' ) )
|
eq_( 3, base.OverlapLength( 'foobar', 'barzoo' ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user