1

Within Rider, I am able to turn on Inlay Hints (specifcally parameter name hints) for C# and it works fine. An image of parameter name hints working in Rider

I would like to be able to do the same thing within PyCharm. However, there is no option to do so. An image of parameter name hints not working in PyCharm

For Rider, I am able to change Inlay Hints for C# and VB.NET, while on PyCharm, I can only change them for Angular, DockerFile, JS, SQL, and TS, as shown below:

PyCharm not allowing Inlay Hints for Python

I am able to turn them on for JavaScript within PyCharm:

PyCharm inline hints working for JS

So why can't I add Inlay Hints to Python within PyCharm?

Code for you to test with:

def function(a, b):
    print(a * b)
x = 3
y = 2
function(x, y)

With inlay hints, the last line would display function( a: x, b: y) However there is no option to turn these on within PyCharm Professional for Python.

1
  • 1
    Please edit the question to include the necessary source code as text. Consider these reasons and guidelines. Readers who want to try this will prefer having something that can be copy pasted. In this case screenshots are of course essential, but the textual version should also be included.
    – bad_coder
    Commented Oct 10, 2021 at 17:09

3 Answers 3

0

Jetbrains' website says: Go to Editor > Color Scheme > Language Defaults, and then select Inline Hints. If you can't turn it on for Python, I believe you need a plugin for that? The available hint types depend on what plugins you have installed.

3
  • Been looking for a plugin to do that, but so far none of them mention it or add the option to do so.
    – Jeff Chen
    Commented Oct 10, 2021 at 17:19
  • I think it depends on the version of python you are using? According to this Pycharm Python article, PEP 484 added "type hinting in function annotations and type comments using the typing module." So it should be an option. And it also says Python 2 adds it as a comment while Python 3 adds it as an annotation. The article I linked in this comment has some steps and examples for you in case you haven't tried everything yet. Commented Oct 10, 2021 at 17:39
  • 1
    I have tried those and they're not what I'm looking for, I just want the parameter name to be hinted in the function call as seen with the JS and C# example, not the code itself to be edited.
    – Jeff Chen
    Commented Oct 10, 2021 at 17:49
0

I have made a plugin to do just this. It is far from perfect, though.

Link: https://github.com/hostar/python-inlay-putter

-1

You need to install the plugin Pytest Parametrize Inlay Hint

Pytest Parametrize Inlay Hint

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 16, 2023 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.