fix: dynamically register jdtls capabilities to avoid blocking diagnostics#44
Merged
aviadshiber merged 2 commits intomainfrom Apr 10, 2026
Merged
fix: dynamically register jdtls capabilities to avoid blocking diagnostics#44aviadshiber merged 2 commits intomainfrom
aviadshiber merged 2 commits intomainfrom
Conversation
…stics Previously, hover/definition/references/completion/documentSymbol were advertised in the static InitializeResult even before jdtls started. This caused the IDE to defer hover to us, and when jdtls wasn't ready (or returned null), diagnostic tooltips were suppressed. Now these capabilities are only registered via client/registerCapability AFTER jdtls initializes successfully. The handlers are also registered at that point via server.feature() instead of module-level decorators, since pygls auto-advertises capabilities for decorated handlers. Result: diagnostic tooltips show immediately (our custom rules), and jdtls features activate only when jdtls is actually ready. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ertions - Add _jdtls_capabilities_registered flag to prevent FeatureAlreadyRegisteredError on double invocation (critical finding) - Move server.feature() calls inside try/except to prevent capability mismatch when client_register_capability_async fails (high finding) - Use _JDTLS_HANDLERS dict to collect handlers, iterated during registration - Extract _JDTLS_REG_PREFIX constant for registration IDs - Fix test_register_jdtls_capabilities_logs_on_failure: patch server.feature and reset _jdtls_capabilities_registered to avoid singleton mutation - Add test_register_jdtls_capabilities_happy_path: verifies handlers are registered and success log is emitted - Add test_register_jdtls_capabilities_idempotent: verifies second call is no-op - Strengthen test_build_jdtls_registrations: assert java language value, triggerCharacters for completion, id uniqueness and prefix - Add completion_provider/document_symbol_provider None assertions to integration test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes diagnostic tooltips being suppressed when jdtls isn't ready yet.
The Problem
The server statically advertised
hoverProvider: true,definitionProvider: true, etc in theInitializeResult— even before jdtls started. When IntelliJ sends a hover request and we returnnull(jdtls not ready), IntelliJ suppresses its built-in diagnostic tooltip entirely. Users saw no hint/warning messages on hover.The Fix
InitializeResultcapabilitiesclient/registerCapability— these are registered only AFTER jdtls initializes successfully@server.featuredecorators to runtimeserver.feature()calls inside_register_jdtls_capabilities(), because pygls auto-advertises capabilities for decorated handlersResult
Code Changes
_JDTLS_CAPABILITIEStable +_build_jdtls_registrations()helper to eliminate duplicate registration boilerplate🤖 Generated with Claude Code