aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-09-18 22:29:47 +0100
committerGitHub <[email protected]>2020-09-18 22:29:47 +0100
commitfb1b0a4bff2ae1bc78ea10120a5a0de7039c63d2 (patch)
tree28bac91b1e0789db85774270f85974dad6011981
parente49a0677adc6afe090b8fac04ae8e2b8f9f2e631 (diff)
parent5a0bad77543f9bf6df84e6c96b903683f8d23a5e (diff)
Merge #6036
6036: Don't re-read open files from disk when reloading a workspace r=kjeremy a=lnicola Fixes #5742 Fixes #4263 or so I hope. Co-authored-by: LaurenČ›iu Nicola <[email protected]>
-rw-r--r--crates/rust-analyzer/src/reload.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index b819618cb..ae404331d 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -201,11 +201,14 @@ impl GlobalState {
201 let mut crate_graph = CrateGraph::default(); 201 let mut crate_graph = CrateGraph::default();
202 let vfs = &mut self.vfs.write().0; 202 let vfs = &mut self.vfs.write().0;
203 let loader = &mut self.loader; 203 let loader = &mut self.loader;
204 let mem_docs = &self.mem_docs;
204 let mut load = |path: &AbsPath| { 205 let mut load = |path: &AbsPath| {
205 let contents = loader.handle.load_sync(path); 206 let vfs_path = vfs::VfsPath::from(path.to_path_buf());
206 let path = vfs::VfsPath::from(path.to_path_buf()); 207 if !mem_docs.contains_key(&vfs_path) {
207 vfs.set_file_contents(path.clone(), contents); 208 let contents = loader.handle.load_sync(path);
208 vfs.file_id(&path) 209 vfs.set_file_contents(vfs_path.clone(), contents);
210 }
211 vfs.file_id(&vfs_path)
209 }; 212 };
210 for ws in workspaces.iter() { 213 for ws in workspaces.iter() {
211 crate_graph.extend(ws.to_crate_graph( 214 crate_graph.extend(ws.to_crate_graph(