From b5b44659a42cf982590519317ede9ead354f9c4e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 21 Dec 2018 12:18:14 +0300 Subject: edits use source-root API --- crates/ra_lsp_server/src/conv.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'crates/ra_lsp_server/src/conv.rs') diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 3531b727e..218ded4ee 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs @@ -283,16 +283,17 @@ impl TryConvWith for FileSystemEdit { type Output = req::FileSystemEdit; fn try_conv_with(self, world: &ServerWorld) -> Result { let res = match self { - FileSystemEdit::CreateFile { anchor, path } => { - let uri = world.file_id_to_uri(anchor)?; - let path = &path.as_str()[3..]; // strip `../` b/c url is weird - let uri = uri.join(path)?; + FileSystemEdit::CreateFile { source_root, path } => { + let uri = world.path_to_uri(source_root, &path)?; req::FileSystemEdit::CreateFile { uri } } - FileSystemEdit::MoveFile { file, path } => { - let src = world.file_id_to_uri(file)?; - let path = &path.as_str()[3..]; // strip `../` b/c url is weird - let dst = src.join(path)?; + FileSystemEdit::MoveFile { + src, + dst_source_root, + dst_path, + } => { + let src = world.file_id_to_uri(src)?; + let dst = world.path_to_uri(dst_source_root, &dst_path)?; req::FileSystemEdit::MoveFile { src, dst } } }; -- cgit v1.2.3