Skip to content

Commit

Permalink
Make package rename work in java
Browse files Browse the repository at this point in the history
  • Loading branch information
bstaletic committed Oct 13, 2024
1 parent 7b51751 commit 9defff0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions python/ycm/vimsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,10 +937,10 @@ def _SortChunksByFile( chunks ):
for chunk in chunks:
if 'range' in chunk:
filepath = chunk[ 'range' ][ 'start' ][ 'filepath' ]
elif 'old_file' in chunk:
filepath = chunk[ 'old_file' ]
elif 'old_filepath' in chunk:
filepath = chunk[ 'old_filepath' ]

Check warning on line 941 in python/ycm/vimsupport.py

View check run for this annotation

Codecov / codecov/patch

python/ycm/vimsupport.py#L940-L941

Added lines #L940 - L941 were not covered by tests
else:
filepath = chunk[ 'file' ]
filepath = chunk[ 'filepath' ]

Check warning on line 943 in python/ycm/vimsupport.py

View check run for this annotation

Codecov / codecov/patch

python/ycm/vimsupport.py#L943

Added line #L943 was not covered by tests
chunks_by_file[ filepath ].append( chunk )

return chunks_by_file
Expand Down Expand Up @@ -1098,22 +1098,22 @@ def ReplaceChunksInBuffer( chunks, vim_buffer ):
chunk[ 'range' ][ 'end' ],
chunk[ 'replacement_text' ],
vim_buffer ) )
elif 'old_file' in chunk:
elif 'old_filepath' in chunk:
replace_chunks.append(

Check warning on line 1102 in python/ycm/vimsupport.py

View check run for this annotation

Codecov / codecov/patch

python/ycm/vimsupport.py#L1101-L1102

Added lines #L1101 - L1102 were not covered by tests
RenameChunk(
chunk[ 'old_file' ],
chunk[ 'new_file' ],
chunk[ 'old_filepath' ],
chunk[ 'new_filepath' ],
vim_buffer ) )
elif chunk[ 'kind' ] == 'create':
replace_chunks.append(

Check warning on line 1108 in python/ycm/vimsupport.py

View check run for this annotation

Codecov / codecov/patch

python/ycm/vimsupport.py#L1107-L1108

Added lines #L1107 - L1108 were not covered by tests
CreateChunk(
chunk[ 'file' ],
chunk[ 'filepath' ],
vim_buffer,
chunk[ 'kind' ] ) )
elif chunk[ 'kind' ] == 'delete':
replace_chunks.append(

Check warning on line 1114 in python/ycm/vimsupport.py

View check run for this annotation

Codecov / codecov/patch

python/ycm/vimsupport.py#L1113-L1114

Added lines #L1113 - L1114 were not covered by tests
DeleteChunk(
chunk[ 'file' ],
chunk[ 'filepath' ],
vim_buffer,
chunk[ 'kind' ] ) )
return reversed( replace_chunks )
Expand Down Expand Up @@ -1228,7 +1228,10 @@ def CreateChunk( file, vim_buffer, kind = 'create' ):

def DeleteChunk( file, vim_buffer, kind = 'delete' ):
vim.command( f'silent! bw! { vim_buffer }' )
os.remove( file )
try:
os.remove( file )
except FileNotFoundError:
pass
return {

Check warning on line 1235 in python/ycm/vimsupport.py

View check run for this annotation

Codecov / codecov/patch

python/ycm/vimsupport.py#L1230-L1235

Added lines #L1230 - L1235 were not covered by tests
'bufnr': vim_buffer.number,
'filename': file,
Expand Down

0 comments on commit 9defff0

Please sign in to comment.