Skip to content

LSP Consoles: show when a language server without files will stop #2025

Open

Description

@muescha

A follow-up of the discussion in #1809 (comment), for both #1952 (state and connection in the tree) and #1953 (a read-only info panel in the LSP Consoles). It's a separate issue so that the details aren't repeated in both, and so that #1952 and its PR #2000 don't wait for it.

Summary

When the last file of a language server closes, LSP4IJ keeps the server running for lastDocumentDisconnectedTimeout seconds and then stops it. Since #1850, the LSP Consoles show "started" during that time, which is right: the server still runs and answers requests. But nothing shows that a stop is pending, or when it will happen.

In #1809, this made a tester think that the Liberty Tools servers never stop: they use lastDocumentDisconnectedTimeout="36000", so they stay "started" for 10 hours after the last file closes. A hint such as idle, stops after 10 h at 20:15 would have answered that by itself.

Not a new ServerStatus

The server is still running while the stop is pending, many places check == ServerStatus.started, and ServerStatus is public API. So this should only change how the tree draws a started server, not its status.

What it needs

  • The time of the stop (for Option A, Option B, Option C and Option E below; Option D only needs to know that a stop is pending). LanguageServerWrapper.startStopTimer() queues the stop on an Alarm but doesn't keep the time. The wrapper would record when the stop is due, and clear it in removeStopTimer() when a file connects again, and tell the tree in both cases.
  • The display. LanguageServerTreeRenderer already draws the elapsed time in grey on the right for starting, stopping, checking_installed and installing. The pending stop could go in the same place.
  • A repaint, depending on the display. The tree repaints a server's node only when something about the server changes. A text that changes by itself, such as a countdown, needs a timer that repaints the node while the stop is pending.

Where to show it

There are two places, one from each issue:

With both, the tree could stay short and calm, and the panel could carry the details, including a countdown if wanted, since it only shows one server.

Open question: how much should the tree show?

The stop is only pending after the last file of a server closes, not while the server waits between requests. With the default of 5 seconds, it's barely visible. With a long timeout like Liberty's 10 hours, a countdown would tick in the tree for hours, which might be more noise than help. Options:

Example Needs a repaint timer Noise
Option A: the time of the stop idle, stops at 20:15 no none: the text doesn't change
Option B: idle, a countdown only near the end idle, then stops in 0:42 in the last minute yes, only near the end low
Option C: a countdown all the time idle, stops in 9:59:12 yes, for the whole timeout high with long timeouts
Option D: only the timeout idle, stops after 10 h or idle, stops after 5 s no none: the text doesn't change
Option E: the timeout and the time of the stop idle, stops after 10 h at 20:15 no none: the text doesn't change

Option D is the smallest change: the timeout is already in the server definition, so the wrapper wouldn't need to record when the stop is due, only whether one is pending. But it doesn't say when the stop happens, since it doesn't show when the last file closed.

Option E is Option A and Option D together: it says when the stop happens and why it's that late, which is what the Liberty case needed. It's the longest text in the tree, though.

Option E looks like the best start to me: it needs no timer, and it answers "will it stop, when, and why that late?". Until the info panel from #1953 exists, a tooltip on the node could say where the timeout comes from, e.g. "Stops 10 hours after its last file closed (lastDocumentDisconnectedTimeout)".

Some cases to decide:

  • a server that something keeps alive (LSPClientFeatures#keepServerAlive()): the check runs again when the timer fires, so the time shown can be wrong; show nothing, or idle without a time?
  • lastDocumentDisconnectedTimeout of 0 stops at once, so there is nothing to show.

Related

To decide

How this was checked

Claude Code read LanguageServerWrapper and LanguageServerTreeRenderer at 21a3f42; nothing of this is built or tried.

Activity

  1. added this to the 0.30.3 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementlsp-console

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions