mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 05:08:52 +00:00
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 <lnicola@dend.ro>
This commit is contained in:
commit
fb1b0a4bff
1 changed files with 7 additions and 4 deletions
|
@ -201,11 +201,14 @@ impl GlobalState {
|
||||||
let mut crate_graph = CrateGraph::default();
|
let mut crate_graph = CrateGraph::default();
|
||||||
let vfs = &mut self.vfs.write().0;
|
let vfs = &mut self.vfs.write().0;
|
||||||
let loader = &mut self.loader;
|
let loader = &mut self.loader;
|
||||||
|
let mem_docs = &self.mem_docs;
|
||||||
let mut load = |path: &AbsPath| {
|
let mut load = |path: &AbsPath| {
|
||||||
let contents = loader.handle.load_sync(path);
|
let vfs_path = vfs::VfsPath::from(path.to_path_buf());
|
||||||
let path = vfs::VfsPath::from(path.to_path_buf());
|
if !mem_docs.contains_key(&vfs_path) {
|
||||||
vfs.set_file_contents(path.clone(), contents);
|
let contents = loader.handle.load_sync(path);
|
||||||
vfs.file_id(&path)
|
vfs.set_file_contents(vfs_path.clone(), contents);
|
||||||
|
}
|
||||||
|
vfs.file_id(&vfs_path)
|
||||||
};
|
};
|
||||||
for ws in workspaces.iter() {
|
for ws in workspaces.iter() {
|
||||||
crate_graph.extend(ws.to_crate_graph(
|
crate_graph.extend(ws.to_crate_graph(
|
||||||
|
|
Loading…
Reference in a new issue