Skip to content

fix: install the CSS and ESLint language servers into one copy of their npm package - #2052

Merged
lagergren merged 7 commits into
redhat-developer:mainfrom
lagergren:fix/share-vscode-langservers-extracted
Nov 21, 2026
Merged

lagergren merged 7 commits into
redhat-developer:mainfrom
lagergren:fix/share-vscode-langservers-extracted

Conversation

@lagergren

@lagergren lagergren commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

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

…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.
@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
    • CSS and ESLint language-server setup now uses the shared vscode-langservers-extracted package, with updated default command locations and installation guidance.
  • Bug Fixes
    • Installer commands targeting the same directory now run one at a time, including across IDE instances, reducing conflicts during concurrent installations.
    • After waiting for another installation, the installer checks whether the server is already available before running its command. Forced installations still run as requested.

ExecTask serializes commands that use the same normalized working directory and can recheck installation after waiting. CSS and ESLint language-server templates now use the shared vscode-langservers-extracted package. CSS documentation and installer-location tests reflect the updated paths.

Changes: Installer Coordination and Language-Server Templates

Layer / File(s) Summary
Post-wait installation checks
src/main/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerContext.java, src/main/java/com/redhat/devtools/lsp4ij/installation/ServerInstallerBase.java, src/main/java/com/redhat/devtools/lsp4ij/installation/DeclarativeLanguageServerInstaller.java, src/main/java/com/redhat/devtools/lsp4ij/dap/installation/DeclarativeDebugAdapterServerInstaller.java
InstallerContext adds a flag for checking again after waiting. ServerInstallerBase tracks installs that follow a failed check. Language-server and debug-adapter installers set the flag for those installs.
Working-directory command coordination
src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/ExecTask.java, src/test/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/*
ExecTask serializes commands that use the same normalized working directory. If a task waited and its post-wait check succeeds, it skips the command. Tests cover concurrent installers in one process and across IDE processes, including forced installs.
Shared npm package paths
src/main/resources/templates/lsp/vscode-css-language-server/*, src/main/resources/templates/lsp/vscode-eslint-language-server/*, docs/user-defined-ls/vscode-css-language-server.md, src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
The CSS and ESLint installer working directories and launch commands now use vscode-langservers-extracted. CSS setup documentation and installer-location tests reflect the updated package paths and install command.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ExecTask
  participant WorkingDirectoryLock
  participant InstallerCheck
  participant Command
  ExecTask->>WorkingDirectoryLock: acquire lock for normalized working directory
  WorkingDirectoryLock-->>ExecTask: report whether acquisition waited
  opt Task waited and post-wait check is enabled
    ExecTask->>InstallerCheck: check whether server is installed
    InstallerCheck-->>ExecTask: return check result
  end
  opt Check does not succeed or no post-wait check applies
    ExecTask->>Command: execute command
  end
  ExecTask->>WorkingDirectoryLock: release lock
Loading

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to e6580

This change makes the CSS and ESLint language servers share one install folder and serializes installers that use the same directory. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the CSS and ESLint language servers are installed into one shared copy of their npm package. The raw summary confirms the shared folder change in templates and install…
Description check Passed The description is closely related to the changeset. It explains the shared vscode-langservers-extracted folder, the per-directory ExecTask lock and cross-IDE lock file, the recheck-after-waiting beha…
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: the CSS and ESLint language servers are installed into one shared copy of their npm package. The raw summary confirms the shared folder change in templates and installers, and the exec-task locking that supports it. The title is specific and matches the changeset. It is a 'fix:' prefix, which fits the stated goal of avoiding concurrent npm install breakage.

Full details: Description check

Explanation

The description is closely related to the changeset. It explains the shared vscode-langservers-extracted folder, the per-directory ExecTask lock and cross-IDE lock file, the recheck-after-waiting behavior, the docs and README path changes, and the tests added. It is detailed and on topic.

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: 01487e63-52e8-4773-8e88-9879eabb29eb
Commits

Reviewing files that changed from the base of the PR and between 466bdf3 and e6580ed.

Files selected for processing: 8

  • docs/user-defined-ls/vscode-css-language-server.md
  • src/main/java/com/redhat/devtools/lsp4ij/dap/installation/DeclarativeDebugAdapterServerInstaller.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/DeclarativeLanguageServerInstaller.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/ServerInstallerBase.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerContext.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/ExecTask.java
  • src/main/resources/templates/lsp/vscode-css-language-server/README.md
  • src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
Files skipped from review as they are similar to previous changes: 1

  • src/main/resources/templates/lsp/vscode-css-language-server/README.md

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

❌ Patch coverage is 44.73684% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.95%. Comparing base (bba340e) to head (e6580ed).

Files with missing lines Patch % Lines
...lsp4ij/installation/definition/tasks/ExecTask.java 47.76% 27 Missing and 8 partials ⚠️
...tools/lsp4ij/installation/ServerInstallerBase.java 0.00% 4 Missing ⚠️
...lation/DeclarativeDebugAdapterServerInstaller.java 0.00% 1 Missing ⚠️
...stallation/DeclarativeLanguageServerInstaller.java 0.00% 1 Missing ⚠️
...p4ij/installation/definition/InstallerContext.java 66.66% 1 Missing ⚠️
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.
📢 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.

…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
@muescha

muescha commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

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 installer that waits still installs again. With a CSS and a JS file opened together, both checks fail, since nothing is installed yet; CSS runs npm install, ESLint waits for the lock, and then runs a second npm install vscode-langservers-extracted --force into the same folder, downloading the package again and overwriting the files the CSS language server already runs from. It probably doesn't break anything, but it isn't needed. Running the check again once the lock is taken would skip it. (Reinstall of one of them does the same to the other, which is expected when they share the folder.)
  • The lock is per IDE process: WORKING_DIR_LOCKS is static, while two IDEs with LSP4IJ, e.g. IntelliJ IDEA and WebStorm, share ~/.lsp4ij. That was already the case for the same language server before, but now it's also CSS against ESLint. A file lock (FileChannel.lock()) on a file in the working directory would cover both, if it's worth it.

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.

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

…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.
@lagergren

Copy link
Copy Markdown
Collaborator Author

Thanks, both are in 466bdf3:

  • The installer that waits no longer installs again. An installation which runs because the check found the server not installed, and which had to wait for another one in its working directory, runs the check again once it gets the lock, and skips its command if the check then passes. A forced installation, as by Reinstall, still runs its command, since it may have waited for an installation of something else in the same folder.
  • The lock now also covers other IDEs. Besides the lock per directory in the IDE, an exec task locks a file for its working directory in $USER_HOME$/.lsp4ij/locks, with FileChannel.tryLock(). If the file can't be opened or locked, as on a file system without file locks, it goes on as before. The lock file is in ~/.lsp4ij/locks rather than the working directory, so that nothing is added to a node_modules or a project folder.

ExecTaskTest has a test for each: one with an installation that waits while another one installs the server, and one where another JVM holds the lock file. Both fail without the change.

The docs text from #2051 is in here too (e167e67).

…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.
@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 36bc568 into redhat-developer:main Nov 21, 2026
9 of 10 checks passed
lagergren added a commit that referenced this pull request Nov 21, 2026
…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.
@lagergren lagergren added bug Something isn't working install template-ls labels Nov 22, 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 install template-ls

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants