Fix hover and qualified-symbol resolution for jdtls#139
Open
briiiqtt wants to merge 1 commit into
Open
Conversation
The Eclipse JDT language server (jdtls) behaves differently from the servers this project was built against, breaking hover and qualified (e.g. Foo.bar) definition/reference lookups. This reworks the affected tools to handle it while degrading safely for every other server. Hover: - Widen Hover.Contents to the spec union Or_Hover_contents so jdtls' deprecated MarkedString / []MarkedString shapes decode instead of collapsing to empty, and render all three shapes uniformly. - Advertise hover contentFormat [Markdown, PlainText] so servers prefer MarkupContent going forward. - Fix the empty-hover line fallback dropping text on a file's last line. Qualified-symbol resolution: - Add a workspace/symbol + textDocument/documentSymbol fallback that resolves Foo.bar style names, scoping members to their container type (handling hierarchical and flat symbols, nested/generic containers). - Pass server-provided names as args rather than into the format string to avoid %-verb injection; dedup members across results. Robustness: - Route URI->path through uriToPath, recovering the panic on non-file URIs (jdt://) so all tools degrade gracefully instead of crashing. - Unify the references error policy: skip per-file open errors but surface a hard references RPC failure only when nothing resolved. - Fix line-number padding width off-by-one. Adds unit tests for hover shapes, qualified resolution, container scoping, cross-result dedup, fallback wiring, and the line helpers.
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
The Eclipse JDT language server (jdtls) behaves differently from the servers this project was built against, which breaks hover and qualified (e.g.
Foo.bar) definition/reference lookups. This reworks the affected tools to handle jdtls while degrading safely for every other server.Hover
Hover.Contentsto the spec unionOr_Hover_contentsso jdtls' deprecatedMarkedString/[]MarkedStringshapes decode instead of collapsing to empty, and render all three shapes uniformly.contentFormat [Markdown, PlainText]so servers preferMarkupContentgoing forward.Qualified-symbol resolution
workspace/symbol+textDocument/documentSymbolfallback that resolvesFoo.barstyle names, scoping members to their container type (handling hierarchical and flat symbols, nested/generic containers).%-verb injection; dedup members across results.Robustness
uriToPath, recovering the panic on non-file URIs (jdt://) so all tools degrade gracefully instead of crashing.Tests
Adds unit tests for hover shapes, qualified resolution, container scoping, cross-result dedup, fallback wiring, and the line helpers.
🤖 Generated with Claude Code