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

Function create_lsp_client

crates/opencode-cli/src/main.rs:3367–3389  ·  view source on GitHub ↗
(file_hint: Option<&Path>)

Source from the content-addressed store, hash-verified

3365}
3366
3367async fn create_lsp_client(file_hint: Option<&Path>) -> anyhow::Result<LspClient> {
3368 let cwd = std::env::current_dir()?;
3369 let config = load_config(&cwd)?;
3370 let (id, server) = select_lsp_server(&config, file_hint)?;
3371 let command = server.command[0].clone();
3372 let args = server.command.iter().skip(1).cloned().collect::<Vec<_>>();
3373 let initialization_options = server
3374 .initialization
3375 .map(serde_json::to_value)
3376 .transpose()?;
3377
3378 LspClient::start(
3379 LspServerConfig {
3380 id,
3381 command,
3382 args,
3383 initialization_options,
3384 },
3385 cwd,
3386 )
3387 .await
3388 .map_err(|e| anyhow::anyhow!(e.to_string()))
3389}
3390
3391async fn handle_debug_command(action: DebugCommands) -> anyhow::Result<()> {
3392 match action {

Callers 1

handle_debug_commandFunction · 0.85

Calls 3

load_configFunction · 0.85
select_lsp_serverFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected