Skip to content

Commit ce3d783

Browse files
committed
Remove checking file exists
1 parent e92740c commit ce3d783

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

crates/ra_lsp_server/src/server_world.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use ra_ide_api::{
1111
use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot};
1212
use relative_path::RelativePathBuf;
1313
use parking_lot::RwLock;
14-
use failure::format_err;
14+
use failure::{Error, format_err};
1515
use gen_lsp_server::ErrorCode;
1616

1717
use crate::{
@@ -155,18 +155,11 @@ impl ServerWorld {
155155
pub fn uri_to_file_id(&self, uri: &Url) -> Result<FileId> {
156156
let path = uri.to_file_path().map_err(|()| format_err!("invalid uri: {}", uri))?;
157157
let file = self.vfs.read().path2file(&path).ok_or_else(|| {
158-
// Check whether give path is exists,
159-
// if so, maybe this file is outside out current workspace
160-
if path.exists() {
161-
LspError {
162-
code: ErrorCode::InvalidRequest as i32,
163-
message: "Rust file outside current workspace is not supported yet."
164-
.to_string(),
165-
}
166-
.into()
167-
} else {
168-
format_err!("unknown file: {}", path.display())
169-
}
158+
// Show warning as this file is outside current workspace
159+
Error::from(LspError {
160+
code: ErrorCode::InvalidRequest as i32,
161+
message: "Rust file outside current workspace is not supported yet.".to_string(),
162+
})
170163
})?;
171164
Ok(FileId(file.0.into()))
172165
}

0 commit comments

Comments
 (0)