mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Optimize VFS processing
This commit is contained in:
parent
676d2e040d
commit
a1ef6cc553
2 changed files with 40 additions and 30 deletions
|
@ -198,7 +198,10 @@ impl GlobalState {
|
|||
}
|
||||
self.analysis_host.maybe_collect_garbage();
|
||||
}
|
||||
Event::Vfs(task) => match task {
|
||||
Event::Vfs(mut task) => {
|
||||
let _p = profile("GlobalState::handle_event/vfs");
|
||||
loop {
|
||||
match task {
|
||||
vfs::loader::Message::Loaded { files } => {
|
||||
let vfs = &mut self.vfs.write().0;
|
||||
for (path, contents) in files {
|
||||
|
@ -230,7 +233,14 @@ impl GlobalState {
|
|||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
// Coalesce many VFS event into a single loop turn
|
||||
task = match self.loader.receiver.try_recv() {
|
||||
Ok(task) => task,
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::Flycheck(task) => match task {
|
||||
flycheck::Message::AddDiagnostic { workspace_root, diagnostic } => {
|
||||
let diagnostics = crate::diagnostics::to_proto::map_rust_diagnostic_to_lsp(
|
||||
|
|
|
@ -70,7 +70,7 @@ impl ChangedFile {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
||||
pub enum ChangeKind {
|
||||
Create,
|
||||
Modify,
|
||||
|
|
Loading…
Reference in a new issue