mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Index deps
This commit is contained in:
parent
b04c14d4ad
commit
47cbaeba6f
7 changed files with 128 additions and 84 deletions
|
@ -47,7 +47,6 @@ impl ServerWorldState {
|
|||
.map(|event| {
|
||||
let text = match event.kind {
|
||||
FileEventKind::Add(text) => Some(text),
|
||||
FileEventKind::Remove => None,
|
||||
};
|
||||
(event.path, text)
|
||||
})
|
||||
|
@ -65,6 +64,18 @@ impl ServerWorldState {
|
|||
|
||||
self.analysis_host.change_files(changes);
|
||||
}
|
||||
pub fn add_library(&mut self, events: Vec<FileEvent>) {
|
||||
let pm = &mut self.path_map;
|
||||
let files = events.into_iter()
|
||||
.map(|event| {
|
||||
let text = match event.kind {
|
||||
FileEventKind::Add(text) => text,
|
||||
};
|
||||
(event.path, text)
|
||||
})
|
||||
.map(|(path, text)| (pm.get_or_insert(path), text));
|
||||
self.analysis_host.add_library(files);
|
||||
}
|
||||
|
||||
pub fn add_mem_file(&mut self, path: PathBuf, text: String) -> FileId {
|
||||
let file_id = self.path_map.get_or_insert(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue