Coder Social home page Coder Social logo

Comments (31)

robertgr991 avatar robertgr991 commented on July 28, 2024 1

@amaisano I will release a new version later with some changes made by @DominicVonk and the types will also be taken from the doc provided by the signature help provider.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024 1

Yes, can do both. It's not intentional, I think I missed a trim somewhere.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024 1

@amaisano I published a new version with these changes and some more. Let me know when you can update it to tell me how it works.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024 1

If you have other issues/suggestions, open a new issue, thanks.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Hello,

I think this can done with a toggle command so the regexp will also capture the type of parameters from the signature. I will take a look at this these days when I have some time.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Great! Can we make it optional?

  • Hints off
  • Parameter name only
  • parameter type only
  • Parameter name + type

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

@amaisano This was included in the last version. There is a new command CTRL + K T, you can toggle between 'disable' - show only name, 'type and name' and 'type', the hints off command it's still CTRL + K H and it takes priority over these.
Let me know how this works for you.

*I didn't test the regex for capturing the type as well very much, maybe you can test it on some of your files and give a feedback also so I can fix it.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Thanks! I tested. Please take a look at the below issues and screenshot. The hints you see are defined in __construct above.

  1. Not showing "string" for "id"
  2. Showing question mark for some param types before the classname
  3. Can we use the "short" name? Using the full namespace is too much space I think (most people would agree)
  4. Hovering on the {type name: } combo decoration should show a hover box. It does not. Just "name" however still shows hover.

image

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Thanks for the screenshot.

  1. Does the id param have the type explicitly set? Like the params in the constructor from your ss, because the extension uses signature help provider to extract the hints, which seems to not show the type if not explicitly set so maybe this is the cause.
  2. Don't really know right know what's with that random question mark, will look further.
  3. Agreed, I made a change that takes the short name, will push it tomorrow after I test it more.
  4. Can you provide a screenshot with this hover? Are you referring to the helper hover provided by intelephense extension? The hover still works for me as usual.

Nice theme btw

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024
  1. image
  2. It might be fore optional arguments (?AccountInterface means function (...AccountInterface = NULL)).
  3. Without a leading slash :)
  4. Nevermind - the hover I get is associated with the function/method call, not the decorator.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024
  1. The signature provider returns the exact signature of the function so any type set with phpdoc won't show there, to take the type from there I have to use the hover provider which right now is used as a fallback to the first one because it's slower, I might change it to use it when either type and name or type is ON in order to take the types from phpdoc. Is the string type also set in the method signature or only in phpdoc?
  2. I think you are right.
  3. Yes, only the type without any extra chars.

from php-parameter-hint.

DominicVonk avatar DominicVonk commented on July 28, 2024

Hi I refactored the way when using the executeSignatureHelpProvider, to also provide the right typings

#7

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Beautiful:

image

image

  1. string was only hinted in the phpDoc, so I understand it will not appear in the decoration. That's fine. Usually these are self explanatory, and I don't think it's worth slowing things down to use the phpDoc instead.

Thank you for your work!

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

@amaisano Last version is published, when you have some time, please tell me how does it work for you, thx.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Beautiful! So it's picking up from phpDoc now? The "string|array" is not in the function signature:

image

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Yes, if it's available, it's taking it from the doc.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

I thought there were performance concerns about using phpDoc. Don't get me wrong, I love the way it now works!

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

There are performance concers with the hover provider, but @DominicVonk pointed out that the signature provider also provides the doc for each parameter, so now it parses the doc provided by siganture provider which has the same performance as before.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Should we have an option to collapse the type and name (when both are shown), if they are equal? Like {string string}?

image

Alternatively, maybe show the name with a $ in front of it to help visually clarify that it is a name, not a type? Like {string $string}.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Either of these would be easy to implement, so what do you think it's the better idea?
I may go with adding another option for collapsing type and name when equal, but the second option it's also fine, the advantage of the first one is that you save some space and you don't lose any information because you know the type from the name. This will apply only when they are equal so {UserServiceInterface userService} won't collapse.

Does the last version of the ext work as expected for you?

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Can we do both? Then it's always clear what the type is and what the $name is.

It works as expected! I noticed one small thing: when name == var is set to collapse, there is 1 empty space where the name would usually go:

image

FormStateInterface : should be FormStateInterface:, right? Or is this intentional?

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

I'm still not able to see the $ symbol in front of variable names. Is this a new setting I need to enable?

image

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Right now the $ shows only when the type is equal to the parameter name, but the next version will have a command to toggle this explicitly for every parameter name.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Ah - ok! Looking forward to that update. Confirmed worked as designed for the current release:

image

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

@amaisano Published 0.5.0 and it includes this command. Let me know how it works.

Btw, what's the name of the theme you are using in this screenshots?

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Thanks. This looks good!

image

Theme is Birds of Paradise, but I have modified the yellows/oranges a bit to make them warmer. I can post a gist of my current theme colors if you want.

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Yes, I would appreciate it.

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

https://gist.github.com/amaisano/2c8c3ebc7c41d06d8fc6338d064e4ea7

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

Thanks!

from php-parameter-hint.

robertgr991 avatar robertgr991 commented on July 28, 2024

@amaisano Can this be closed? Is everything working fine?

from php-parameter-hint.

amaisano avatar amaisano commented on July 28, 2024

Yes! Thanks for your work.

from php-parameter-hint.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.