This commit is contained in:
dhleong 2016-11-03 11:21:15 -04:00
parent 0523ad02c0
commit 0babb4b102
2 changed files with 3 additions and 3 deletions

View File

@ -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 )

View File

@ -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 )