Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python docstring tooltips cut off multiline :param descriptions #25170

Closed
irevolve opened this issue Feb 19, 2025 · 2 comments
Closed

Python docstring tooltips cut off multiline :param descriptions #25170

irevolve opened this issue Feb 19, 2025 · 2 comments
Labels
reproducible Verified steps to reproduce included

Comments

@irevolve
Copy link

Summary

Multiline :param descriptions in docstrings are truncated to the first line when hovering over a parameter.

Steps to trigger the problem:

  1. Open Zed with a clean installation.

  2. Create a new Python file (test.py).

  3. Copy and paste the following function definition with a Sphinx-style docstring:

    def process_data(data: list[float], threshold: float) -> dict[str, list[float]]:
        """
        Processes the given data and applies a threshold.
    
        :param data: A list of numerical values that need to be processed. 
                     Each value represents a measurement taken from a sensor. 
                     The function will filter out values that do not meet 
                     certain criteria.
        :type data: list[float]
    
        :param threshold: A float value representing the cutoff threshold. 
                          Values below this threshold will be ignored in the 
                          final result.
        :type threshold: float
    
        :return: A dictionary containing the processed data.
        :rtype: dict[str, list[float]]
        """
        return {"processed_data": [x for x in data if x >= threshold]}
  4. Hover over the data or threshold parameter in the function signature.

Actual Behavior:

  • The tooltip only displays the first line of the :param description.
  • The rest of the multiline description is missing.

Expected Behavior:

  • The tooltip should display the full multiline description of each :param entry, including all indented lines.
  • This behavior should be consistent with how IDEs handle Google- or NumPy-style docstrings.

Zed Version and System Specs

Zed: v0.175.0 (Zed Preview)
OS: macOS 15.3.0
Memory: 32 GiB
Architecture: aarch64

@beniaminzagan
Copy link
Member

beniaminzagan commented Feb 19, 2025

Thank you for reporting! Indeed hovering over the data or tooltip only shows the first sentance it doesn't show the full explanation as given in the docstring.

However this seems to be an issue in Pyright and not in Zed. (Pylance seems to have fixed this and mentions Pyright wrong behavior)

What we get back from Pyright on hover:

{"jsonrpc":"2.0","id":111,"result":{"contents":{"kind":"markdown","value":"```python\n(parameter) data: list[float]\n```\ndata: A list of numerical values that need to be processed."},"range":{"start":{"line":0,"character":17},"end":{"line":0,"character":21}}}}

Please make an issue upstream https://github.com/microsoft/pyright/. If you still think its an issue in zed you can always reopen the issue or make a new one!

@beniaminzagan beniaminzagan added the reproducible Verified steps to reproduce included label Feb 19, 2025
@beniaminzagan beniaminzagan closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2025
@irevolve
Copy link
Author

As i have received an update from microsoft regarding pyright, i wanted to share that here as well:
microsoft/pyright#9957

It doesn't seem they care about it at all and suggested to use pylance instead...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reproducible Verified steps to reproduce included
Projects
None yet
Development

No branches or pull requests

2 participants