-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSP: Signature Help #1841
Comments
What do you want exactly? Something like |
Yeah something like that. So I should probably extend
Just the arg index is fine. |
Yeah, the general idea being that all these maps are cached, and only updated/invalidated when individual methods are changed. Which is to say I think this would only work for methods, not functions (at the moment at least) |
Cool, I'll give that a shot. |
This is not quite as easy to implement as I thought. The main issue is that the whitespace and We could use There are other issues too. The parser is not as fault tolerant as I'd like. For example, more than one trailing comma results in the entire method call missing from the AST: $this->foo($foo,,); // Poof! Thus the argument positions won't be recorded and you'll get no signature help. Kind of a bummer, those are likely not easily fixable. |
Yeah, it's not the best, but it wouldn't be too hard to add some functionality that detects comments - I have this code block that could probably be extracted and reused.
I've ticketed that here: nikic/PHP-Parser#616, but I'm not sure it's a blocker - I think the usability benefit of this massively outweighs the edge-case annoyance. |
In that case I think I'll just use
Thanks! |
I've been investigating on how to implement the
SignatureHelp
API. Can you give me a few pointers? It's pretty similar toHover
. The main challenge is thatCodebase::getReferenceAtPosition
can't be used because it only records the position of the identifier (excluding the parentheses). Furthermore we need to not only know which method is being called but also at what parameter the cursor is at.The text was updated successfully, but these errors were encountered: