-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track proc macro server status in analysis progress #270
base: main
Are you sure you want to change the base?
Conversation
use std::sync::atomic::{AtomicBool, Ordering}; | ||
use std::sync::{Arc, Mutex}; | ||
|
||
use crate::config::Config; | ||
use crate::lsp::ext::{ServerStatus, ServerStatusEvent, ServerStatusParams}; | ||
use crate::server::client::Notifier; | ||
|
||
#[derive(Clone, PartialEq)] | ||
pub enum ProcMacroServerStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crashed
is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really care if it's crashed tbh - i do care about the startup status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it anyway, for consistency sake
src/lang/proc_macros/controller.rs
Outdated
@@ -148,6 +148,7 @@ impl ProcMacroClientController { | |||
} | |||
|
|||
db.set_proc_macro_client_status(ClientStatus::Ready(client)); | |||
self.proc_macro_server_tracker.set_server_status(ProcMacroServerStatus::Ready) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make func to set db.set_proc_macro_client_status
and proc_macro_server_tracker.set_server_status
, this will be easy to forget when changing this code.
Also, you can create ProcMacroServerStatus
from &ClientStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about this?
db.set_proc_macro_client_status(ClientStatus::Ready(client));
self.proc_macro_server_tracker.pull_status_from_db(&db);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you still have to remember to call both
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's true. I can't think of another way to set up a "watcher" behaviour on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
proc_macro_server_tracker: ProcMacroServerTracker, | ||
} | ||
|
||
impl From<&ClientStatus> for ProcMacroServerStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we rename ClientStatus
to ServerStatus
at this point? cc @Draggu
@@ -96,6 +107,12 @@ impl ProcMacroClientController { | |||
} | |||
} | |||
|
|||
fn set_procmacro_client_status(&self, db: &mut AnalysisDatabase, client_status: ClientStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn set_procmacro_client_status(&self, db: &mut AnalysisDatabase, client_status: ClientStatus) { | |
fn set_proc_macro_client_status(&self, db: &mut AnalysisDatabase, client_status: ClientStatus) { |
[nit]
Stack:
⬆️ #271