Show Copilot logs right after its LSP server start

This commit is contained in:
Kirill Bulatov 2023-09-20 12:08:32 +03:00
parent 82010b68c1
commit 6ebe49ec59
2 changed files with 3 additions and 3 deletions

View file

@ -277,7 +277,7 @@ pub struct Copilot {
} }
pub enum Event { pub enum Event {
CopilotReady, CopilotLanguageServerStarted,
} }
impl Entity for Copilot { impl Entity for Copilot {
@ -431,6 +431,7 @@ impl Copilot {
sign_in_status: SignInStatus::SignedOut, sign_in_status: SignInStatus::SignedOut,
registered_buffers: Default::default(), registered_buffers: Default::default(),
}); });
cx.emit(Event::CopilotLanguageServerStarted);
this.update_sign_in_status(status, cx); this.update_sign_in_status(status, cx);
} }
Err(error) => { Err(error) => {
@ -873,7 +874,6 @@ impl Copilot {
self.register_buffer(&buffer, cx); self.register_buffer(&buffer, cx);
} }
} }
cx.emit(Event::CopilotReady);
} }
request::SignInStatus::NotAuthorized { .. } => { request::SignInStatus::NotAuthorized { .. } => {
server.sign_in_status = SignInStatus::Unauthorized; server.sign_in_status = SignInStatus::Unauthorized;

View file

@ -8038,7 +8038,7 @@ fn subscribe_for_copilot_events(
cx.subscribe( cx.subscribe(
copilot, copilot,
|project, copilot, copilot_event, cx| match copilot_event { |project, copilot, copilot_event, cx| match copilot_event {
copilot::Event::CopilotReady => { copilot::Event::CopilotLanguageServerStarted => {
if let Some((name, copilot_server)) = copilot.read(cx).language_server() { if let Some((name, copilot_server)) = copilot.read(cx).language_server() {
let new_server_id = copilot_server.server_id(); let new_server_id = copilot_server.server_id();
if let hash_map::Entry::Vacant(v) = if let hash_map::Entry::Vacant(v) =