Repository navigation
Description
A follow-up of #1954, found while going through all templates; collected in #1943.
Summary
20 of the 36 installers (17 language servers, 3 debug adapters) check whether their server is installed by starting it: "command": "${server.command}", with "timeout": 2000. ExecTask.run counts that as success when the process exits with 0 and wrote nothing to stderr, and also when it's still running at the timeout:
if (result.isTimeout()) {
return true;
}
return result.getExitCode() == 0 && (ignoreStderr || result.getStderr().isEmpty());That's meant for a server that starts and then waits for messages. But anything that doesn't exit within 2 s passes too, and Install if Needed only installs when the check fails (ServerInstallerBase). So a command that hangs hides a missing or broken server:
Ruby LSP starts(done in fix: start the commands of the templates without sh -c or sh -s #1976)sh -s ruby-lsp(see Templates:sh -cdrops arguments, andsh -sbreaks Ruby #1954):shwaits for commands on stdin, the check passes after 2 s, nothing gets installed, and the server doesn't start either.- A command that waits for input, e.g. a prompt to accept a licence or to pick a version.
- A server that crashes after more than 2 s, e.g. after loading its dependencies on a slow machine, or after it found out that the runtime is too old.
- A server that hangs while starting.
A server that exits right away, e.g. because its arguments are wrong, is caught, which is how a broken sh -c command gets fixed by its installer today. (The Check / Run Installation link on the Installer tab runs both steps anyway, so it isn't affected.)
The installers checking with ${server.command} and a 2 s timeout: astro-ls, candor-lsp, dart-lsp, eo-lsp-server, gopls, jq-lsp, metals, ruby-lsp, sdl-lsp, sourcekit-lsp, stylelint-lsp, svelte-language-server, sysml-lsp, typescript-language-server, vscode-css-language-server, vscode-eslint-language-server, vue-js-language-server, and the debug adapters go-delve, python-debugpy and ruby-rdbg.
Ideas for a reliable check
-
Check with
initialize, the most reliable. For${server.command}, start the server the way LSP4IJ does anyway (createConnectionProviderand the LSP4J launcher), send aninitializerequest, and count only a response as success; thenshutdownandexit. For example:"check": { "initialize": { "name": "Trying the language server", "timeout": 10000 } }
- It checks what matters, that the server speaks LSP, without knowing anything about the server, and with the transport the user chose, including the socket transport from feat: reach a language server over a socket (experimental) #1870.
- The response carries
serverInfo(name and version), which the installer could print as what it found; that fits Display server info when hovering over server node in LSP consoles view #386, which shows it in the LSP Consoles. - For a debug adapter, the same works with the DAP
initializerequest. - It takes a bit longer than 2 s for some servers, so a longer timeout; a timeout is then a failure.
-
A version command. Already possible today, e.g.
"command": "typescript-language-server --version", and it exits on its own, so no timeout is needed. Many servers have one (typescript-language-server --version,rust-analyzer --version,clangd --version,jq-lsp --version,gopls version), but not all, and the option differs per server. It also checks the program, not the configured command: withsh -c typescript-language-server --stdio,--versionwould have to go totypescript-language-server, not tosh. A variable such as${server.executable}(the program of the configured command) could help, as in${server.executable} --version. -
Make the timeout explicit. Count a timeout as a failure unless the step says otherwise, e.g.
"timeoutIsSuccess": true. That's the smallest change, keeps today's behaviour where it's wanted, and makes it visible in the template; but it doesn't make the check more reliable. -
Only check that the program exists, as some installers do with
which goorwhere gobefore installing. Cheap, but it only says that the program is on thePATH, not that it starts.
Suggestion: 1 for ${server.command}, 2 for installers that want a quick check, and 3 in any case, so that a timeout is never a success by accident.
How this was checked
Claude Code found this by reading ExecTask, ServerInstallerBase and all installer.json files at 42b4e25; the Ruby LSP case comes from running sh -s ruby-lsp by hand on macOS, not from the installer in the IDE. The other examples are kinds of failure, not cases that were seen.
Activity
lagergren commentedon Nov 13, 2026
The Ruby LSP case is fixed in 0.30.0, by #1976: the template starts
ruby-lspitself, withoutsh -s, so the check with${server.command}fails when Ruby LSP isn't installed, and the installer installs it. The rest stands: a command that waits for input, hangs, or crashes after the 2 seconds still counts as installed.lagergren commentedon Nov 20, 2026
Where this stands, and a proposal for the rest, which needs @angelozerr's OK since it adds a task to the
installer.jsonformat.ExecTaskcounts a command that still runs at its timeout as a success, and that is what 20 installers rely on: 22 checks, in 17 language servers and 3 debug adapters, run${server.command}with a timeout of 2 seconds, and a server that starts waits for messages on its standard input until the timeout ends it. So a timeout can't just count as not installed: those checks would fail for servers that work, and Install if Needed would install them again each time. But a server that hangs, waits for input, or fails after 2 seconds counts as installed too.Proposal, the first idea of the issue: a check task that starts the language server with its command, as LSP4IJ starts it, sends
initialize(the DAPinitializefor a debug adapter), and counts only a reply within its timeout as installed. It then ends the server withshutdownandexit(disconnectfor a debug adapter). The 20 installers would use it instead ofexecwith${server.command}:The other checks,
fileExistsandexecwith a command that ends, asnode --version, stay as they are. Would that be OK?feat: an installer check that counts a server as installed only once …