Fix PHP symbol retrieval: declare missing Intelephense client capabilities#1099
Open
EarthmanWeb wants to merge 1 commit intooraios:mainfrom
Open
Fix PHP symbol retrieval: declare missing Intelephense client capabilities#1099EarthmanWeb wants to merge 1 commit intooraios:mainfrom
EarthmanWeb wants to merge 1 commit intooraios:mainfrom
Conversation
Two related fixes: 1. intelephense.py: Add missing client capability declarations for documentSymbol (with hierarchical support), references, hover, and workspace symbol. Without these, Intelephense does not advertise documentSymbolProvider and returns empty results for get_symbols_overview. 2. symbol.py (LanguageServerSymbolRetriever.find_symbols): When searching within a specific file, route to the file-type-appropriate language server via get_language_server() instead of querying all servers. This ensures PHP files are served by Intelephense and not silently skipped.
opcode81
reviewed
Mar 1, 2026
| @@ -0,0 +1,665 @@ | |||
| <?php | |||
Contributor
There was a problem hiding this comment.
If it shall provide the basis for tests (which it probably should), please move this the PHP test repository.
If it shall not provide the basis for tests, delete it.
opcode81
requested changes
Mar 1, 2026
Contributor
opcode81
left a comment
There was a problem hiding this comment.
Tests should be added which validate that the changes result in the improvements described.
In particular, we should explicitly inspect the hierarchical structure in tests.
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.
Problem
Intelephense's LSP server conditionally enables certain features based
on what the client declares it supports in the
initializerequest.Serena's Intelephense client was missing several capability declarations:
textDocument.documentSymbol(withhierarchicalDocumentSymbolSupport)textDocument.referencestextDocument.hoverworkspace.symbolWithout
hierarchicalDocumentSymbolSupport: true, Intelephense fallsback to returning flat
SymbolInformation[]instead of the nestedDocumentSymbol[]tree. This means symbol retrieval works partiallyor not at all — classes and their methods appear as disconnected
root-level symbols with no parent-child relationship.
Additionally, when
find_symbolis called with a specific PHP filepath, it iterated all language servers rather than routing to the
correct one, causing PHP files to be rejected by non-PHP servers.
Fix
intelephense.py: Added missing client capability declarationsfor
documentSymbol(with fullhierarchicalDocumentSymbolSupportand
symbolKindrange),references,hover, and workspacesymbol. Also added assertion that the server confirmsdocumentSymbolProvidersupport after initialization.symbol.py: Whenfind_symbolsis called with a specific filepath, route to the appropriate language server via
get_language_server()instead of iterating all servers.Example
Before:
After: