MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / has_clients

Method has_clients

crates/opencode-lsp/src/lib.rs:836–843  ·  view source on GitHub ↗

Returns true if any LSP clients are currently registered. Mirrors the TS `LSP.hasClients(file)` which checks whether any server could handle the given file. Here we check if any registered client's id contains the detected language for the file.

(&self, path: &Path)

Source from the content-addressed store, hash-verified

834 /// could handle the given file. Here we check if any registered client's
835 /// id contains the detected language for the file.
836 pub async fn has_clients(&self, path: &Path) -> bool {
837 let clients = self.clients.read().await;
838 if clients.is_empty() {
839 return false;
840 }
841 let language = detect_language(path);
842 clients.keys().any(|id| id.contains(language))
843 }
844
845 /// Opens or refreshes a file in all matching LSP clients.
846 /// Mirrors the TS `LSP.touchFile(input, waitForDiagnostics)`.

Callers 1

execute_with_lspFunction · 0.80

Calls 4

detect_languageFunction · 0.85
readMethod · 0.80
is_emptyMethod · 0.80
containsMethod · 0.80

Tested by

no test coverage detected