Skip to content

fix(settings): expose LSP inlay hints in Settings > Editor > Inlay Hints - #1808

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:fix/inlay-hints-settings-1800
Nov 1, 2026
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:fix/inlay-hints-settings-1800

Conversation

@angelozerr

@angelozerr angelozerr commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1800

This PR provides settings (per language):

  • Language Server Hints
  • Language Server Colors
image

IntelliJ's DeclarativeHintsSettingsProvider only reads providers registered
via the direct codeInsight.declarativeInlayProvider EP, not those from factories. Since lsp4ij registers providers dynamically via a factory (languages are not known at compile time), the "Language Server" provider
did not appear in Settings > Editor > Inlay Hints, making it impossible to re-enable after disabling via the editor context menu.

  • Add LSPInlayHintsSettingsProvider (InlaySettingsProvider) to bridge factory-registered declarative providers into the settings panel
  • Use per-language provider IDs so disabling hints for one language does not affect others
  • Move getName() from AbstractLSPInlayHintsProvider to LSPColorProvider for proper separation of concerns
  • Rename entries to "Language Server Hints" and "Language Server Colors" to clearly distinguish the two providers in settings

(redhat-developer#1800)

IntelliJ's DeclarativeHintsSettingsProvider only reads providers
registered
via the direct codeInsight.declarativeInlayProvider EP, not those from
factories. Since lsp4ij registers providers dynamically via a factory
(languages are not known at compile time), the "Language Server"
provider
did not appear in Settings > Editor > Inlay Hints, making it impossible
to re-enable after disabling via the editor context menu.

- Add LSPInlayHintsSettingsProvider (InlaySettingsProvider) to bridge
  factory-registered declarative providers into the settings panel
- Use per-language provider IDs so disabling hints for one language
  does not affect others
- Move getName() from AbstractLSPInlayHintsProvider to LSPColorProvider
  for proper separation of concerns
- Rename entries to "Language Server Hints" and "Language Server Colors"
  to clearly distinguish the two providers in settings

Signed-off-by: azerr <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Summary

Summary by CodeRabbit

  • New Features
    • Language server inlay hints are now available in the IDE’s inlay-hint settings, where they can be enabled or disabled for supported languages.
    • Language server color providers now have a clear, localized name.
  • Bug Fixes
    • Inlay hints from different languages are now identified separately, helping prevent provider conflicts.
  • Style
    • Updated and localized the inlay-hint provider label for clarity.

The change gives each language’s declarative inlay-hint provider a distinct ID and adds settings models for registered providers. It also adds localized names for the inlay-hint and color providers.

Changes: Declarative inlay-hint settings

Layer / File(s) Summary
Language-specific provider IDs
src/main/java/com/redhat/devtools/lsp4ij/features/inlayhint/LSPInlayHintsProvider.java, src/main/java/com/redhat/devtools/lsp4ij/LanguageServersRegistry.java
The provider ID now combines a prefix with the language ID. The registry uses the resulting ID for each language.
Settings and localized provider names
src/main/java/com/redhat/devtools/lsp4ij/features/inlayhint/LSPInlayHintsSettingsProvider.java, src/main/resources/META-INF/plugin.xml, src/main/java/com/redhat/devtools/lsp4ij/features/AbstractLSPInlayHintsProvider.java, src/main/java/com/redhat/devtools/lsp4ij/features/color/LSPColorProvider.java, src/main/resources/messages/LanguageServerBundle.properties, src/main/resources/messages/LanguageServerBundle_zh_CN.properties
The new settings provider exposes registered declarative providers and saves, detects changes to, and restores their enabled state. The plugin registers the settings provider. Inlay-hint and color provider names use localized labels.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: falsepattern, lin-qingying

Merge Risk: Minimal · up to e08d1

The change exposes language-specific inlay-hint settings. No merge-blocking failure is confirmed; refreshing open editors and preserving previously disabled settings remain unverified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes exposing LSP inlay hints in IntelliJ settings, which is the main change.
Description check Passed The description directly explains the settings integration, per-language provider IDs, naming changes, and the issue being fixed.
Linked Issues check Passed Issue #1800 requires a UI path to re-enable disabled Language Server inlay hints. LSPInlayHintsSettingsProvider is registered as an IntelliJ inlay settings provider. It discovers mapped languages, c…
Out of Scope Changes check Passed The changes stay within issue #1800. The per-language provider IDs support independent settings. Moving getName() to LSPColorProvider and renaming the hints and color labels distinguish the two se…
Full details: Linked Issues check

Explanation

Issue #1800 requires a UI path to re-enable disabled Language Server inlay hints. LSPInlayHintsSettingsProvider is registered as an IntelliJ inlay settings provider. It discovers mapped languages, creates a model for each language, reads the stored enabled state, and persists changes through DeclarativeInlayHintsSettings. LanguageServersRegistry now assigns a provider ID per language. This exposes the provider in Settings > Editor > Inlay Hints and prevents one language setting from controlling another. The implementation also provides the requested labels.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #1800. The per-language provider IDs support independent settings. Moving getName() to LSPColorProvider and renaming the hints and color labels distinguish the two settings entries created by this fix. The plugin registration and localization changes support the settings UI.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 2
src/main/java/com/redhat/devtools/lsp4ij/features/inlayhint/LSPInlayHintsSettingsProvider.java-116-121: 1

116-121: Minor · Potential issue · Quick win

Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.

apply() persists the checkbox state but does not explicitly request an inlay-hint refresh; the new settings UI may therefore fail to restore hints in editors that are already open.

The checkbox shows enabled, but hints remain absent until another action causes the editor to recompute them.

This can occur when: A user re-enables a disabled language's hints in Settings while a file of that language remains open and unchanged.

src/main/java/com/redhat/devtools/lsp4ij/LanguageServersRegistry.java-412-412: 1

412-412: Minor · Potential issue · Heavy lift

Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.

Registration replaces the former shared provider ID with language-specific IDs without a supplied migration for enabled-state values stored under the old ID.

LSP hints may reappear after the upgrade despite the user's disabled setting.

This can occur when: A user upgrades after disabling LSP hints through the context menu, leaving false stored for the former shared provider ID.


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: 2deb5482-a0bc-467a-ab08-c518161edaa4
Commits

Reviewing files that changed from the base of the PR and between 3c3b277 and e08d14f.

Files selected for processing: 8
  • src/main/java/com/redhat/devtools/lsp4ij/LanguageServersRegistry.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/AbstractLSPInlayHintsProvider.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/color/LSPColorProvider.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/inlayhint/LSPInlayHintsProvider.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/inlayhint/LSPInlayHintsSettingsProvider.java
  • src/main/resources/META-INF/plugin.xml
  • src/main/resources/messages/LanguageServerBundle.properties
  • src/main/resources/messages/LanguageServerBundle_zh_CN.properties

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 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 4.65116% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.67%. Comparing base (3c3b277) to head (e08d14f).

Files with missing lines Patch % Lines
...tures/inlayhint/LSPInlayHintsSettingsProvider.java 0.00% 40 Missing ⚠️
...vtools/lsp4ij/features/color/LSPColorProvider.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1808      +/-   ##
==========================================
- Coverage   37.69%   37.67%   -0.02%     
==========================================
  Files         785      786       +1     
  Lines       29978    30019      +41     
  Branches     4542     4546       +4     
==========================================
+ Hits        11299    11311      +12     
- Misses      16727    16754      +27     
- Partials     1952     1954       +2     

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

@angelozerr
angelozerr merged commit fa7629a into redhat-developer:main Nov 1, 2026
9 checks passed
@lagergren lagergren added this to the 0.30.0 milestone Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can "Disable 'Language Server' Inlay Hints" be re-enabled through the UI?

2 participants