Repository navigation
feat: add templates for the Erlang Language Platform (ELP) and the edb debug adapter, and name erlang-ls as discontinued - #2155
Conversation
… the erlang-ls template as discontinued erlang_ls, the server of the only Erlang template, is archived: its last release, 1.1.0, and its last change of code are from October 2024, and its README recommends WhatsApp's Erlang Language Platform (ELP) (redhat-developer#1991). A new template, erlang-elp, "Erlang Language Platform (ELP)", starts `elp server`, the command of ELP's docs, which also starts an elp on the PATH, as Homebrew's. It maps the files that ELP's VS Code extension sends it as erlang, ELP talks LSP only over stdio, and its settings schema is the one that ELP generates for its `elp` section, which it asks for with workspace/configuration. Its installer downloads the elp-<os>-<arch>-...-otp-*.tar.gz asset of the latest ELP release, which has only elp (elp.exe on Windows), into ~/.lsp4ij/lsp/erlang-elp, and gives the server the command `"$USER_HOME$/.lsp4ij/lsp/erlang-elp/elp" server`. Its check, a fileExists of that file, gives a server created from the template once ELP is there the same command, with replaceTemplateCommand. Without GitHub, it downloads the release 2026-11-20. ELP publishes a build per Erlang/OTP version, 27.3, 28.5 and 29.1. That is the version ELP was built with, not one that the user must run: a build runs on that version and usually on later ones, per ELP's install guide. So the installer takes the build for the oldest Erlang/OTP of the release, as ELP's VS Code extension does: `otp-*` matches it first, as GitHub lists the assets of a release by name. The installer can't pass the output of `erl` to the asset, so detecting the user's Erlang/OTP would take one download per version, and the check couldn't tell which one is installed. The README and the docs page say how to take another build. The erlang-ls template keeps its id, command, mappings and installer. Only its name changes, to "Erlang Language Server (erlang_ls, discontinued October 2024)", which the list of templates and the server name of a new server show. A server created from it keeps its name and settings, and finds its template, for its documentation link and transports, by its id. InstallerTaskRegistryFileExistsTest runs the download of ELP from a local .tar.gz with only elp at its root, then the check for a server with the command of the template. BundledTemplateCommandsTest lists erlang-elp among the checks that give the command of the download, for each OS and architecture.
ELP is only a language server; its VS Code extension ships WhatsApp's edb as its debugger (redhat-developer#1991). edb speaks DAP over stdio, with `edb dap`. A new DAP template, erlang-edb, "Erlang - edb", has the command `edb dap`, the Erlang source files, and the launch configuration of edb's README, "Launch rebar3 shell": edb asks the IDE, with runInTerminal, to start `rebar3 as test shell`, whose node then connects to it. Its installer downloads the edb-<version>.tar.gz asset of the latest edb release, the same for Linux and macOS, and extracts the content of its edb-<version>/ folder into ~/.lsp4ij/dap/erlang-edb: the edb launcher, and the escripts for Erlang/OTP 28 and for 29 and later, in otp-28/ and otp-29/, which the launcher finds next to itself and picks for the Erlang/OTP that `erl` reports. It gives the debug adapter the command `"$USER_HOME$/.lsp4ij/dap/erlang-edb/edb" dap`, and its check, a fileExists of the launcher, gives that command to a debug adapter created from the template once edb is there. Without GitHub, it downloads edb 1.0.0. edb doesn't support Windows yet, so the installer downloads nothing there. BundledTemplateCommandsTest, which wants a download for each platform, lists the OSes that a template doesn't support, and fails if the installer downloads something there. The template has no attach configuration: edb attaches to a running node with an attach request to the adapter that the IDE started over stdio, while LSP4IJ's Attach mode connects to an adapter that already runs, and starts none. The docs page says so. InstallerTaskRegistryFileExistsTest runs the download of edb from a local .tar.gz laid out as edb's, then the check for a debug adapter with the command of the template. BundledTemplateCommandsTest lists erlang-edb among the checks that give the command of the download.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2155 +/- ##
==========================================
+ Coverage 53.22% 53.38% +0.16%
==========================================
Files 826 826
Lines 34717 34730 +13
Branches 7143 7147 +4
==========================================
+ Hits 18477 18542 +65
+ Misses 13468 13413 -55
- Partials 2772 2775 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…files, with a new template key "promotable": false The banner above a file which IntelliJ opens as plain text or with TextMate suggests each bundled template that matches the file and whose isPromotable() holds. That was false only while a plugin of its disablePromotionFor is installed, so the banner of an Erlang file offered both ELP and the archived erlang_ls. A template can now say "promotable": false, and the banner then never suggests it. The New Language Server dialog still lists it, and a language server created from it is unchanged. The erlang-ls template says so, so the banner of an Erlang file suggests only ELP. The key reads as isPromotable() and disablePromotionFor do: it says what the banner does, not why, so it fits any template that LSP4IJ keeps but no longer recommends. Without the key, or with a value which isn't a boolean, a template stays promotable. LSP4IJ 0.30.1 and earlier read only the keys they know, so they ignore it and keep suggesting erlang-ls. The cache of the plugin check, which was named promotable, is now promotableWithTheInstalledPlugins. The banner's choice of templates moves into suggest(), which the unit-test mode of collectNotificationData doesn't reach, so that a test can call it. LanguageServerTemplateDeserializerTest reads the key: false isn't promotable, true, none and a string are. The new LanguageServerSuggestionEditorNotificationProviderTest checks that the banner of an Erlang file suggests erlang-elp and not erlang-ls, which the dialog still finds; it fails without "promotable": false on erlang-ls.
…maps The banner above a file which IntelliJ opens as plain text or with TextMate left out only the templates which a language server was created from. So a file which a language server already served got the other templates which match it: a user of a server created from erlang-ls was offered ELP for the same .erl files, and a server of the user without a template, or of a plugin, didn't keep the banner away at all. The Javadoc of collectNotificationData already said that a file which a language server handles gets no banner. The banner now suggests nothing for a file that LanguageServersRegistry.isFileSupported(VirtualFile, Project) accepts: a file which a mapping of a language server matches by its language, file type or name, of the user or of a plugin, from a template or not. A disabled language server keeps its mappings in the registry, so it counts too: the user turned it off, and isn't offered another one instead. The check matches the mappings that the registry holds in memory, under the read lock that collectNotificationData runs with, and starts no language server. A template which a language server was created from is still left out, also for a file that its server doesn't map, as one whose mapping the user removed: the banner doesn't offer to create it again. LanguageServerSuggestionEditorNotificationProviderTest: no template is suggested for an Erlang file which a language server maps, from erlang-ls, without a template, or disabled; ELP still is while the language servers map other files; and a server from erlang-elp which doesn't map .erl keeps erlang-elp from being suggested for it. The first three fail without the check.
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
Fixes #1991
Please merge with "Rebase and merge", not "Squash and merge". Each of the four commits is one change, and its title names what users get, so all four titles reach the release notes.
Thanks to @muescha for #1991, which found that erlang_ls is archived, mapped out ELP's release assets, and proposed both templates.
What
erlang_ls, the server of the only Erlang template, is archived: its last release, 1.1.0, and its last code change are from October 2024, and its README recommends WhatsApp's Erlang Language Platform (ELP). Following option 2 of #1991, this:
Change
erlang-elp, "Erlang Language Platform (ELP)" (797e5d2):elp server, over stdio only.elpsection.elp-<os>-<arch>-…-otp-*.tar.gzasset of the latest release into~/.lsp4ij/lsp/erlang-elp, and sets"$USER_HOME$/.lsp4ij/lsp/erlang-elp/elp" server. ItsfileExistscheck gives a server created from the template the same command, withreplaceTemplateCommand. The fallback URL is release2026-11-20.otp-*takes the oldest build of the release, as ELP's VS Code extension ships. GitHub lists a release's assets by name, so the oldest comes first. Detecting the user's OTP would need one chained download per version, as the installer can't pass anexec's output to the asset. The README says how to pick another build.erlang-ls(797e5d2): renamed "Erlang Language Server (erlang_ls, discontinued October 2024)". Its id, command, mappings and installer are unchanged, and its docs page points to ELP.erlang-edb, "Erlang - edb" (bde55f6):edb dap, with edb's own "Launch rebar3 shell" configuration, which usesrunInTerminal.edb-*.tar.gz, and extracts its folder into~/.lsp4ij/dap/erlang-edb, so that the launcher stays next to its OTP 28 and 29 escripts. The fallback is edb 1.0.0."promotable": false, and the banner never suggests it. erlang-ls says so, and stays in the New Language Server dialog.LanguageServersRegistry.isFileSupported): a server of the user or of a plugin, from a template or not, enabled or disabled.Behaviour changes
"promotable": false.Backward compatibility
promotableis optional and defaults totrue. LSP4IJ 0.30.1 and earlier read only the template keys they know, so they ignore it, and still suggest erlang-ls.Test
BundledTemplateCommandsTest:erlang-elpanderlang-edbare inCHECKS_WHICH_GIVE_THE_COMMAND, checked for each OS and architecture. A newUNSUPPORTED_OSESlets edb have no Windows download, and fails if one is added.InstallerTaskRegistryFileExistsTest:.tar.gzshaped like the real one: onlyelpat the root, oredb-<ver>/with the launcher and theotp-28/andotp-29/escripts.LanguageServerTemplateDeserializerTest:"promotable": falseisn't promotable;true, no key, and a string value are.LanguageServerSuggestionEditorNotificationProviderTest(new, 6 tests), with an.erlfile that the test asserts is plain text or TextMate:*.erl: one from erlang-ls, one without a template, or a disabled one.*.hrlkeeps erlang-elp from being suggested for the.erlfile."promotable": falseon erlang-ls, the first test fails; without theisFileSupportedcheck, the three "nothing is suggested" tests fail.initialize, and the macOS x86_64 build of ELP answers it under Rosetta.