Repository navigation
fix: install the CSS and ESLint language servers into one copy of their npm package - #2052
Conversation
…instead of asking for VS Code Since d5942bf, the command of the CSS language server template starts the server where its installer puts it, in $USER_HOME$/.lsp4ij/lsp/vscode-css-language-server, but its README and its docs page still asked to install Visual Studio Code and to use its copy.
…ir npm package The CSS and ESLint language server templates both start a server of the vscode-langservers-extracted package, and their installers each installed the whole package, about 70 MB with the TypeScript it depends on, into a folder of their own. They now install it into, and start it from, one folder, $USER_HOME$/.lsp4ij/lsp/vscode-langservers-extracted. The installers of two language servers run at the same time, each in a task of its own, so two npm install could run in that 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; the wait ends if the installation is cancelled.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2052 +/- ##
==========================================
+ Coverage 49.91% 49.95% +0.04%
==========================================
Files 813 813
Lines 33396 33471 +75
Branches 6872 6886 +14
==========================================
+ Hits 16668 16722 +54
Misses 14138 14138
- Partials 2590 2611 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ay the installer runs at the first start The screenshot showed the old command, VS Code's copy of the server, in a red box, which the text below it now contradicts: it shows the template selection only. The installer runs at the first start of the language server only, as its executeOnStartServer is false, and then on Reinstall; the npm command it runs has --force.
…de-langservers-extracted # Conflicts: # docs/user-defined-ls/vscode-css-language-server.md
|
Checked the paths in both templates, installers, the README and the docs page: they all point to the shared folder, and nothing points to the old ones any more. The lock and both tests look good to me. Two things to consider, neither blocking:
The points on the docs text from #2051 apply here too, since this PR has the same text. Claude Code read the diff, the templates and installers at c186336, and the CI results; nothing was run locally. |
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
…d don't install again after waiting An exec task also locks a file for its working directory, in $USER_HOME$/.lsp4ij/locks, which keeps out the exec tasks of the other IDEs with LSP4IJ, as IntelliJ IDEA and WebStorm, which share the directories into which the installers install. 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, and doesn't run its command if the check then passes, as when the CSS and ESLint language servers start together. A forced installation, as by Reinstall, still runs its command.
|
Thanks, both are in 466bdf3:
|
…servers-extracted # Conflicts: # docs/user-defined-ls/vscode-css-language-server.md # src/main/resources/templates/lsp/vscode-css-language-server/README.md # src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
…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.
|
@coderabbitai review |
Action performed
|
…it for an edit of the description (#2067) Fixes #2066. The *Conventional Commits PR Check* ran for every edit of a pull request, its description included, and since #1973 a newer run cancelled the one in progress. A push followed within seconds by an edit of the description left a cancelled run of `main` on the commit, which GitHub counts as a failed check: the pull request showed a red cross and the merge state `UNSTABLE`, while the other run of the same check passed (#2049, #2053, #2052). - The workflow has no concurrency group any more, so no run is cancelled. `cancel-in-progress: false` would not be enough: a run that waits in the group is still cancelled when a newer one joins it. The check takes a few seconds. - The job is skipped for an edit that doesn't change the title (`github.event.changes.title`). A skipped run doesn't count as a failure. Pushes and title edits run the check as before. The other workflows keep the cancellation of #1973, where it saves runners. Test: `actionlint` passes. This pull request runs the changed workflow: the check ran and passed when it was opened, and this edit of its description, which changes no title, skips it.
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-extractednpm package, and their installers each installed the whole package into a folder of their own,~/.lsp4ij/lsp/vscode-css-language-serverand~/.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 installwould 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 checkTrying current commandof 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 fromServerInstallerBase.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:
ExecTaskTestruns 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.aTemplateStartsItsLanguageServerWhereItsInstallerPutsItnow also checks that the CSS and ESLint templates start the language server where their installers put it, the command of annpm installincluded. It fails with the CSS template on its old folder. With #2054 merged, itsBundledTemplateCommandsTest.anInstallerPutsItsServerInTheFolderOfItsTemplatelets 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).