Repository navigation
Description
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 anAlarmbut doesn't keep the time. The wrapper would record when the stop is due, and clear it inremoveStopTimer()when a file connects again, and tell the tree in both cases. - The display.
LanguageServerTreeRendereralready draws the elapsed time in grey on the right forstarting,stopping,checking_installedandinstalling. 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:
- The tree (LSP Consoles: show state and connection in the tree #1952): short, and visible while the node is collapsed, e.g.
idle, stops after 10 h at 20:15in grey after the state. - The info panel (LSP Consoles and settings: setup in the settings, runtime in the consoles #1953): LSP Consoles and settings: setup in the settings, runtime in the consoles #1953 suggests a read-only panel for the selected connection instead of today's editable fields: command, transport, host and port, trace level and
serverInfo. The pending stop fits there with all its details, e.g. "Stops at 20:15 (in 9:59:12), 10 hours after its last file closed (lastDocumentDisconnectedTimeout)", and only for the server you look at.
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, oridlewithout a time? lastDocumentDisconnectedTimeoutof 0 stops at once, so there is nothing to show.
Related
- LSP Consoles: show state and connection in the tree #1952: state and connection in the tree; feat: improve language server console tree information #2000 is reworking the tree now. This issue adds the pending stop to it.
- LSP Consoles and settings: setup in the settings, runtime in the consoles #1953: setup on the settings page, runtime in the LSP Consoles, with a read-only info panel. This issue adds the pending stop to that panel.
- fix: show a language server as started during its last-document grace period #1850: shows "started" until the stop actually runs.
To decide
- which of Option A to Option E the tree shows;
- whether the details go in the info panel from LSP Consoles and settings: setup in the settings, runtime in the consoles #1953.
How this was checked
Claude Code read LanguageServerWrapper and LanguageServerTreeRenderer at 21a3f42; nothing of this is built or tried.
Activity