Skip to content

fix: install perl-dap, erlang-ls and the Vue.js language server into the folders of their templates - #2054

Merged
lagergren merged 3 commits into
redhat-developer:mainfrom
lagergren:fix/install-into-the-folder-of-the-template
Nov 21, 2026
Merged

lagergren merged 3 commits into
redhat-developer:mainfrom
lagergren:fix/install-into-the-folder-of-the-template

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Part of #1960.

Every installer puts its language server or debug adapter in ~/.lsp4ij/lsp or ~/.lsp4ij/dap, in a folder named after its template, except three:

  • perl-dap downloaded into ~/.lsp4ij/dap/perl-lsp, named after the archive it shares with perl-lsp.
  • Vue.js Language Server installed into ~/.lsp4ij/lsp/vue-js-language-server-ls, with an extra -ls, from which its initialization options also took TypeScript.
  • erlang-ls expected erlang_ls in ~/.lsp4ij/lsp/erlang. That installer never installed erlang_ls, though:
    • Its check looked only for escript, so wherever Erlang/OTP is installed it found erlang-ls installed and didn't download it.
    • Its assets for Linux and macOS, erlang-linux*.zip and erlang-macos*.zip, are in none of the erlang_ls releases, which publish erlang_ls-linux-<OTP>.tar.gz and erlang_ls-macos-<OTP>.tar.gz.
    • The Windows archive has erlang_ls at its root, not the erlang/erlang_ls that the installer expected, so its download failed too.

They now install into ~/.lsp4ij/dap/perl-dap, ~/.lsp4ij/lsp/vue-js-language-server and ~/.lsp4ij/lsp/erlang-ls, and their templates take them from there. Once the erlang-ls installer has found escript, its check also looks for erlang_ls. On Linux and macOS it downloads the build for Erlang/OTP 27: OTP loads code compiled by the two previous major releases, not by a later one, so that build runs on OTP 27 to 29, the current release. Windows keeps the only build that erlang_ls 1.1.0 has for it, for OTP 26.2.5.3. The docs page of erlang-ls says where the installer puts it, instead of asking to copy erlang_ls into the project.

A language server or debug adapter created before this keeps the installer, the command and the initialization options it was created with: its settings hold them, UserDefinedLanguageServerSettings, and for a debug adapter UserDefinedDebugAdapterServerSettings and its run configurations. So nothing is installed again; only one created from a template afterwards uses the new folder.

Not here:

Test: BundledTemplateCommandsTest.anInstallerPutsItsServerInTheFolderOfItsTemplate checks every ~/.lsp4ij path in the files of the bundled templates and installers: each must be in lsp or dap, in the folder named after its template id or template directory; clangd is exempted. Without the change, it finds the five old paths of perl-dap, Vue.js and erlang-ls. aTemplateStartsItsLanguageServerWhereItsInstallerPutsIt now covers erlang-ls. InstallerTaskRegistryFileExistsTest.testErlangLsInstallerJsonChecksForErlangLsOnceItFindsEscript checks that the erlang-ls check looks for erlang_ls once it has found escript, and fails without the change. The template and installer tests pass (100 tests). The contents of the erlang_ls 1.1.0 archives for Linux, macOS and Windows, and of the perl-lsp 0.17.0 archives for macOS and Windows, were checked by listing them.

…of its template, and find it there

The installer never installed erlang_ls. Its check looked only for
escript, so wherever Erlang/OTP is installed it found erlang-ls installed
and didn't download it. Its download, when forced, didn't work either:
the assets for Linux and macOS, erlang-linux*.zip and erlang-macos*.zip,
are not in any erlang_ls release, which publishes
erlang_ls-linux-<OTP>.tar.gz and erlang_ls-macos-<OTP>.tar.gz, and the
Windows archive has erlang_ls at its root, not the erlang/erlang_ls that
the installer expected in ~/.lsp4ij/lsp.

The installer now downloads erlang_ls into ~/.lsp4ij/lsp/erlang-ls, the
folder of its template, and its check looks for it there once it has found
escript. On Linux and macOS it takes the build for Erlang/OTP 26, as on
Windows, where the only build is for OTP 26.2.5.3. The template starts
erlang_ls from there, and its docs page says so, instead of asking to copy
erlang_ls into the project.
… of their templates

The perl-dap installer downloaded perl-dap into ~/.lsp4ij/dap/perl-lsp,
after the archive it shares with perl-lsp, and the Vue.js installer
installed into ~/.lsp4ij/lsp/vue-js-language-server-ls, which its
initialization options also took TypeScript from. They now install into
~/.lsp4ij/dap/perl-dap and ~/.lsp4ij/lsp/vue-js-language-server, the
folders of their templates, as the other installers do.

A language server or debug adapter created before keeps the installer and
the command that it was created with, which its settings hold, so it isn't
installed again.
Erlang/OTP loads code compiled by the two previous major releases, not by
a later one, so the build for OTP 26 doesn't run on OTP 29, the current
release; the build for OTP 27 runs on OTP 27 to 29. Windows keeps the
only build that erlang_ls publishes for it, for OTP 26.
@lagergren lagergren added this to the 0.30.2 milestone Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Erlang LS setup now downloads the latest server automatically when it is not already installed. Instructions cover supported Linux, macOS, and Windows builds and explain how to configure a different executable path.
  • Bug Fixes
    • Corrected installation paths for Perl and Vue.js language servers.
    • Updated the Vue.js language server’s TypeScript SDK path.

Erlang LS installation paths, platform download assets, executable checks, and setup instructions are updated. Perl DAP and Vue.js Language Server paths are aligned with their template names. Tests cover Erlang LS and check installation paths across bundled templates.

Changes: Template installation paths

Layer / File(s) Summary
Erlang LS installation and command paths
src/main/resources/templates/lsp/erlang-ls/*, docs/user-defined-ls/erlang-ls.md, src/test/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerTaskRegistryFileExistsTest.java, src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
The Erlang LS installer sets a distribution directory, selects updated Linux and macOS assets, and downloads erlang_ls into that directory. Its check now verifies that the executable exists after the runtime command succeeds. The template command and setup instructions use the updated path. Tests verify the file-existence check and include Erlang LS in command checks.
Perl DAP and Vue.js paths
src/main/resources/templates/dap/perl-dap/installer.json, src/main/resources/templates/lsp/vue-js-language-server/*
Perl DAP’s distribution directory changes to perl-dap. Vue.js Language Server’s working directory and TypeScript SDK path change to vue-js-language-server.
Bundled path consistency tests
src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
The test scans bundled JSON paths and checks that their kind and folder match the template directory or ID. Shared file-loading logic now reads matching JSON files as text.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 09ebe

This change moves the Perl DAP, Vue.js Language Server and Erlang LS installers into folders named after their templates. It also fixes the Erlang LS download assets and executable check. The paths in the installers, templates and docs are consistent, and the release archives place erlang_ls where the check and template expect it. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names three concrete changes: perl-dap, erlang-ls and the Vue.js language server are installed into the folders of their templates. The changeset does this: perl-dap moves to dap/perl-dap, V…
Description check Passed The description states the purpose of the change. It lists the three affected installers, the old and new folders, and the erlang-ls check and asset fixes. It also gives the test coverage and the scop…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names three concrete changes: perl-dap, erlang-ls and the Vue.js language server are installed into the folders of their templates. The changeset does this: perl-dap moves to dap/perl-dap, Vue.js to lsp/vue-js-language-server, and erlang-ls to lsp/erlang-ls, with matching template and test updates. The title is specific and matches the main change. It uses the fix: prefix, which fits the bug-fix nature of the change.

Full details: Description check

Explanation

The description states the purpose of the change. It lists the three affected installers, the old and new folders, and the erlang-ls check and asset fixes. It also gives the test coverage and the scope exclusions. It relates directly to the changeset.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 924e9c43-b206-40f2-b09c-73678177a881
Commits

Reviewing files that changed from the base of the PR and between b982bd4 and 09ebe00.

Files selected for processing: 8

  • docs/user-defined-ls/erlang-ls.md
  • src/main/resources/templates/dap/perl-dap/installer.json
  • src/main/resources/templates/lsp/erlang-ls/installer.json
  • src/main/resources/templates/lsp/erlang-ls/template.json
  • src/main/resources/templates/lsp/vue-js-language-server/initializationOptions.json
  • src/main/resources/templates/lsp/vue-js-language-server/installer.json
  • src/test/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerTaskRegistryFileExistsTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.50%. Comparing base (e92baaa) to head (09ebe00).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2054      +/-   ##
==========================================
+ Coverage   49.47%   49.50%   +0.02%     
==========================================
  Files         813      813              
  Lines       33343    33350       +7     
  Branches     6854     6854              
==========================================
+ Hits        16498    16509      +11     
- Misses      14267    14271       +4     
+ Partials     2578     2570       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit 89ed6b1 into redhat-developer:main Nov 21, 2026
9 checks passed
lagergren added a commit to lagergren/lsp4ij that referenced this pull request Nov 21, 2026
…package in the test of the install folders

The test of redhat-developer#2054 checks that each installer puts its server in the folder of its template. The CSS and ESLint
language servers share the folder of the npm package which has both, vscode-langservers-extracted.
lagergren added a commit that referenced this pull request Nov 21, 2026
…ok for them (#2057)

Part of #1960.

Builds on #2054, which should merge first: this branch contains its commits, and #2054 moves perl-dap to `~/.lsp4ij/dap/perl-dap`.

The perl-lsp releases, which both the perl-lsp and the perl-dap installers download, are archives with one root folder, `perllsp-<version>-<target>/`, which the download task adds to the output dir. So the download put `perllsp` in `~/.lsp4ij/lsp/perl-lsp/perllsp-0.17.0-<target>/` and `perl-dap` in `~/.lsp4ij/dap/perl-dap/perllsp-0.17.0-<target>/`, while:

- the checks of both installers look for `perllsp` and `perl-dap` in the folder itself, so they never found them, and each run of an installer downloaded them again;
- the command of the perl-lsp template, `$USER_HOME$/.lsp4ij/lsp/perl-lsp/perllsp`, which #2041 aligned with the installer, points at the folder itself too, so a language server created from the template didn't start until its installer had run and set the versioned path.

A `*` in the checks, as `${serverDist}/perllsp-*/perllsp`, would have let them find the server, but the template could then not start it: its installer would no longer run and set the versioned path.

The `output` of a download can now set `stripRootFolder`, which extracts the content of the single root folder of the archive into `dir` itself, replacing the files of an earlier install (`DownloadTask`). Both installers set it, so the check, the command that the download configures, and the template's command all point at `~/.lsp4ij/lsp/perl-lsp/perllsp` and `~/.lsp4ij/dap/perl-dap/perl-dap`, and a newer release replaces the files instead of adding a folder next to the old one. Without `stripRootFolder`, a download works as before. The template docs say how a root folder is handled, with and without it.

A language server or debug adapter created before this keeps the installer and command it was created with, as for #2054.

Not here: clangd, whose archive also has one root folder, named after its version, which its command needs (#2011); and the versioned folders that earlier perl installs left behind.

Test: `InstallerTaskRegistryFileExistsTest.testPerlLspChecksForTheServerWhereItsDownloadPutsIt` and `testPerlDapChecksForTheDebugAdapterWhereItsDownloadPutsIt` run the download of the bundled installer twice, as a reinstall does, from a local archive laid out as the 0.17.0 releases are, and then its check: the check finds what the download installed, and the configured command starts it from the folder that the check looks in. Both fail without `stripRootFolder` in the installers. They and the installer and template tests pass (102 tests). The layout comes from listing the 0.17.0 archives for Linux x86_64 and Windows, and the 0.15.0 archive for macOS arm64.
lagergren added a commit that referenced this pull request Nov 21, 2026
…ir npm package (#2052)

Part of #1960.

Builds on #2051, which should merge first: this branch contains its commit, and changes the paths that #2051 puts into the README and the docs page of the CSS language server.

The CSS and ESLint language server templates both start a language server of the `vscode-langservers-extracted` npm package, and their installers each installed the whole package into a folder of their own, `~/.lsp4ij/lsp/vscode-css-language-server` and `~/.lsp4ij/lsp/vscode-eslint-language-server`. A copy is about 70 MB, most of it TypeScript 4.9, which the package depends on. Both templates and installers now use one folder, `$USER_HOME$/.lsp4ij/lsp/vscode-langservers-extracted`, so the package is installed once.

Each language server runs its installer in a task of its own, so the installers of two language servers can run at the same time: with a CSS file and a JavaScript file opened together, two `npm install` would run in the shared folder at once and break each other's install. An exec task which declares its working directory now runs its command there only while no other exec task runs its command in the same directory (`ExecTask`, a lock per directory). The wait ends with the cancellation of the installation. An exec task without a working directory, as the check `Trying current command` of most installers, which runs in the project, doesn't wait.

The lock also keeps out the exec tasks of the other IDEs with LSP4IJ, as IntelliJ IDEA and WebStorm, which share `~/.lsp4ij`: an exec task also locks a file for its working directory, in `$USER_HOME$/.lsp4ij/locks` (`ExecTask.getLockFile`). If the file can't be opened or locked, as on a file system without file locks, the task goes on as before, kept out only by the other tasks of its IDE.

An installation which runs because the check found the server not installed, and which waited for another one to leave its working directory, runs the check again once it runs, and doesn't run its command if the check then passes (`InstallerContext.isCheckAgainAfterWaiting`, set by the declarative language server and debug adapter installers from `ServerInstallerBase.isInstallingAfterFailedCheck`). So with a CSS file and a JavaScript file opened together, the package is installed once, not twice in a row. A forced installation, as by *Reinstall*, still runs its command.

A language server already created from one of these templates keeps the command and the installer it was created with, so it keeps starting from its own folder, and nothing is installed again. Only a language server created from the template afterwards uses the shared folder.

Not here: the other install folders of #1960, and the folders that the old installs leave behind.

Test: `ExecTaskTest` runs two exec tasks in the same working directory at the same time, each with a command that holds the same file for two seconds and fails if the other holds it: both succeed. Without the lock, one fails. It also runs an installation while another one, which installs the server, runs in the same directory: the one that waited runs the check again, which passes, and not its command, which would fail; when the installation is forced, it runs its command. And it runs an exec task while another JVM, as another IDE, holds the lock file of its directory and the same file: it waits, and succeeds. The test that runs the check again and the one with another JVM fail without the change. `BundledTemplateCommandsTest.aTemplateStartsItsLanguageServerWhereItsInstallerPutsIt` now also checks that the CSS and ESLint templates start the language server where their installers put it, the command of an `npm install` included. It fails with the CSS template on its old folder. With #2054 merged, its `BundledTemplateCommandsTest.anInstallerPutsItsServerInTheFolderOfItsTemplate` lets the CSS and ESLint templates share the folder of their npm package (e6580ed). It and the installer, template, DAP, server and console tests pass (560 tests, 4 Windows-only tests skipped).
@lagergren lagergren added bug Something isn't working dap Debugging Adapter Protocol install template-ls labels Nov 22, 2026
lagergren added a commit that referenced this pull request Nov 23, 2026
… of the file it found (#2089)

Fixes #2011

## What

When the check of an installer finds the server installed, the download doesn't run, and only the download gives the server its command. So a server created from a template once its binary was installed kept the template's command, such as `clangd` or `${BASE_DIR}/rust-analyzer`.

#2041, #2054 and #2057 fixed the templates with a fixed path. This fixes the rest: servers in a folder or file named after their version, or at a path by architecture. #2033 already covered the test gaps of #2011.

## Change

- **`${check.file}`:** `fileExists` gives the file it found to the tasks after it.
  - The path is as written in `file`, with `${...}` properties resolved and macros kept, as `$USER_HOME$/.lsp4ij/lsp/clangd_19.1.2/bin/clangd`. That is the same form as a download's `${output.dir}`.
  - If a glob matches several files, the last in natural order wins, segment by segment: `clangd_19.1.10` after `clangd_19.1.2`, and `camel-lsp-server-1.31.0.jar` after `camel-lsp-server-1.9.0.jar`.
  - A `fileExists` that finds nothing removes `${check.file}`.
- **A new task, `replaceTemplateCommand`,** with `templateCommand` and `command`, both by OS like `command`.
  - It sets the command as `configureServer` does, but only while the server's command is exactly `templateCommand`.
  - Otherwise it leaves the command and succeeds, so the check still passes, and *Check installation* in the settings keeps a command that the user or a download set.
  - On an OS without a `templateCommand`, it changes nothing.
- **Why a separate task, not an option of `configureServer`: older versions stay safe.**
  - LSP4IJ 0.30.1 skips a task type it doesn't know. So after a downgrade, a Settings Sync with an older IDE, or a template imported into an older version, the check still passes, and the server keeps its command.
  - A `configureServer` there would set the literal `"${check.file}"`.
  - Both were checked by running the 0.30.1 code on these installers.
- **`configureServer`** is unchanged, except that a command that still has `${check.file}` after resolution is now reported as an error and not set.
- **The bundled installers:** the checks of clangd, camel-lsp-server, ada_language_server, rust-analyzer, wgsl-analyzer, codelldb, perl-dap and vscode-js-debug get an `onSuccess` `replaceTemplateCommand`, with their template's command and the command that their download gives, from `${check.file}`. cpp_ls, docker-language-server and terraform-ls keep their commands on the PATH.
- **ada_language_server's check** now looks under `integration/`. Every Ada release archive since before the template existed has that single root folder, which the download adds to `${output.dir}`, so the old check never found the installed server.
- **Schema and docs:** the `installer.json` schema and `docs/UserDefinedLanguageServerTemplate.md` describe `fileExists`, `${check.file}` and `replaceTemplateCommand`, with clangd's check as the example.

Servers created before this change keep the installer they were created with, so they aren't affected.

## Test

- **`FileExistsTaskTest`:** `${check.file}` without a glob, with several matches (in natural order; a folder without the file is ignored), with a glob in the file name, and with macros kept; no property when the file is missing, and an earlier one removed.
- **`ReplaceTemplateCommandTaskTest`** (new):
  - the template's command is replaced;
  - a command that the user changed, and one that an earlier download set, stay, and the task still succeeds;
  - no `templateCommand` for the OS changes nothing;
  - an unresolved `${check.file}` is an error and changes nothing, in this task and in `configureServer`;
  - `configureServer` still changes the command as before;
  - `templateCommand` by OS;
  - the plugin's registry loads the task for the bundled clangd installer;
  - a full check with two versions of clangd.
- **`InstallerTaskRegistryFileExistsTest`:** for clangd, camel-lsp-server, codelldb, perl-dap and vscode-js-debug, it runs the download from a local archive, then the check for a server with the template's command. The check sets the same command as the download, and a changed command and one from an earlier version stay.
- **`BundledTemplateCommandsTest`:** for the eight templates and each OS and architecture that they declare, the check finds the file that the download installs, its command equals the download's, and `templateCommand` equals the template's command. The test of a home directory with a space now also covers the check commands.
- **Results:** the installation and template tests pass (110), and so does the full suite (1,845 tests, 0 failures, 7 skipped).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dap Debugging Adapter Protocol install template-ls

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant