From 0babb4b1021ad9f613ffb0c2c3d0e16b9aaad2b2 Mon Sep 17 00:00:00 2001 From: dhleong Date: Thu, 3 Nov 2016 11:21:15 -0400 Subject: [PATCH] Cleanup --- python/ycm/tests/vimsupport_test.py | 4 ++-- python/ycm/vimsupport.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/ycm/tests/vimsupport_test.py b/python/ycm/tests/vimsupport_test.py index b4367f8b..131a4360 100644 --- a/python/ycm/tests/vimsupport_test.py +++ b/python/ycm/tests/vimsupport_test.py @@ -1562,7 +1562,7 @@ def InsertNamespace_append_test( vim_current, *args ): '', ' class Tasty {', ' int taco;', - ' List salad = new List'] + ' List salad = new List' ] vim_current.buffer = VimBuffer( '', contents = contents ) vimsupport.InsertNamespace( 'System.Collections' ) @@ -1573,5 +1573,5 @@ def InsertNamespace_append_test( vim_current, *args ): '', ' class Tasty {', ' int taco;', - ' List salad = new List'] + ' List salad = new List' ] AssertBuffersAreEqualAsBytes( expected_buffer, vim_current.buffer ) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 30f9a452..ef793ffd 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -848,7 +848,7 @@ def InsertNamespace( namespace ): pattern = '^\s*using\(\s\+[a-zA-Z0-9]\+\s\+=\)\?\s\+[a-zA-Z0-9.]\+\s*;\s*' existing_indent = '' line = SearchInCurrentBuffer( pattern ) - if line > 0: + if line: existing_line = LineTextInCurrentBuffer( line ) existing_indent = re.sub( r"\S.*", "", existing_line ) new_line = "{0}using {1};\n\n".format( existing_indent, namespace )