aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_lsp_server/src/server_world.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs
index 6fe0d39df..4b1d592bb 100644
--- a/crates/ra_lsp_server/src/server_world.rs
+++ b/crates/ra_lsp_server/src/server_world.rs
@@ -11,7 +11,7 @@ use ra_ide_api::{
11use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot}; 11use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot};
12use relative_path::RelativePathBuf; 12use relative_path::RelativePathBuf;
13use parking_lot::RwLock; 13use parking_lot::RwLock;
14use failure::format_err; 14use failure::{Error, format_err};
15use gen_lsp_server::ErrorCode; 15use gen_lsp_server::ErrorCode;
16 16
17use crate::{ 17use crate::{
@@ -155,18 +155,11 @@ impl ServerWorld {
155 pub fn uri_to_file_id(&self, uri: &Url) -> Result<FileId> { 155 pub fn uri_to_file_id(&self, uri: &Url) -> Result<FileId> {
156 let path = uri.to_file_path().map_err(|()| format_err!("invalid uri: {}", uri))?; 156 let path = uri.to_file_path().map_err(|()| format_err!("invalid uri: {}", uri))?;
157 let file = self.vfs.read().path2file(&path).ok_or_else(|| { 157 let file = self.vfs.read().path2file(&path).ok_or_else(|| {
158 // Check whether give path is exists, 158 // Show warning as this file is outside current workspace
159 // if so, maybe this file is outside out current workspace 159 Error::from(LspError {
160 if path.exists() { 160 code: ErrorCode::InvalidRequest as i32,
161 LspError { 161 message: "Rust file outside current workspace is not supported yet.".to_string(),
162 code: ErrorCode::InvalidRequest as i32, 162 })
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 }
170 })?; 163 })?;
171 Ok(FileId(file.0.into())) 164 Ok(FileId(file.0.into()))
172 } 165 }