Repository navigation
fix: install perl-lsp and perl-dap where their checks and commands look for them - #2057
Conversation
…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.
…ok for them The perl-lsp releases are archives with one root folder, perllsp-<version>-<target>/, which the download task added to the output dir. So perllsp and perl-dap landed in ~/.lsp4ij/lsp/perl-lsp/perllsp-0.17.0-<target>/ and ~/.lsp4ij/dap/perl-dap/perllsp-0.17.0-<target>/, while the checks of both installers, and the command of the perl-lsp template, look for them in the folder itself. The checks never found them, so each run of an installer downloaded them again, and a language server created from the template didn't start until its installer had run. The output of a download can now set stripRootFolder, which extracts the content of the single root folder of the archive into the output dir itself, replacing the files of an earlier install. Both installers set it, so the servers are found at the same place from one version to the next.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2057 +/- ##
==========================================
+ Coverage 49.91% 50.08% +0.17%
==========================================
Files 813 813
Lines 33396 33408 +12
Branches 6872 6874 +2
==========================================
+ Hits 16668 16734 +66
+ Misses 14138 14061 -77
- Partials 2590 2613 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
…-perl-dap-once-installed # Conflicts: # src/test/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerTaskRegistryFileExistsTest.java
|
@coderabbitai review |
Action performed
|
… 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).
…s without IntelliJ API scheduled for removal The plugin verifier reports `FileUtil.delete(Path)` as an API scheduled for removal, and deprecated, on 2025.2 and later, from `DownloadTask.moveContentInto`, which `stripRootFolder` uses to replace the files and folders of an earlier install (#2057). `moveContentInto` now deletes them with `NioFiles.deleteRecursively(Path)`. It's public on all the supported versions, 2024.2 to 2026.3, and neither internal, experimental, deprecated nor scheduled for removal on any of them. On all of them, `FileUtil.delete(Path)` and `NioFiles.deleteRecursively(Path)` have the same body, `FileUtilRt.deleteRecursively(path, null)`: the deletion is the same, recursive, and does nothing for a path that doesn't exist. `DownloadTaskArchiveRootTest` gets a test that `stripRootFolder` replaces the server file and a folder of an earlier install, the folder's files and folders included, instead of merging the new folder into the old one. Without the deletion, the install fails, as the move finds the file in place. Part of #1971
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 putperllspin~/.lsp4ij/lsp/perl-lsp/perllsp-0.17.0-<target>/andperl-dapin~/.lsp4ij/dap/perl-dap/perllsp-0.17.0-<target>/, while:perllspandperl-dapin the folder itself, so they never found them, and each run of an installer downloaded them again;$USER_HOME$/.lsp4ij/lsp/perl-lsp/perllsp, which fix: start harper-ls, perl-lsp, clojure-lsp and jdtls where their installers put them #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
outputof a download can now setstripRootFolder, which extracts the content of the single root folder of the archive intodiritself, 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/perllspand~/.lsp4ij/dap/perl-dap/perl-dap, and a newer release replaces the files instead of adding a folder next to the old one. WithoutstripRootFolder, 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.testPerlLspChecksForTheServerWhereItsDownloadPutsItandtestPerlDapChecksForTheDebugAdapterWhereItsDownloadPutsItrun 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 withoutstripRootFolderin 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.