Skip to content

Commit

Permalink
Bail out early to prevent analysis on empty set
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed May 2, 2024
1 parent fc1b121 commit 028bcb1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/language_server/lib.rs
Expand Up @@ -145,14 +145,23 @@ impl LanguageServer for Backend {
}
}

{
if !new_file_statuses.is_empty() {
let mut existing_file_changes = self.file_changes.write().await;

if let Some(existing_file_changes) = existing_file_changes.as_mut() {
existing_file_changes.extend(new_file_statuses);
} else {
*existing_file_changes = Some(new_file_statuses);
}
} else {
let file_changes_guard = self.file_changes.read().await;

if file_changes_guard.is_none() {
self.client
.log_message(MessageType::INFO, "No files updated")
.await;
return;
}
}

if Path::new(".git/index.lock").exists() {
Expand Down

0 comments on commit 028bcb1

Please sign in to comment.