Skip to content

Commit 22fdc4a

Browse files
committed
chore(lsp): rename remove_diagnostics to remove_uri_cache (#16614)
Renaming the method to make it more clear. There is no diagnostic anymore to be removed. Instead remove the cache of an given URI.
1 parent 5eb8b14 commit 22fdc4a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

crates/oxc_language_server/src/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ impl LanguageServer for Backend {
566566
};
567567

568568
self.file_system.write().await.remove(uri);
569-
worker.remove_diagnostics(&params.text_document.uri).await;
569+
worker.remove_uri_cache(&params.text_document.uri).await;
570570
}
571571

572572
/// It will return code actions or commands for the given range.

crates/oxc_language_server/src/linter/server_linter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl Tool for ServerLinter {
525525
self.run_diagnostic(uri, content)
526526
}
527527

528-
fn remove_diagnostics(&self, uri: &Uri) {
528+
fn remove_uri_cache(&self, uri: &Uri) {
529529
self.code_actions.pin().remove(uri);
530530
}
531531
}

crates/oxc_language_server/src/tool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ pub trait Tool: Send + Sync {
114114
None
115115
}
116116

117-
/// Remove diagnostics associated with the given URI.
118-
fn remove_diagnostics(&self, _uri: &Uri) {
117+
/// Remove internal cache for the given URI, if any.
118+
fn remove_uri_cache(&self, _uri: &Uri) {
119119
// Default implementation does nothing.
120120
}
121121

crates/oxc_language_server/src/worker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ impl WorkspaceWorker {
9494
self.options.lock().await.is_none()
9595
}
9696

97-
/// Remove all diagnostics for the given URI
98-
pub async fn remove_diagnostics(&self, uri: &Uri) {
97+
/// Remove all internal cache for the given URI, if any.
98+
pub async fn remove_uri_cache(&self, uri: &Uri) {
9999
self.tools.read().await.iter().for_each(|tool| {
100-
tool.remove_diagnostics(uri);
100+
tool.remove_uri_cache(uri);
101101
});
102102
}
103103

0 commit comments

Comments
 (0)