Skip to content

fix: start harper-ls, perl-lsp, clojure-lsp and jdtls where their installers put them - #2041

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/start-four-templates-where-their-installers-put-them
Nov 20, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/start-four-templates-where-their-installers-put-them

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Part of #2011.

The commands of these four templates start ${BASE_DIR}/..., a
placeholder that the user has to replace, and that LSP4IJ doesn't know.
Their installers check for the language server in
$USER_HOME$/.lsp4ij/lsp/<name>, where their download puts it, and only
the download gives the language server its command. So a language server
created from one of these templates once its binary is installed, as a
second one, or one created again, kept ${BASE_DIR}/... and didn't
start.

The templates now start the language server where the installer puts
it, with the command that the installer gives it, as luau-lsp and
lemminx do (#1981). A language server installed somewhere else still
needs its command changed, as with ${BASE_DIR} before. The READMEs of
clojure-lsp and jdtls say where the command starts it, and the jdtls
README no longer mentions the ${DATA_DIR} that #1981 replaced.

Not here: the templates whose command starts a language server on the
PATH, as cpp_ls, docker-language-server and terraform-ls, which a user
who hasn't run the installer can rely on, and those whose installer puts
the language server in a folder named after its version or its
architecture, as clangd. They need a check that gives the command, which
#2011 proposes.

Test: BundledTemplateCommandsTest.aTemplateStartsItsLanguageServerWhereItsInstallerPutsIt
compares the command of each of these six templates, on Windows and on
the other OS, with the command that its installer gives the language
server once it has downloaded it. It fails without the change for the
four templates. It and the template and installer tests pass (68 tests).

…tallers put them

Part of redhat-developer#2011.

The commands of these four templates start `${BASE_DIR}/...`, a
placeholder that the user has to replace, and that LSP4IJ doesn't know.
Their installers check for the language server in
`$USER_HOME$/.lsp4ij/lsp/<name>`, where their download puts it, and only
the download gives the language server its command. So a language server
created from one of these templates once its binary is installed, as a
second one, or one created again, kept `${BASE_DIR}/...` and didn't
start.

The templates now start the language server where the installer puts
it, with the command that the installer gives it, as luau-lsp and
lemminx do (redhat-developer#1981). A language server installed somewhere else still
needs its command changed, as with `${BASE_DIR}` before. The READMEs of
clojure-lsp and jdtls say where the command starts it, and the jdtls
README no longer mentions the `${DATA_DIR}` that redhat-developer#1981 replaced.

Not here: the templates whose command starts a language server on the
PATH, as cpp_ls, docker-language-server and terraform-ls, which a user
who hasn't run the installer can rely on, and those whose installer puts
the language server in a folder named after its version or its
architecture, as clangd. They need a check that gives the command, which
redhat-developer#2011 proposes.

Test: `BundledTemplateCommandsTest.aTemplateStartsItsLanguageServerWhereItsInstallerPutsIt`
compares the command of each of these six templates, on Windows and on
the other OS, with the command that its installer gives the language
server once it has downloaded it. It fails without the change for the
four templates. It and the template and installer tests pass (68 tests).
@lagergren lagergren added this to the 0.30.2 milestone Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Updates
    • Clojure, Harper, JDT, and Perl language-server templates now use executables in their standard locations under the user’s .lsp4ij/lsp directory on Windows and default platforms.
    • The Clojure and JDT setup instructions now reflect the updated executable locations. JDT instructions also describe using a project-specific data directory and changing the executable path if the archive was extracted elsewhere.

Four bundled language server templates now use user-home installation paths. README instructions were updated for Clojure LSP and JDT LS. A test compares selected template commands with installer configuration on Windows and the default OS.

Changes: Bundled language server command paths

Layer / File(s) Summary
Update bundled launch paths
src/main/resources/templates/lsp/clojure-lsp/template.json, src/main/resources/templates/lsp/harper-ls/template.json, src/main/resources/templates/lsp/jdtls/template.json, src/main/resources/templates/lsp/perl-lsp/template.json, src/main/resources/templates/lsp/clojure-lsp/README.md, src/main/resources/templates/lsp/jdtls/README.md
Clojure LSP, Harper LS, JDT LS, and Perl LSP commands now use user-home installation paths. The Clojure LSP and JDT LS READMEs document their locations and setup paths.
Compare template and installer commands
src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
A test compares selected templates with installer command configuration for Windows and the default OS. Helpers resolve installer output paths and select OS-specific values.

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

Change: Bug fix

Suggested reviewers: angelozerr, fbricon

Merge Risk: Minimal · up to 0e77f

The change updates four bundled language server templates to start servers where their installers place them. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: four templates (harper-ls, perl-lsp, clojure-lsp, jdtls) now start their language servers from the location their installers use. It matches the changeset summary and …
Description check Passed The description explains the problem (placeholder ${BASE_DIR} commands that LSP4IJ does not resolve), the fix (installer-provided paths and commands), the scope limits, and the new test. It matches th…
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 the main change: four templates (harper-ls, perl-lsp, clojure-lsp, jdtls) now start their language servers from the location their installers use. It matches the changeset summary and objectives.

Full details: Description check

Explanation

The description explains the problem (placeholder ${BASE_DIR} commands that LSP4IJ does not resolve), the fix (installer-provided paths and commands), the scope limits, and the new test. It matches 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: d51b2b57-7bcc-47c1-beaa-0d5450ef503f
Commits

Reviewing files that changed from the base of the PR and between 13916a2 and 0e77f87.

Files selected for processing: 7

  • src/main/resources/templates/lsp/clojure-lsp/README.md
  • src/main/resources/templates/lsp/clojure-lsp/template.json
  • src/main/resources/templates/lsp/harper-ls/template.json
  • src/main/resources/templates/lsp/jdtls/README.md
  • src/main/resources/templates/lsp/jdtls/template.json
  • src/main/resources/templates/lsp/perl-lsp/template.json
  • 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; 1 remain after this review.

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.42%. Comparing base (13916a2) to head (0e77f87).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2041      +/-   ##
==========================================
- Coverage   49.43%   49.42%   -0.01%     
==========================================
  Files         813      813              
  Lines       33324    33324              
  Branches     6848     6848              
==========================================
- Hits        16473    16472       -1     
- Misses      14278    14280       +2     
+ Partials     2573     2572       -1     

☔ 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.

@muescha

muescha commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 20, 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 4545d1b into redhat-developer:main Nov 20, 2026
9 checks passed
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 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).
@lagergren lagergren added the bug Something isn't working label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants