Skip to content

Commit

Permalink
Handle multiple languages servers in spinner
Browse files Browse the repository at this point in the history
For a long time there was a TODO for handling more
than just the first connected language server on a
given buffer. Now we pick the first busy server to
display the spinner for, so we can indicate if any
attached server is busy.
  • Loading branch information
hamrik committed Mar 2, 2024
1 parent 902ac90 commit 7e39537
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions helix-term/src/ui/statusline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,18 @@ fn render_mode<'a>(context: &RenderContext) -> Spans<'a> {
}
}

// TODO think about handling multiple language servers
fn render_lsp_spinner<'a>(context: &RenderContext) -> Spans<'a> {
let frame = context
.doc
.language_servers()
.next()
.and_then(|srv| context.spinners.get(srv.id()))
.and_then(|spinner| spinner.frame());
if let Some(frame) = frame {
.map(|srv| {
context
.spinners
.get(srv.id())
.and_then(|spinner| spinner.frame())
})
.find(|frame| frame.is_some());
if let Some(Some(frame)) = frame {
Span::raw(format!(" {} ", frame)).into()
} else {
Spans::default()
Expand Down

0 comments on commit 7e39537

Please sign in to comment.