feat(lsp): add LSP provision progress messages to toast notifications
This commit is contained in:
@@ -331,6 +331,24 @@ pub fn apply_action(state: &mut AppStateRest, action: Action) {
|
||||
let _ = crate::app::review::process_pending_lessons(&rt.session_dir, &state.memory_dir);
|
||||
}
|
||||
|
||||
// Drain LSP provision progress messages into toast notifications.
|
||||
// Collect messages under the lock, then push toasts outside it to avoid
|
||||
// a borrow-conflict with state.push_toast (which also accesses state).
|
||||
let pending: Vec<String> = state.lsp_provision_msgs.lock()
|
||||
.ok()
|
||||
.map(|mut q| q.drain(..).collect())
|
||||
.unwrap_or_default();
|
||||
for msg in &pending {
|
||||
let kind = if msg.contains("not available") || msg.contains("failed") {
|
||||
ToastKind::Warning
|
||||
} else if msg.contains("connected") || msg.contains("✓") {
|
||||
ToastKind::Success
|
||||
} else {
|
||||
ToastKind::Info
|
||||
};
|
||||
state.push_toast(Toast::new(kind, msg.clone()));
|
||||
}
|
||||
|
||||
let events: Vec<TurnEvent> = {
|
||||
if let Ok(mut q) = state.turn_events.lock() {
|
||||
q.drain(..).collect()
|
||||
|
||||
Reference in New Issue
Block a user