Skip to content

Commit 9defff0

Browse files
committed
Make package rename work in java
1 parent 7b51751 commit 9defff0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

python/ycm/vimsupport.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -937,10 +937,10 @@ def _SortChunksByFile( chunks ):
937937
for chunk in chunks:
938938
if 'range' in chunk:
939939
filepath = chunk[ 'range' ][ 'start' ][ 'filepath' ]
940-
elif 'old_file' in chunk:
941-
filepath = chunk[ 'old_file' ]
940+
elif 'old_filepath' in chunk:
941+
filepath = chunk[ 'old_filepath' ]
942942
else:
943-
filepath = chunk[ 'file' ]
943+
filepath = chunk[ 'filepath' ]
944944
chunks_by_file[ filepath ].append( chunk )
945945

946946
return chunks_by_file
@@ -1098,22 +1098,22 @@ def ReplaceChunksInBuffer( chunks, vim_buffer ):
10981098
chunk[ 'range' ][ 'end' ],
10991099
chunk[ 'replacement_text' ],
11001100
vim_buffer ) )
1101-
elif 'old_file' in chunk:
1101+
elif 'old_filepath' in chunk:
11021102
replace_chunks.append(
11031103
RenameChunk(
1104-
chunk[ 'old_file' ],
1105-
chunk[ 'new_file' ],
1104+
chunk[ 'old_filepath' ],
1105+
chunk[ 'new_filepath' ],
11061106
vim_buffer ) )
11071107
elif chunk[ 'kind' ] == 'create':
11081108
replace_chunks.append(
11091109
CreateChunk(
1110-
chunk[ 'file' ],
1110+
chunk[ 'filepath' ],
11111111
vim_buffer,
11121112
chunk[ 'kind' ] ) )
11131113
elif chunk[ 'kind' ] == 'delete':
11141114
replace_chunks.append(
11151115
DeleteChunk(
1116-
chunk[ 'file' ],
1116+
chunk[ 'filepath' ],
11171117
vim_buffer,
11181118
chunk[ 'kind' ] ) )
11191119
return reversed( replace_chunks )
@@ -1228,7 +1228,10 @@ def CreateChunk( file, vim_buffer, kind = 'create' ):
12281228

12291229
def DeleteChunk( file, vim_buffer, kind = 'delete' ):
12301230
vim.command( f'silent! bw! { vim_buffer }' )
1231-
os.remove( file )
1231+
try:
1232+
os.remove( file )
1233+
except FileNotFoundError:
1234+
pass
12321235
return {
12331236
'bufnr': vim_buffer.number,
12341237
'filename': file,

0 commit comments

Comments
 (0)