The log-ification

This commit is contained in:
Julia 2023-06-21 14:02:21 -04:00
parent f91e95f24a
commit e15be61ded
2 changed files with 14 additions and 12 deletions

View file

@ -869,7 +869,7 @@ impl LanguageRegistry {
cx: &mut AppContext, cx: &mut AppContext,
) -> Option<PendingLanguageServer> { ) -> Option<PendingLanguageServer> {
let server_id = self.state.write().next_language_server_id(); let server_id = self.state.write().next_language_server_id();
println!( log::info!(
"starting language server {:?}, path: {root_path:?}, id: {server_id}", "starting language server {:?}, path: {root_path:?}, id: {server_id}",
adapter.name.0 adapter.name.0
); );
@ -954,7 +954,6 @@ impl LanguageRegistry {
task.await?; task.await?;
} }
println!("starting server");
let server = lsp::LanguageServer::new( let server = lsp::LanguageServer::new(
server_id, server_id,
binaries, binaries,
@ -985,7 +984,8 @@ impl LanguageRegistry {
adapter: Arc<CachedLspAdapter>, adapter: Arc<CachedLspAdapter>,
cx: &mut AppContext, cx: &mut AppContext,
) -> Task<()> { ) -> Task<()> {
println!("deleting server container"); log::info!("deleting server container");
let mut lock = self.lsp_binary_paths.lock(); let mut lock = self.lsp_binary_paths.lock();
lock.remove(&adapter.name); lock.remove(&adapter.name);
@ -1066,7 +1066,6 @@ async fn get_binaries(
task.await?; task.await?;
} }
println!("fetching binary");
let binary = fetch_latest_binary( let binary = fetch_latest_binary(
adapter.clone(), adapter.clone(),
language.clone(), language.clone(),

View file

@ -2480,7 +2480,7 @@ impl Project {
Ok(server) => Some(server), Ok(server) => Some(server),
Err(err) => { Err(err) => {
println!("failed to start language server {:?}: {}", server_name, err); log::error!("failed to start language server {:?}: {}", server_name, err);
if let Some(this) = this.upgrade(&cx) { if let Some(this) = this.upgrade(&cx) {
if let Some(container_dir) = container_dir { if let Some(container_dir) = container_dir {
@ -2518,7 +2518,7 @@ impl Project {
server_id: LanguageServerId, server_id: LanguageServerId,
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) -> Option<Task<()>> { ) -> Option<Task<()>> {
println!("starting to reinstall server"); log::info!("beginning to reinstall server");
let (language, adapter, server) = match self.language_servers.remove(&server_id) { let (language, adapter, server) = match self.language_servers.remove(&server_id) {
Some(LanguageServerState::Running { Some(LanguageServerState::Running {
language, language,
@ -2543,7 +2543,7 @@ impl Project {
Some(cx.spawn(move |this, mut cx| async move { Some(cx.spawn(move |this, mut cx| async move {
if let Some(task) = server.and_then(|server| server.shutdown()) { if let Some(task) = server.and_then(|server| server.shutdown()) {
println!("shutting down existing server"); log::info!("shutting down existing server");
task.await; task.await;
} }
@ -2565,7 +2565,6 @@ impl Project {
let worktree_id = worktree.id(); let worktree_id = worktree.id();
let root_path = worktree.abs_path(); let root_path = worktree.abs_path();
println!("prompting server start: {:?}", &adapter.name.0);
this.start_language_server( this.start_language_server(
worktree_id, worktree_id,
root_path, root_path,
@ -3082,7 +3081,8 @@ impl Project {
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) { ) {
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
println!("About to spawn test binary"); log::info!("About to spawn test binary");
// A lack of test binary counts as a failure // A lack of test binary counts as a failure
let process = installation_test_binary.and_then(|binary| { let process = installation_test_binary.and_then(|binary| {
smol::process::Command::new(&binary.path) smol::process::Command::new(&binary.path)
@ -3103,18 +3103,21 @@ impl Project {
if let Some(mut process) = process { if let Some(mut process) = process {
futures::select! { futures::select! {
status = process.status().fuse() => match status { status = process.status().fuse() => match status {
Ok(status) => errored = !dbg!(status.success()), Ok(status) => errored = !status.success(),
Err(_) => errored = true, Err(_) => errored = true,
}, },
_ = timeout => { println!("test binary time-ed out"); } _ = timeout => {
log::info!("test binary time-ed out, this counts as a success");
}
} }
} else { } else {
println!("test binary failed to launch"); log::warn!("test binary failed to launch");
errored = true; errored = true;
} }
if errored { if errored {
log::warn!("test binary check failed");
let task = this.update(&mut cx, move |this, mut cx| { let task = this.update(&mut cx, move |this, mut cx| {
this.reinstall_language_server(server_id, &mut cx) this.reinstall_language_server(server_id, &mut cx)
}); });