@@ -11,7 +11,7 @@ use ra_ide_api::{
11
11
use ra_vfs:: { Vfs , VfsChange , VfsFile , VfsRoot } ;
12
12
use relative_path:: RelativePathBuf ;
13
13
use parking_lot:: RwLock ;
14
- use failure:: format_err;
14
+ use failure:: { Error , format_err} ;
15
15
use gen_lsp_server:: ErrorCode ;
16
16
17
17
use crate :: {
@@ -155,18 +155,11 @@ impl ServerWorld {
155
155
pub fn uri_to_file_id ( & self , uri : & Url ) -> Result < FileId > {
156
156
let path = uri. to_file_path ( ) . map_err ( |( ) | format_err ! ( "invalid uri: {}" , uri) ) ?;
157
157
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
+ } )
170
163
} ) ?;
171
164
Ok ( FileId ( file. 0 . into ( ) ) )
172
165
}
0 commit comments