New in PhpStorm 2017.1 – Parameter Hints

Brand new in 2017.1, we introduce parameter hints to make your code more readable and easier to understand.

PhpStorm 2017.1 now gives you a hint on the parameter name if the parameter is a literal or null:

parameter-hints

Notice how you now get the name of the variable you need to pass into a function or method when you call it. This makes understanding what you should be passing much more obvious (assuming you’ve named your parameters something reasonable!).

You can style these parameter hints in the settings; go to Editor | Colors and Fonts | Language Defaults and then select Inline parameter hints. Or you can turn the hints off altogether, by navigating to Editor | General | Appearance and deselecting Show parameter name hints. In the same area, you can configure which methods or functions should be blacklisted and never show parameter hints. An easier way to configure this is to use the Quickfix intention (default Alt+Enter), and then select Do not show hints for current method.

I’ve been using these hints since the earliest EAP for 2017.1 and I’ve grown to love them – give them a try and let us know what you think.

– Gary & The PhpStorm Team

About Gary Hockin

Gary Hockin has been creating code to power web applications for 15 years, the last three of them at an extraordinary level. He is handsome, talented, funny and articulate, and also extremely modest. Gary is a valued contributor to Zend Framework 2 and is a member of the community review team. He's married and has two wonderful children, and when he's not coding, writing about code, speaking about code or reading about code, he can usually be found in the pub playing pool.
This entry was posted in Cool Feature, Newsletter. Bookmark the permalink.
  • Seb Schuh

    I agree they are generally helpful… where I do not like them is whenever a function call has multiple parameters and every parameter is on its own line… method hints on some of those parameters makes it hard to see wether the indentation is correct and it looks weird as well.

  • gskema

    Hmm this would be very helpful for something like Symfony’s `new Cookie(…)` constructor. For everyday functions with 1-3 arguments – not so sure (yet).

    • Denis Kazimirov

      If you start to work with some legacy project with tons of code, it can be very very helpful. I think it is very nice to have this option and filter what you don’t need to see.

  • Peter Spegel

    It would be very nice to be able to toggle the parameter hints (globally) with some keyboard shortcut.

    • Eugene Morozov

      An action for that is already available in the Keymap, feel free to assign a shortcut.

  • El KuKu

    I’ve also grown to love them (EAP user).
    BUT – I believe that you should add a note about the possibility to define a keyboard shortcut to toggle them 😉

    • Eugene Morozov

      The action is called Parameter name hints, please check the Keymap.

  • Jan Kuchař

    I used them for early beginning and I really love them. Only thing that seems weird to me is when you make code temporarily invalid, all hints collapses and when you make code valid again it bounces back. This feel strange to me, despite I know it is nearly impossible to do something about it.

  • Ben
  • Carls

    Would love to see this work with other types of parameters, not only literals.

  • Ben

    This is awesome – is there a way to show the hints when a variable is being passed?

    https://uploads.disquscdn.com/images/56fff7c3343cb32677d3315ef6c944f8a07edfcf484ecc14d960fffe6c6d90d7.png

  • matsand

    In general I like this new feature.
    Unfortunately I found it very straining on my eyes since they appear quite blurry and I felt my eyes trying to focus on the blur. I’m on a 4K monitor with 125% HiDPI setting in Windows 10. After a couple of minutes I turned it off – too annoying.

    • matsand

      Tried removing the background and they look good in the Settings window, but back out in the editor they have the still have background. Bug?

  • http://jatinsoni.rocks Jatin Soni

    I Love this feature. Just fantastic… but want to learn how can I use it for custom methods and functions. I wish this to works with variable too.

  • Victor Andreas

    It would be nice if there’s a setting to show the hint on focus of the function and hide on blur and toggle ALL hints with a keyboard shortcut.
    Also the background doesn’t appear in Language specific background-color.

    • unloco mqx

      not sure but search for “hint” in the keymap panel

  • http://blog.piotrows.pl/ Łukasz Piotrowski

    Is there a way to show hints to PHP std functions like in_array(), explode() etc?

  • Ewan McRobert

    I like the feature, though I think it looks a bit clunky with a background and too much like something I can edit without a background.

    In the settings there is an option to make it italic, which I’d like to do, but it doesn’t seem to actually do anything

  • Łza Włóczynutka

    https://uploads.disquscdn.com/images/06a959557c97e9068ec55afb48dca7ecf486fff8ac4e136e71a644ac45ce40a5.png How to change background or font color? Hints are unreadable with my color scheme :-(

    • Alex

      You can style these parameter hints in the settings; go to Editor | Colors and Fonts | Language Defaults and then select Inline parameter hints.

  • Andrew

    I don’t know if it useful , in my view the width between brackets getting wider, maybe better to have an event for viewing it

  • Oliver Ulpts

    Generally I like it but 2 trade offs:
    1. As for php functions like explode, I first have to type something like explode( ‘ and then it is showing. It would be nice to show the hints before I write something. With explode( it should work, and not with the first quote.

    2. The style: I’d prefere not to have something like “format:” standing before the value, rather small and above/below the code as a hint. You would have better readability and it doesn’t look off.

  • Bob Thompson

    This is a good addition but I think there should be an option to only show it on the current line (i.e. line with the cursor) because otherwise the code starts looking unreadable in the big picture. Great work, nonetheless. Love your constant and never ending improvements!

  • Carlos Rodrigues

    It could work for JavaScript too. Any plans to add it to WebStorm?

    • leocaseiro

      Agreed! Especially for TypeScript

  • michaeldevery

    This is a very useful feature when getting an overview of some code. I think it’s good that you have the option to easily toggle it, because, being OCD about line length, it looks like my line is way longer than the 80 character limit with parameter hints turned on, when actually it’s 68 characters.

    https://uploads.disquscdn.com/images/d23927c4f9efa2502c99c1ae6d2b972197be6ae99942dcc024b69f1764da96fd.png

    • Kamil Zając

      +1 from me that option to easily toggle it would be great.

  • theIggs

    This might be useful for reading code, but totally ruins the editing. You just can’t tell margins, extra spaces, line widths with this thing on.

    So it should be switchable from some menu and/or keyboard shortcut.

  • Argon

    Color in complex strings now is bugged:
    https://uploads.disquscdn.com/images/6d105cc251d73eba7cc34d2dafbab436a7e7e9ad0efed7e8beb2b2fc4465d13c.png
    Strings inside ‘something ‘ were green before update and I didnt changed it in config menu. In simple strings without concatenation it is green as expected.

  • Jay

    Is there a way to change the font size of this hint? It seems to be set at a different size. Preferably exactly as the text next to it so I can tab align parameters. It seems to be smaller on the screenshots on this page, however – it’s noticeably bigger with my settings and it kinda bugs me.

  • http://michael.sypes.org Michael Sypes

    I like the idea, but not the implementation. Having the hints interspersed with the actual code is distracting. How about a hover pop-up instead?

    • Dmitry Tronin

      Feel free to submit this as a feature request at http://youtrack.jetbrains.com/issues/WI#newissue=yes

    • ksadowski

      You can see a helpful “Parameter info” popup with pretty much the same information by pressing Ctrl + P (with the default keymap at least). It’s been there for as long as I can remember :)

  • BulletProof Software

    While it’s a nice thing when looking at code, it honestly gets in the way when typing and aligning code. Often times, I’m unsure where the backspace/arrow keys are going to bring the cursor. IMHO, IDEs of the past got this right with an onHover window that stayed out of the way.

    Found this post when trying to find out how to turn off the feature.