Capture language server stderr during startup/init and log if failure
zed2 electric boogaloo
This commit is contained in:
parent
06c22206af
commit
8a0fb668f7
8 changed files with 54 additions and 27 deletions
|
@ -667,7 +667,7 @@ struct LanguageRegistryState {
|
|||
|
||||
pub struct PendingLanguageServer {
|
||||
pub server_id: LanguageServerId,
|
||||
pub task: Task<Result<Option<lsp2::LanguageServer>>>,
|
||||
pub task: Task<Result<lsp2::LanguageServer>>,
|
||||
pub container_dir: Option<Arc<Path>>,
|
||||
}
|
||||
|
||||
|
@ -906,6 +906,7 @@ impl LanguageRegistry {
|
|||
|
||||
pub fn create_pending_language_server(
|
||||
self: &Arc<Self>,
|
||||
stderr_capture: Arc<Mutex<Option<String>>>,
|
||||
language: Arc<Language>,
|
||||
adapter: Arc<CachedLspAdapter>,
|
||||
root_path: Arc<Path>,
|
||||
|
@ -945,7 +946,7 @@ impl LanguageRegistry {
|
|||
})
|
||||
.detach();
|
||||
|
||||
Ok(Some(server))
|
||||
Ok(server)
|
||||
});
|
||||
|
||||
return Some(PendingLanguageServer {
|
||||
|
@ -996,24 +997,23 @@ impl LanguageRegistry {
|
|||
})
|
||||
.clone();
|
||||
|
||||
let binary = match entry.await.log_err() {
|
||||
Some(binary) => binary,
|
||||
None => return Ok(None),
|
||||
let binary = match entry.await {
|
||||
Ok(binary) => binary,
|
||||
Err(err) => anyhow::bail!("{err}"),
|
||||
};
|
||||
|
||||
if let Some(task) = adapter.will_start_server(&delegate, &mut cx) {
|
||||
if task.await.log_err().is_none() {
|
||||
return Ok(None);
|
||||
}
|
||||
task.await?;
|
||||
}
|
||||
|
||||
Ok(Some(lsp2::LanguageServer::new(
|
||||
lsp2::LanguageServer::new(
|
||||
stderr_capture,
|
||||
server_id,
|
||||
binary,
|
||||
&root_path,
|
||||
adapter.code_action_kinds(),
|
||||
cx,
|
||||
)?))
|
||||
)
|
||||
})
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue