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

Method request

crates/opencode-lsp/src/lib.rs:279–300  ·  view source on GitHub ↗
(&self, method: &str, params: Value)

Source from the content-addressed store, hash-verified

277 }
278
279 pub async fn request(&self, method: &str, params: Value) -> Result<Value, LspError> {
280 let id = self.next_id().await;
281 let (tx, rx) = tokio::sync::oneshot::channel();
282
283 self.pending_responses.write().await.insert(id, tx);
284
285 let request = JsonRpcRequest {
286 jsonrpc: "2.0".to_string(),
287 id,
288 method: method.to_string(),
289 params,
290 };
291
292 let content = serde_json::to_string(&request)?;
293 let message = format!("Content-Length: {}\r\n\r\n{}", content.len(), content);
294
295 let mut stdin = self.stdin.lock().await;
296 stdin.write_all(message.as_bytes()).await?;
297 stdin.flush().await?;
298
299 rx.await.map_err(|_| LspError::Timeout)?
300 }
301
302 pub async fn notify(&self, method: &str, params: Value) -> Result<(), LspError> {
303 let notification = JsonRpcNotification {

Callers 13

initializeMethod · 0.80
goto_definitionMethod · 0.80
completionMethod · 0.80
referencesMethod · 0.80
hoverMethod · 0.80
document_symbolMethod · 0.80
workspace_symbolMethod · 0.80
goto_implementationMethod · 0.80
type_definitionMethod · 0.80
renameMethod · 0.80
incoming_callsMethod · 0.80

Calls 1

next_idMethod · 0.45

Tested by

no test coverage detected