feat: redesign status chrome and floating prompts

This commit is contained in:
Valdemar Lorenzen
2026-10-12 12:21:31 +02:00
parent 8c6a050171
commit 52915ffacf
12 changed files with 1333 additions and 373 deletions
+31
View File
@@ -60,6 +60,7 @@ struct Contribution {
}
enum Output {
Ready(String),
Update(PluginUpdate),
Diagnostics {
snapshot: Arc<DocumentSnapshot>,
@@ -77,6 +78,7 @@ struct Worker {
failure: Receiver<String>,
cancelled: Arc<AtomicBool>,
retired: bool,
name: Option<String>,
thread: Option<thread::JoinHandle<()>>,
}
@@ -145,6 +147,20 @@ impl Lsp {
!self.configs.is_empty()
}
/// Ready servers assigned to this document, in configured stack order.
pub fn active_server_names(&self, buffer_id: usize) -> impl Iterator<Item = &str> {
self.documents
.get(&buffer_id)
.into_iter()
.flat_map(|doc| &doc.servers)
.filter_map(|key| {
self.servers
.get(key)
.filter(|worker| !worker.retired)
.and_then(|worker| worker.name.as_deref())
})
}
pub fn notify_document(&mut self, event: &DocumentEvent) -> Result<(), String> {
if !self.is_enabled() {
return Ok(());
@@ -334,6 +350,7 @@ impl Lsp {
break;
};
match output {
Output::Ready(name) => worker.name = Some(name),
Output::Update(update) => self.updates.push(update),
Output::Diagnostics { snapshot, items } => {
let Some(doc) = self.documents.get_mut(&snapshot.id).filter(|doc| {
@@ -485,6 +502,7 @@ impl Lsp {
failure,
cancelled,
retired: false,
name: None,
thread,
},
);
@@ -552,6 +570,7 @@ impl Lsp {
return;
}
worker.retired = true;
worker.name = None;
worker.cancelled.store(true, Ordering::Release);
for (id, doc) in documents {
if doc.servers.first() == Some(key) {
@@ -1232,6 +1251,18 @@ impl Runtime {
Some(json!({"settings": self.config.settings})),
)?;
self.ready = true;
let name = result["serverInfo"]["name"]
.as_str()
.filter(|name| !name.chars().any(char::is_control))
.map(str::trim)
.filter(|name| !name.is_empty())
.unwrap_or_else(|| {
Path::new(&self.config.command[0])
.file_name()
.and_then(|name| name.to_str())
.unwrap_or(&self.config.command[0])
});
self.send(Output::Ready(clean(name)))?;
let documents = std::mem::take(&mut self.documents);
for (id, mut doc) in documents {
self.open(&mut doc)?;