This question was raised some time ago: When I decorate a python function, VS Code shows the wrapper's help, instead of the function's , when hovered
Apparently it was fixed by PyLace. I have now the opposite problem: I want to include the docstring of the wrapper in the tooltip.
Decorator:
def magic:
def wrapper:
result = doSomeMagic()
return result
wrapper.__doc__ = f'{func.__doc__} and some other stuff'
return wrapper
Now I have a function where I use the decorator:
@magic
def sayHello():
'''A simple function to print Hello'''
print("Hello")
If I call help(sayHello)
I get back A simple function to print hello and some other stuff
This is all good! But if I use the tooltip for the function hello it would just give me the docstring from the function: A simple function to print Hello
but I want to have the wrapper docstring in the tooltip...
I tried to include in the wrapper:
func.__doc__ = wrapper.__doc__
No success so far. Does someone has an idea how to achieve this in VSCode or PyCharm? Is there a way to influence the shown tooltips?