Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/oxc_language_server/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ impl LanguageServer for Backend {
};

self.file_system.write().await.remove(uri);
worker.remove_diagnostics(&params.text_document.uri).await;
worker.remove_uri_cache(&params.text_document.uri).await;
}

/// It will return code actions or commands for the given range.
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_language_server/src/linter/server_linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl Tool for ServerLinter {
self.run_diagnostic(uri, content)
}

fn remove_diagnostics(&self, uri: &Uri) {
fn remove_uri_cache(&self, uri: &Uri) {
self.code_actions.pin().remove(uri);
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_language_server/src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ pub trait Tool: Send + Sync {
None
}

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

Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_language_server/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ impl WorkspaceWorker {
self.options.lock().await.is_none()
}

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

Expand Down
Loading