Skip to content

fix: an exported language server keeps the transports of its template - #2131

Merged
lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/export-the-transports-of-a-template
Nov 23, 2026
Merged

lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/export-the-transports-of-a-template

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Part of #1947.

What

A language server keeps only its own transport, not the transports that its template lists. Its export wrote socket but never transports, so a language server created from the export allowed every transport again. The template's hint and warning were gone: since #2087, the TypeScript template gives "The template says this language server talks LSP only over its standard input and output" when Socket is chosen. So was the argument that a change of the transport swaps in the command (#1969).

Change

  • The export writes the transports of the template that the language server was created from (LanguageServerDefinitionSerializer). The template is found as the settings page finds it since feat: Improve LemMinX template with installer and auto-update command on #1962: by the server's template id, among the bundled templates. Each entry has its mode, and its argument when the template has one, as the template has them; an empty one is kept, as in cpp_ls's stdio.
  • No transports, as before, for a language server without a template, one created from a custom template (an imported template has no id), or one whose template LSP4IJ no longer bundles.
  • Import is unchanged: "Import template..." already reads transports as it does for a bundled template, so the New Language Server dialog gives the import the template's hint, warning and argument swap.
  • A socket from a stdio-only template: a language server over a socket, created from a template whose transports list only stdio, exports both. Its import also lists fix: small template and installer bugs from #1959, #1960, #1961 and #1947 #1981's "The socket mode startAndAccept of the template isn't one of its transports" next to the Socket warning. Both are warnings, so OK stays enabled.
  • Unchanged: the definition and its settings (nothing new is persisted), the template format, the settings page, and how a language server starts.
  • Still open: a language server created from an imported export has no template id, so its settings page has no hint or warning, and its own export has no transports, as for any custom template. That would need transports in the settings, which this leaves out.
  • Docs: the export section of UserDefinedLanguageServer.md; the id field, and the Transports and Socket and transports sections of UserDefinedLanguageServerTemplate.md.

Behaviour change

An exported language server created from a bundled template now includes that template's transports, so a language server created from the export gets the same transport hint, warning and command-argument swap as the template.

Exported language server Before After
From the TypeScript template (stdio only) No transports: the import allows every transport, without a hint [stdio --stdio]: the stdio-only hint, and the warning when Socket is chosen
From the CSS template (stdio, startAndAccept) No transports: no socket hint, no argument swap Both: the socket hint names --socket=${port}, and Socket swaps --stdio for it
Over a socket, from the TypeScript template socket only socket and transports: Socket stays chosen, with the Socket warning and "The socket mode … isn't one of its transports"
Without a template, from a custom template, or whose template is gone No transports No transports

Backward compatibility

  • Settings: unchanged; nothing new is persisted.
  • Export format: transports has the shape that bundled templates have used since 0.30.0 (mode, optional argument).
  • An older LSP4IJ importing a new export:
  • A new LSP4IJ importing an old export: no transports, as before.

Test

  • NewLanguageServerDialogTransportTest exports a language server with exportLsTemplates, unzips it, imports it with importServerTemplate, and loads it in the New Language Server dialog:
    • from the TypeScript template: [stdio --stdio], no template problem, the stdio-only hint, Socket enabled, and choosing it gives the warning on the Socket button and below the fields, with OK enabled;
    • from the CSS template: both transports, the socket hint with --socket=${port}, and Socket swaps --stdio for it;
    • over a socket, from the TypeScript template: the socket and transports are kept, the socket mode that isn't listed is reported, and the dialog shows the Socket warning; every warning keeps OK enabled;
    • without a template, and with a template id that LSP4IJ doesn't have: no transports in template.json, and no hint or warning.
  • LanguageServerSocketTemplateTest: for every bundled template with transports, the exported transports equal the template's JSON, and read back to the same list.
  • Without the serializer change, the 4 new behaviour tests fail. The 2 no-template tests pass either way, as they check what stays the same.
  • The template, export, import and transport tests (11 classes, 103 tests) pass on IC 2024.2, IC 2025.3 and IU 2026.3. The full suite passes on IC 2024.2: 1952 tests, 0 failures, 7 skipped (the Windows-only, Docker Bake and Perl tests).

Part of redhat-developer#1947.

A language server keeps only its own transport, not the transports which
its template lists, so its export wrote no `transports`. A language server
created from the export allowed every transport again, without the hint or
the warning of the template: the TypeScript template's "talks LSP only over
its standard input and output", or the argument which a change of the
transport swaps in the command.

The export now writes the `transports` of the template the language server
was created from, found as its settings find it: by its id among the bundled
templates. They're written as the template has them, with each `mode` and
`argument`, so "Import template..." reads them as it reads those of a
bundled template. A language server without a template, created from a
custom template, or whose template LSP4IJ no longer bundles, exports no
`transports`, as before.

A language server over a socket from a template which lists only stdio
exports both its `socket` and the template's `transports`, so an import of
it also reports "The socket mode ... of the template isn't one of its
transports".

Nothing is added to the settings: an older LSP4IJ ignores `transports`
(before 0.30.0), or reads it as it reads a bundled template's (0.30.0 and
0.30.1, which lock Socket for a template which lists only stdio).
@lagergren lagergren added this to the 0.30.2 milestone Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features

    • Exports from bundled language server templates now include the template’s supported transports.
    • When imported, transport information is reflected in the dialog’s hints and warnings, including when a socket mode is not listed as supported by the template.
    • Exports from custom templates or templates without available transport information omit the transport list.
  • Documentation

    • Clarified how template transport information appears in exports and affects imported language server configurations.

Exports now include the supported transports of a matching bundled template. Tests cover serialized transport metadata and its effects when imported, including cases with no matching template.

Changes: Template transport metadata

Layer / File(s) Summary
Serialize bundled template transports
src/main/java/com/redhat/devtools/lsp4ij/launching/templates/LanguageServerDefinitionSerializer.java, src/test/java/com/redhat/devtools/lsp4ij/launching/templates/LanguageServerSocketTemplateTest.java, docs/UserDefinedLanguageServer.md, docs/UserDefinedLanguageServerTemplate.md
The serializer adds supported transports from a matching bundled template to exported JSON. Tests compare exported metadata with bundled templates. The documentation describes transport metadata in exports and the behavior when imported.
Verify transport metadata after import
src/test/java/com/redhat/devtools/lsp4ij/launching/ui/NewLanguageServerDialogTransportTest.java
Tests cover reimported transport labels, hints, commands, and warnings. They also check exports with no matching bundled template.

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

Change: Bug fix

Suggested reviewers: muescha

Merge Risk: Minimal · up to 54b20

Exports from bundled-template servers now keep the template's transport hints and warnings when reimported. Servers without a matching template export as before. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title 'fix: an exported language server keeps the transports of its template' matches the main change: the export now writes the template's transports list (serializer change, tests, and docs). …
Description check Passed The description explains the problem (exports lost the template's transports, so hints, warnings and argument swap were lost), the change in LanguageServerDefinitionSerializer, the behaviour change ta…
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 'fix: an exported language server keeps the transports of its template' matches the main change: the export now writes the template's transports list (serializer change, tests, and docs). It is specific and concise, and it describes the primary behavior change.

Full details: Description check

Explanation

The description explains the problem (exports lost the template's transports, so hints, warnings and argument swap were lost), the change in LanguageServerDefinitionSerializer, the behaviour change table, backward compatibility, and the tests. It is directly related 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: 6fc06f59-bdb8-428f-9f45-588edb0d72af
Commits

Reviewing files that changed from the base of the PR and between 88386f1 and 54b20b7.

Files selected for processing: 5

  • docs/UserDefinedLanguageServer.md
  • docs/UserDefinedLanguageServerTemplate.md
  • src/main/java/com/redhat/devtools/lsp4ij/launching/templates/LanguageServerDefinitionSerializer.java
  • src/test/java/com/redhat/devtools/lsp4ij/launching/templates/LanguageServerSocketTemplateTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/launching/ui/NewLanguageServerDialogTransportTest.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 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.09%. Comparing base (88386f1) to head (54b20b7).

Files with missing lines Patch % Lines
.../templates/LanguageServerDefinitionSerializer.java 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2131      +/-   ##
==========================================
+ Coverage   52.90%   53.09%   +0.19%     
==========================================
  Files         826      826              
  Lines       34600    34616      +16     
  Branches     7111     7116       +5     
==========================================
+ Hits        18305    18381      +76     
+ Misses      13536    13473      -63     
- Partials     2759     2762       +3     

☔ 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 23, 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 2abaa4a into redhat-developer:main Nov 23, 2026
9 checks passed
lagergren added a commit that referenced this pull request Nov 23, 2026
…nd in installers (#2136)

Follow-up to #2102 and #2094. #2094 documented three things as they were before #2102, which changed them:

| Docs said | Since #2102 | Where |
|---|---|---|
| The New Language Server dialog "doesn't apply" a template's `workingDir` or its `workspaceFolderSettings.json` yet | It gives the language server that it creates the working directory and the workspace folders of the template, also of an imported one (b0206f2) | `UserDefinedLanguageServerTemplate.md`: the `workingDir` field and the template's files; `UserDefinedLanguageServer.md`: export; `DeveloperGuide.md`: workspace folders of a user-defined language server |
| LSP4IJ keeps the first check as done "also when it failed" | An installation which failed, or whose `run` failed, isn't kept: the first start in the next IDE session checks again, and installs the server if the check fails. One that the user cancelled is kept (d245403) | `UserDefinedLanguageServerTemplate.md`: when the installer runs |
| A `showMessage` task with actions waits until the user clicks one | It also ends when its notification is closed, and then fails (d4d9fd6) | `UserDefinedLanguageServerTemplate.md`: Task showMessage |

Each was checked against `main`'s code: `NewLanguageServerDialog.loadFromTemplate`, `UserDefinedLanguageServerInstaller.initialize` and `ShowMessageTask`.

Docs only, one commit on today's `main`. #2131, now merged, rewrote the same export paragraph of `UserDefinedLanguageServer.md`; this keeps its text and changes only the sentence about the `workingDir`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant