@@ -251,9 +251,11 @@ impl LanguageClient {
251
251
}
252
252
253
253
fn apply_WorkspaceEdit ( & self , edit : & WorkspaceEdit ) -> Fallible < ( ) > {
254
+ use self :: { DocumentChangeOperation :: * , ResourceOp :: * } ;
255
+
254
256
debug ! ( "Begin apply WorkspaceEdit: {:?}" , edit) ;
255
- let filename = self . vim ( ) ?. get_filename ( & Value :: Null ) ?;
256
- let position = self . vim ( ) ?. get_position ( & Value :: Null ) ?;
257
+ let mut filename = self . vim ( ) ?. get_filename ( & Value :: Null ) ?;
258
+ let mut position = self . vim ( ) ?. get_position ( & Value :: Null ) ?;
257
259
258
260
if let Some ( ref changes) = edit. document_changes {
259
261
match changes {
@@ -264,10 +266,19 @@ impl LanguageClient {
264
266
}
265
267
DocumentChanges :: Operations ( ref ops) => {
266
268
for op in ops {
267
- if let DocumentChangeOperation :: Edit ( ref e) = op {
268
- self . apply_TextEdits ( & e. text_document . uri . filepath ( ) ?, & e. edits ) ?;
269
+ match op {
270
+ Edit ( ref e) => {
271
+ self . apply_TextEdits ( & e. text_document . uri . filepath ( ) ?, & e. edits ) ?
272
+ }
273
+ Op ( ref rop) => match rop {
274
+ Create ( file) => {
275
+ filename = file. uri . filepath ( ) ?. to_string_lossy ( ) . into_owned ( ) ;
276
+ position = Position :: default ( ) ;
277
+ }
278
+ Rename ( _file) => bail ! ( "file renaming not yet supported." ) ,
279
+ Delete ( _file) => bail ! ( "file deletion not yet supported." ) ,
280
+ } ,
269
281
}
270
- // TODO: handle ResourceOp.
271
282
}
272
283
}
273
284
}
0 commit comments