aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/path_map.rs23
-rw-r--r--crates/ra_lsp_server/src/server_world.rs2
2 files changed, 2 insertions, 23 deletions
diff --git a/crates/ra_lsp_server/src/path_map.rs b/crates/ra_lsp_server/src/path_map.rs
index 02e54629c..86cf29540 100644
--- a/crates/ra_lsp_server/src/path_map.rs
+++ b/crates/ra_lsp_server/src/path_map.rs
@@ -4,7 +4,7 @@ use std::{
4}; 4};
5 5
6use im; 6use im;
7use ra_analysis::{FileId, FileResolver}; 7use ra_analysis::{FileId};
8use relative_path::RelativePath; 8use relative_path::RelativePath;
9 9
10#[derive(Debug, Clone, Copy, PartialEq, Eq)] 10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -64,27 +64,6 @@ impl PathMap {
64 } 64 }
65} 65}
66 66
67impl FileResolver for PathMap {
68 fn file_stem(&self, file_id: FileId) -> String {
69 self.get_path(file_id)
70 .file_stem()
71 .unwrap()
72 .to_str()
73 .unwrap()
74 .to_string()
75 }
76
77 fn resolve(&self, file_id: FileId, path: &RelativePath) -> Option<FileId> {
78 let path = path.to_path(&self.get_path(file_id));
79 let path = normalize(&path);
80 self.get_id(&path)
81 }
82
83 fn debug_path(&self, file_id: FileId) -> Option<PathBuf> {
84 Some(self.get_path(file_id).to_owned())
85 }
86}
87
88fn normalize(path: &Path) -> PathBuf { 67fn normalize(path: &Path) -> PathBuf {
89 let mut components = path.components().peekable(); 68 let mut components = path.components().peekable();
90 let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { 69 let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs
index ab4c2c8aa..c0d1338a2 100644
--- a/crates/ra_lsp_server/src/server_world.rs
+++ b/crates/ra_lsp_server/src/server_world.rs
@@ -6,7 +6,7 @@ use std::{
6 6
7use languageserver_types::Url; 7use languageserver_types::Url;
8use ra_analysis::{ 8use ra_analysis::{
9 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, FileResolver, LibraryData, 9 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData,
10}; 10};
11use rustc_hash::FxHashMap; 11use rustc_hash::FxHashMap;
12use failure::{bail, format_err}; 12use failure::{bail, format_err};