mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
reread files from disk
This commit is contained in:
parent
dea6ed73fa
commit
b6c654e233
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
|
fs,
|
||||||
path::{PathBuf, Path},
|
path::{PathBuf, Path},
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
};
|
};
|
||||||
|
@ -78,10 +79,12 @@ impl ServerWorldState {
|
||||||
let file_id = self.path_map.get_id(path).ok_or_else(|| {
|
let file_id = self.path_map.get_id(path).ok_or_else(|| {
|
||||||
format_err!("change to unknown file: {}", path.display())
|
format_err!("change to unknown file: {}", path.display())
|
||||||
})?;
|
})?;
|
||||||
let text = match self.mem_map.remove(&file_id) {
|
match self.mem_map.remove(&file_id) {
|
||||||
Some(text) => text,
|
Some(_) => (),
|
||||||
None => bail!("unmatched close notification"),
|
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);
|
self.analysis.change_file(file_id, text);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue