From b6c654e233170837a105925d03e1e9752f70d3fc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 19:42:55 +0300 Subject: reread files from disk --- crates/server/src/server_world.rs | 7 +++++-- 1 file 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 @@ use std::{ + fs, path::{PathBuf, Path}, collections::HashMap, }; @@ -78,10 +79,12 @@ impl ServerWorldState { let file_id = self.path_map.get_id(path).ok_or_else(|| { format_err!("change to unknown file: {}", path.display()) })?; - let text = match self.mem_map.remove(&file_id) { - Some(text) => text, + match self.mem_map.remove(&file_id) { + Some(_) => (), None => bail!("unmatched close notification"), }; + // Do this via file watcher ideally. + let text = fs::read_to_string(path).ok(); self.analysis.change_file(file_id, text); Ok(()) } -- cgit v1.2.3