-
Notifications
You must be signed in to change notification settings - Fork 14
Show inlay hints for php attributes (maybe as option) #383
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
Comments
Thank you for the suggestion! I'll enable inlay parameter hints for attributes. A separate setting makes sense as well. |
The pre-release Please feel free to try it, and thank you for your suggestions! |
Thanks. It often is not working right for me. Some files it doesn't work at all. One file it will work until I scroll down far enough and then it turns off. So I will literally scroll down one tiny bit more with the mouse wheel, and then all the places it was showing the inlay hints before suddenly turn off. If I scroll up, they turn back on again. There isn't anything different that I can see about the attributes that scroll into view when it turns off. I'm trying to come up with a good reproduce, but it's hard. |
thank you, I'll try to repro the issue. |
I found a different example where the inlay hints are not completely working even when they are not randomly turning off and on. When attributing, you are allowed to instantiate new objects (something I make heavy use of). When you do this, it is not showing hints for the constructor arguments. Here is an example:
In that example, it is not showing a hint for the |
Thank you, got it. Pre-release |
This is working. The problem with the hints turning on and off is still present. I will see if I can come up with a good reproduce for you. |
I think I figured it out. If some of the attributing does not use parenthesis, the hints stop working.
In this example, AttributeB is backed by a class with a constructor with parameters that all have default value. In this case, |
Thank you, it seems there was an internal exception when handling attributes without the parenthesis. |
Works great! |
awesome! thank you very much for testing it and for your feedback |
PHP 8.0 added official support for attributes. In that link you can see some examples where you are actually passing parameters into a constructor while...attributing. I created a framework I am using that makes heavy use of attributes and it can get pretty gnarly. It would be nice if the inlay hints worked for these parameter names. I'm not sure, but it might be even better as a separate setting. Some people may want inlay hints in other places but not in the attributes. Or maybe I'm over thinking it and they should show up here if inlay hints are enabled.
Here is an example of me attributing a method where inlay hints may be helpful. I put the tests directly above the method they are testing as attributes:
The text was updated successfully, but these errors were encountered: