aboutsummaryrefslogtreecommitdiff
path: root/crates/server
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-28 17:42:55 +0100
committerAleksey Kladov <[email protected]>2018-08-28 17:42:55 +0100
commitb6c654e233170837a105925d03e1e9752f70d3fc (patch)
treeca7b213c8b92558fdb621e73a8425751aacbd049 /crates/server
parentdea6ed73fac6f3f4daf38b1cb6df4c8fb68872b7 (diff)
reread files from disk
Diffstat (limited to 'crates/server')
-rw-r--r--crates/server/src/server_world.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/server/src/server_world.rs b/crates/server/src/server_world.rs
index 1593cd59f..1982e727f 100644
--- a/crates/server/src/server_world.rs
+++ b/crates/server/src/server_world.rs
@@ -1,4 +1,5 @@
1use std::{ 1use std::{
2 fs,
2 path::{PathBuf, Path}, 3 path::{PathBuf, Path},
3 collections::HashMap, 4 collections::HashMap,
4}; 5};
@@ -78,10 +79,12 @@ impl ServerWorldState {
78 let file_id = self.path_map.get_id(path).ok_or_else(|| { 79 let file_id = self.path_map.get_id(path).ok_or_else(|| {
79 format_err!("change to unknown file: {}", path.display()) 80 format_err!("change to unknown file: {}", path.display())
80 })?; 81 })?;
81 let text = match self.mem_map.remove(&file_id) { 82 match self.mem_map.remove(&file_id) {
82 Some(text) => text, 83 Some(_) => (),
83 None => bail!("unmatched close notification"), 84 None => bail!("unmatched close notification"),
84 }; 85 };
86 // Do this via file watcher ideally.
87 let text = fs::read_to_string(path).ok();
85 self.analysis.change_file(file_id, text); 88 self.analysis.change_file(file_id, text);
86 Ok(()) 89 Ok(())
87 } 90 }