Repository navigation
Description
Found while going through all templates for #1954; collected in #1943.
Summary
A language server or debug adapter created from a template runs its installer on its first start, i.e. when the first matching file opens, without asking:
- every template says
"executeOnStartServer": false, butUserDefinedLanguageServerInstaller.canExecuteruns it anyway as long asinstallAlreadyDoneis false, which it is for a new server;UserDefinedDebugAdapterServerInstallerdoes the same; ServerInstallerBasethen checks and installs in a background task, with a progress bar in the status bar; there's no confirmation anywhere in the installer code.
There's one path where the user asks for it: opening a file that a template supports shows a banner, "Ada files are supported by language servers (LSP4IJ)" with Install Ada Language Server (LanguageServerSuggestionEditorNotificationProvider), which opens the New Language Server dialog, and the user guide's pages say what happens then, e.g. for Ada: "Click OK. This will create the Ada Language Server definition and start the installation" (ada_language_server.md). But:
- neither the banner nor the dialog says what will run and where; the dialog only has an Installer tab with the raw
installer.json; - a server created from the settings page, or from the dialog without the banner, installs in the same way on the first matching file, without any hint.
So creating a server from a template may well mean "I want it installed". But what the installers run differs a lot, and some of it changes the user's environment outside LSP4IJ:
| What runs | Templates | Writes to |
|---|---|---|
npm install … --force |
astro-ls, candor-lsp, eo-lsp-server, stylelint-lsp, svelte-language-server, typescript-language-server, vscode-css-language-server, vscode-eslint-language-server, vue-js-language-server |
~/.lsp4ij/… |
| a download of a release | ada_language_server, camel-lsp-server, clangd, clojure-lsp, docker-language-server, erlang-ls, harper-ls, jdtls, luau-lsp, perl-lsp, rust-analyzer, sdl-lsp, sysml-lsp, terraform-ls, wgsl-analyzer; debug adapters codelldb, perl-dap, vscode-js-debug |
~/.lsp4ij/… |
cs install metals |
metals |
~/.lsp4ij/lsp/metals |
go install …@latest |
gopls, jq-lsp; debug adapter go-delve |
the user's Go bin directory ($GOBIN or ~/go/bin) |
gem install … |
ruby-lsp; debug adapter ruby-rdbg |
the user's Ruby installation |
pip install debugpy |
debug adapter python-debugpy |
the first Python on the PATH, or its user site |
dart-lsp and sourcekit-lsp install nothing; their installers only set the command.
The last three change the user's Go, Ruby and Python setup, with @latest or no version at all, and the user only sees a progress bar.
Ideas
- Ask on the first start, with a notification such as "Ruby LSP needs to be installed:
gem install ruby-lsp, into your Ruby installation" and the actions Install, Show details (the steps frominstaller.json) and Not now. With Not now, the server doesn't start, and the LSP Consoles show it as "not installed", with an action to install it. - Or ask when creating it: a checkbox Install on first start in the New Language Server dialog, with the commands shown below it, checked by default.
- Mark what installs globally, e.g. a property in
installer.jsonsuch as"scope": "global"forgo install,gem installandpip install, so LSP4IJ can always ask for those, and could skip asking for what only writes to~/.lsp4ij. - Show the commands in the installer's output in the LSP Consoles before running them, as the
> commandlinesExecTaskprints today, but before the first step rather than during it.
This goes with #1946, where the installer switches the transport without a word, and #1957, where its check counts a hanging command as installed: in all three, the installer does things the user doesn't see.
How this was checked
Claude Code found this by reading the installer code and all installer.json files at 42b4e25; the banner and the dialog were read in the code and in the user guide, not looked at in the IDE. Where go install, gem install and pip install write depends on the user's setup; the table names the usual places.
Activity