aboutsummaryrefslogtreecommitdiff
path: root/crates/server/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-30 10:51:46 +0100
committerAleksey Kladov <[email protected]>2018-08-30 10:52:21 +0100
commit1f2fb4e27f8ba1cb7b1d96a332b7ffc2ee659921 (patch)
treebd5c0a9b83c181fb3a906c41cbeb3ea7f63ae081 /crates/server/src
parent0d6d74e78ecb6d110de751c528e662fc61113e78 (diff)
move
Diffstat (limited to 'crates/server/src')
-rw-r--r--crates/server/src/server_world.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/server/src/server_world.rs b/crates/server/src/server_world.rs
index 6c85914ba..9ba7df0b8 100644
--- a/crates/server/src/server_world.rs
+++ b/crates/server/src/server_world.rs
@@ -5,7 +5,7 @@ use std::{
5}; 5};
6 6
7use languageserver_types::Url; 7use languageserver_types::Url;
8use libanalysis::{FileId, WorldState, Analysis}; 8use libanalysis::{FileId, AnalysisHost, Analysis};
9 9
10use { 10use {
11 Result, 11 Result,
@@ -15,7 +15,7 @@ use {
15 15
16#[derive(Debug)] 16#[derive(Debug)]
17pub struct ServerWorldState { 17pub struct ServerWorldState {
18 pub analysis: WorldState, 18 pub analysis_host: AnalysisHost,
19 pub path_map: PathMap, 19 pub path_map: PathMap,
20 pub mem_map: HashMap<FileId, Option<String>>, 20 pub mem_map: HashMap<FileId, Option<String>>,
21} 21}
@@ -29,7 +29,7 @@ pub struct ServerWorld {
29impl ServerWorldState { 29impl ServerWorldState {
30 pub fn new() -> ServerWorldState { 30 pub fn new() -> ServerWorldState {
31 ServerWorldState { 31 ServerWorldState {
32 analysis: WorldState::new(), 32 analysis_host: AnalysisHost::new(),
33 path_map: PathMap::new(), 33 path_map: PathMap::new(),
34 mem_map: HashMap::new(), 34 mem_map: HashMap::new(),
35 } 35 }
@@ -58,20 +58,20 @@ impl ServerWorldState {
58 } 58 }
59 }); 59 });
60 60
61 self.analysis.change_files(changes); 61 self.analysis_host.change_files(changes);
62 } 62 }
63 63
64 pub fn add_mem_file(&mut self, path: PathBuf, text: String) { 64 pub fn add_mem_file(&mut self, path: PathBuf, text: String) {
65 let file_id = self.path_map.get_or_insert(path); 65 let file_id = self.path_map.get_or_insert(path);
66 self.mem_map.insert(file_id, None); 66 self.mem_map.insert(file_id, None);
67 self.analysis.change_file(file_id, Some(text)); 67 self.analysis_host.change_file(file_id, Some(text));
68 } 68 }
69 69
70 pub fn change_mem_file(&mut self, path: &Path, text: String) -> Result<()> { 70 pub fn change_mem_file(&mut self, path: &Path, text: String) -> Result<()> {
71 let file_id = self.path_map.get_id(path).ok_or_else(|| { 71 let file_id = self.path_map.get_id(path).ok_or_else(|| {
72 format_err!("change to unknown file: {}", path.display()) 72 format_err!("change to unknown file: {}", path.display())
73 })?; 73 })?;
74 self.analysis.change_file(file_id, Some(text)); 74 self.analysis_host.change_file(file_id, Some(text));
75 Ok(()) 75 Ok(())
76 } 76 }
77 77
@@ -85,13 +85,13 @@ impl ServerWorldState {
85 }; 85 };
86 // Do this via file watcher ideally. 86 // Do this via file watcher ideally.
87 let text = fs::read_to_string(path).ok(); 87 let text = fs::read_to_string(path).ok();
88 self.analysis.change_file(file_id, text); 88 self.analysis_host.change_file(file_id, text);
89 Ok(()) 89 Ok(())
90 } 90 }
91 91
92 pub fn snapshot(&self) -> ServerWorld { 92 pub fn snapshot(&self) -> ServerWorld {
93 ServerWorld { 93 ServerWorld {
94 analysis: self.analysis.analysis(self.path_map.clone()), 94 analysis: self.analysis_host.analysis(self.path_map.clone()),
95 path_map: self.path_map.clone() 95 path_map: self.path_map.clone()
96 } 96 }
97 } 97 }