fix(lsp): add download-tier helpers, progress callback, and persist previous install check
Auto-install improvements: - Add curl-based download helpers for rust-analyzer and jdtls - Add progress callback threaded through all provision stages - Check ~/.local/share/zesdex/lsp/ for previous downloads so install only runs once, not on every startup - Increase run_command timeout to 180s for large downloads - Add cargo/pacman/brew fallback tiers for Rust - Add pacman/download tiers for Java jdtls Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b20bb95ada
commit
aac1de8af6
+14
-9
@@ -153,30 +153,35 @@ impl AppStateRest {
|
||||
std::thread::spawn(move || {
|
||||
use crate::app::lsp::provisioner::{self, ProvisionResult};
|
||||
|
||||
fn push_msg(q: &Arc<Mutex<VecDeque<String>>>, msg: String) {
|
||||
fn push_msg(q: &Arc<Mutex<VecDeque<String>>>, msg: &str) {
|
||||
if let Ok(mut q) = q.lock() {
|
||||
q.push_back(msg);
|
||||
q.push_back(msg.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
push_msg(&msg_queue, "LSP: provisioning servers...".to_string());
|
||||
let results = provisioner::provision_all();
|
||||
push_msg(&msg_queue, "LSP: connecting servers...".to_string());
|
||||
// Wrap the msg_queue in a static-lifetime closure for use as ProgressFn.
|
||||
let progress: provisioner::ProgressFn = Some(&|msg: &str| push_msg(&msg_queue, msg));
|
||||
|
||||
let report = |msg: &str| { if let Some(f) = &progress { f(msg); }};
|
||||
|
||||
report("LSP: provisioning servers...");
|
||||
let results = provisioner::provision_all_with_progress(progress);
|
||||
report("LSP: connecting servers...");
|
||||
let connected = provisioner::auto_connect(&lsp_mgr, &results);
|
||||
for name in &connected {
|
||||
tracing::info!("LSP: {} connected", name);
|
||||
push_msg(&msg_queue, format!("LSP: {} connected ✓", name));
|
||||
let m = format!("LSP: {} connected ✓", name); push_msg(&msg_queue, &m);
|
||||
}
|
||||
for r in &results {
|
||||
if let ProvisionResult::Failed { language, server_name, reason, .. } = r {
|
||||
tracing::warn!("LSP {} ({}): {}", server_name, language, reason);
|
||||
push_msg(&msg_queue, format!("LSP: {} ({}) ✗ - {}", server_name, language, reason));
|
||||
let m = format!("LSP: {} ({}) ✗ - {}", server_name, language, reason); push_msg(&msg_queue, &m);
|
||||
}
|
||||
}
|
||||
if connected.is_empty() {
|
||||
push_msg(&msg_queue, "LSP: no servers available — install manually or check prerequisites".to_string());
|
||||
let m = "LSP: no servers available — install manually or check prerequisites".to_string(); push_msg(&msg_queue, &m);
|
||||
} else {
|
||||
push_msg(&msg_queue, format!("LSP: {} server(s) connected", connected.len()));
|
||||
let m = format!("LSP: {} server(s) connected", connected.len()); push_msg(&msg_queue, &m);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user