Add language server control tool into the status bar (#32490)
Release Notes: - Added the language server control tool into the status bar --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
parent
91c9281cea
commit
c0acd8e8b1
32 changed files with 1992 additions and 312 deletions
|
@ -157,6 +157,9 @@ pub enum BinaryStatus {
|
|||
None,
|
||||
CheckingForUpdate,
|
||||
Downloading,
|
||||
Starting,
|
||||
Stopping,
|
||||
Stopped,
|
||||
Failed { error: String },
|
||||
}
|
||||
|
||||
|
@ -248,7 +251,7 @@ pub struct LanguageQueries {
|
|||
|
||||
#[derive(Clone, Default)]
|
||||
struct ServerStatusSender {
|
||||
txs: Arc<Mutex<Vec<mpsc::UnboundedSender<(LanguageServerName, LanguageServerStatusUpdate)>>>>,
|
||||
txs: Arc<Mutex<Vec<mpsc::UnboundedSender<(LanguageServerName, BinaryStatus)>>>>,
|
||||
}
|
||||
|
||||
pub struct LoadedLanguage {
|
||||
|
@ -1085,11 +1088,7 @@ impl LanguageRegistry {
|
|||
self.state.read().all_lsp_adapters.get(name).cloned()
|
||||
}
|
||||
|
||||
pub fn update_lsp_status(
|
||||
&self,
|
||||
server_name: LanguageServerName,
|
||||
status: LanguageServerStatusUpdate,
|
||||
) {
|
||||
pub fn update_lsp_binary_status(&self, server_name: LanguageServerName, status: BinaryStatus) {
|
||||
self.lsp_binary_status_tx.send(server_name, status);
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1144,7 @@ impl LanguageRegistry {
|
|||
|
||||
pub fn language_server_binary_statuses(
|
||||
&self,
|
||||
) -> mpsc::UnboundedReceiver<(LanguageServerName, LanguageServerStatusUpdate)> {
|
||||
) -> mpsc::UnboundedReceiver<(LanguageServerName, BinaryStatus)> {
|
||||
self.lsp_binary_status_tx.subscribe()
|
||||
}
|
||||
|
||||
|
@ -1260,15 +1259,13 @@ impl LanguageRegistryState {
|
|||
}
|
||||
|
||||
impl ServerStatusSender {
|
||||
fn subscribe(
|
||||
&self,
|
||||
) -> mpsc::UnboundedReceiver<(LanguageServerName, LanguageServerStatusUpdate)> {
|
||||
fn subscribe(&self) -> mpsc::UnboundedReceiver<(LanguageServerName, BinaryStatus)> {
|
||||
let (tx, rx) = mpsc::unbounded();
|
||||
self.txs.lock().push(tx);
|
||||
rx
|
||||
}
|
||||
|
||||
fn send(&self, name: LanguageServerName, status: LanguageServerStatusUpdate) {
|
||||
fn send(&self, name: LanguageServerName, status: BinaryStatus) {
|
||||
let mut txs = self.txs.lock();
|
||||
txs.retain(|tx| tx.unbounded_send((name.clone(), status.clone())).is_ok());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue