Skip to content

feat: Add live validation to language server settings - #2339

Merged
lagergren merged 2 commits into
redhat-developer:mainfrom
sohamsakhare76-ai:fix/2009-live-settings-validation
Nov 30, 2026
Merged

lagergren merged 2 commits into
redhat-developer:mainfrom
sohamsakhare76-ai:fix/2009-live-settings-validation

Conversation

@sohamsakhare76-ai

Copy link
Copy Markdown
Contributor

Summary

Implements live field-level validation on the Language Server settings page (#2009).

Changes

  • Added live validation using IntelliJ's ComponentValidator.
  • Reused LanguageServerPanel.validateFields() to display errors and warnings while editing.
  • Added change listeners for command-line, environment variables, transport fields, and workspace folder configuration.
  • Clear validation feedback when fields are corrected or settings are reset.
  • Preserve existing Apply behavior: errors prevent applying, while warnings do not.

Tests

  • Added LanguageServerViewValidationTest with 7 tests.
  • Added host-field change listener coverage in TransportFieldsTest.
  • Settings and launching test suites: 185 tests passed.

Fixes #2009

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Validation feedback in language server settings updates as you edit command lines, transport details, environment variables, and workspace-folder configuration.
    • Errors and warnings appear alongside relevant fields, with errors taking precedence when both apply.
    • Resetting settings clears validation messages for unsaved changes. Warnings remain visible but do not prevent applying settings.

Settings-page validation now updates field outlines and messages as relevant settings change. The view refreshes validation after reset and clears stale validation. Apply continues to use the existing validation behavior.

Changes: Live settings validation

Layer / File(s) Summary
Validation change notifications
src/main/java/com/redhat/devtools/lsp4ij/settings/ui/LanguageServerPanel.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/TransportFields.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/WorkspaceFoldersPanel.java, src/test/java/com/redhat/devtools/lsp4ij/settings/ui/TransportFieldsTest.java
Relevant edits to server settings, transport fields, environment variables, and workspace-folder configuration notify validation listeners. A test checks that editing the socket host does not notify change listeners.
Component validation and refresh
src/main/java/com/redhat/devtools/lsp4ij/settings/LanguageServerView.java, src/test/java/com/redhat/devtools/lsp4ij/settings/LanguageServerViewValidationTest.java
The view installs, updates, and clears field validators when validation changes. It refreshes after reset and skips updates during reset or after disposal. Tests cover errors, warnings, field edits, and reset behavior.

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

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant LanguageServerPanel
  participant LanguageServerView
  participant ComponentValidator
  User->>LanguageServerPanel: Edit a validation-relevant setting
  LanguageServerPanel->>LanguageServerView: Notify validation listener
  LanguageServerView->>LanguageServerPanel: Read problems with validateFields()
  LanguageServerView->>ComponentValidator: Install, update, or clear field validation
Loading

Suggested reviewers: lagergren, angelozerr

Merge Risk: Minimal · up to ec2f0

This change adds live field validation to the Language Server settings page and leaves Apply behavior unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat: Add live validation to language server settings" matches the main change. The changeset adds field-level live validation to the Language Server settings view, using ComponentValidator…
Description check Passed The description states the purpose (live field-level validation on the Language Server settings page), lists the changes (ComponentValidator, validateFields reuse, change listeners, clearing on reset,…
Linked Issues check Passed Issue #2009 requires the settings page to outline fields with problems while the user types, through ComponentValidator, including warnings, and requires Apply to keep listing errors. At the reviewed …
Out of Scope Changes check Passed All changed files support live validation on the settings page: LanguageServerView (validator installation and refresh), LanguageServerPanel (validation-change listeners), TransportFields (host access…
Full details: Title check

Explanation

The title "feat: Add live validation to language server settings" matches the main change. The changeset adds field-level live validation to the Language Server settings view, using ComponentValidator and LanguageServerPanel.validateFields(), with change listeners on the relevant fields.

Full details: Description check

Explanation

The description states the purpose (live field-level validation on the Language Server settings page), lists the changes (ComponentValidator, validateFields reuse, change listeners, clearing on reset, Apply behavior for errors and warnings), and lists the tests. All of these match the raw summary.

Full details: Linked Issues check

Explanation

Issue #2009 requires the settings page to outline fields with problems while the user types, through ComponentValidator, including warnings, and requires Apply to keep listing errors. At the reviewed head, LanguageServerView builds validation from LanguageServerPanel.validateFields(), prefers an error over a warning on the same component, and installs or updates component validators. LanguageServerPanel.addValidationListener() refreshes validation on command-line, environment-variable, transport, host, and workspace-folder edits. reset() suppresses validation during repopulation and then refreshes it. TransportFields.getHostField() exposes the host field for the host listener. The incremental commit ec2f003 ('avoid rewriting command when editing socket host') adjusts host-edit behavior within this same feature. Its text diff could not be read because changed blobs are missing from the checkout, so its exact code is not verified. The commit title and the TransportFieldsTest and LanguageServerViewValidationTest coverage described in the summary are consistent with the requirement. The author reports 185 passing tests; these were not re-run. The Apply path was not read directly; its behavior rests on the PR description and the named test.

Full details: Out of Scope Changes check

Explanation

All changed files support live validation on the settings page: LanguageServerView (validator installation and refresh), LanguageServerPanel (validation-change listeners), TransportFields (host accessor and change notification), WorkspaceFoldersPanel (configuration listener), and the tests LanguageServerViewValidationTest and TransportFieldsTest. The incremental commit ec2f003 changes host-edit behavior (no command-line rewrite) on the same page, and it is covered by a test of the same name in LanguageServerViewValidationTest and by TransportFieldsTest. That connection is concrete. The incremental text diff was unreadable (changed blobs missing), so the exact content of that commit is not independently verified. No unrelated behavior change was identified in the available evidence.

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: 2b5b0390-d453-47c2-8236-b545b466d7dd
Commits

Reviewing files that changed from the base of the PR and between 90a5e7c and ec2f003.

Files selected for processing: 4

  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/LanguageServerPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/TransportFields.java
  • src/test/java/com/redhat/devtools/lsp4ij/settings/LanguageServerViewValidationTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/settings/ui/TransportFieldsTest.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 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.50980% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.88%. Comparing base (0fd429a) to head (ec2f003).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...t/devtools/lsp4ij/settings/LanguageServerView.java 72.41% 7 Missing and 1 partial ⚠️
...vtools/lsp4ij/settings/ui/LanguageServerPanel.java 81.25% 3 Missing ⚠️
...ools/lsp4ij/settings/ui/WorkspaceFoldersPanel.java 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2339      +/-   ##
==========================================
+ Coverage   58.63%   58.88%   +0.25%     
==========================================
  Files         849      849              
  Lines       36718    36770      +52     
  Branches     5769     5772       +3     
==========================================
+ Hits        21529    21653     +124     
+ Misses      12187    12115      -72     
  Partials     3002     3002              

☔ 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 lagergren added this to the 0.30.3 milestone Nov 28, 2026
@lagergren
lagergren merged commit 39e2f7b into redhat-developer:main Nov 30, 2026
11 checks passed
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.

Settings page: show a language server's problems on its fields while typing, as the New Language Server dialog does

2 participants