Displaying the Original Comment of an Item in the Hover Window Using Pyright

12 Views Asked by At

When importing a module, for instance, using 'import utils' or 'from utils import func1, class2', and there is a docstring comment at the very top of 'utils.py', hovering the mouse over the word 'utils' displays the comment in the popup window. However, this does not occur for any other items defined within 'utils.py' that have comments above them. Instead, the popup window only shows the item's type, omitting any comments. Is there a method to display these comments as well?

I have created a __init__.pyi file in the stubs/utils directory with the following content:

"""
The function format_decimal processes a numerical input, n. Its purpose is to enhance the readability of large numbers by formatting them with commas as thousand separators.
"""
def format_decimal(n) -> str:
    # Converts the number to a string
    ...

class PackNavigator:
    """
    This includes a docstring for the class. 
    It is intended to assist other developers in understanding the purpose of the class and its usage.
    """
    def __init__(self, pack1, pack2, a, b) -> None:
        ...

    def bind_arrows(self, pack) -> None:
        ...

    def navigate_pack2(self, event, direction) -> None:
        ...

    def navigate_pack1(self, event, direction) -> None:
        ...

I have ensured that pyrightconfig.json is configured correctly. My goal is for the docstring comment within the PackNavigator class to be displayed in the hover window beneath "(class) PackNavigator", specifically:

This includes a docstring for the class. 
It is intended to assist other developers in understanding the purpose of the class and its usage.
0

There are 0 best solutions below