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

Incorrect Rendering of the Return Section of Google Style Docstrings with Type Annotations Inside #6720

Open
wonder-perfect opened this issue Nov 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working docstrings

Comments

@wonder-perfect
Copy link

Environment data

  • Language Server version: 2024.11.3
  • OS and version: win32 x64
  • Python version (and distribution if applicable, e.g. Anaconda):
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: basic

Code Snippet

def add(a: int | float, b: int | float = 0) -> int | float:
    """Add two numbers together

    Args:
        a (int | float): The first number
        b (int | float, optional): The second number. Defaults to 0.

    Returns:
        int | float: The sum of the two numbers

    Raises:
        TypeError: A parameter is not type int
        ValueError: foo
    """
    return a + b

add(1, 2)

Repro Steps

  1. Open a python file using vscode
  2. Install basic python support extensions: Pylance Python Python Debugger
  3. Define a function with Google style docstring just like the code snippets above, and then invoke it
  4. Hover on the function call to see the popup

Expected behavior

**Returns**
    **out**
    _int | float_: The sum of the two numbers

Actual behavior

Image

Logs

2024-11-30 21:54:50.481 [info] [Info  - 9:54:50 PM] (4896) [id_0] Logging started
2024-11-30 21:54:50.701 [info] [Info  - 9:54:50 PM] (4896) Found 2 source files
2024-11-30 21:54:50.921 [info] [Error - 9:54:50 PM] (4896) File or directory "\<default workspace root>" does not exist.
2024-11-30 21:54:50.921 [info] [Info  - 9:54:50 PM] (4896) No source files found.
2024-11-30 21:54:54.244 [info] [Info  - 9:54:54 PM] Server process exited successfully
2024-11-30 21:54:54.771 [info] (Client) Pylance async client (2024.11.3) started with python extension (2024.20.0)
2024-11-30 21:54:56.488 [info] [Info  - 9:54:56 PM] (13468) Server root directory: file:///c%3A/Users/username/.vscode/extensions/ms-python.vscode-pylance-2024.11.3/dist
2024-11-30 21:54:56.491 [info] [Info  - 9:54:56 PM] (13468) Pylance language server 2024.11.3 (pyright version 1.1.386, commit 4180fa21) starting
2024-11-30 21:54:56.498 [info] [Info  - 9:54:56 PM] (13468) Starting service instance "dev"
2024-11-30 21:54:56.543 [info] [Info  - 9:54:56 PM] (13468) Setting environmentName for service "dev": "3.10.11 (global)"
2024-11-30 21:54:56.543 [info] [Info  - 9:54:56 PM] (13468) Setting pythonPath for service "dev": "C:\Users\username\AppData\Local\Programs\Python\Python310\python.exe"
2024-11-30 21:54:56.544 [info] [Info  - 9:54:56 PM] (13468) No include entries specified; assuming d:\Project\dev
2024-11-30 21:54:56.546 [info] [Info  - 9:54:56 PM] (13468) Auto-excluding **/node_modules
2024-11-30 21:54:56.547 [info] [Info  - 9:54:56 PM] (13468) Auto-excluding **/__pycache__
2024-11-30 21:54:56.547 [info] [Info  - 9:54:56 PM] (13468) Auto-excluding **/.*
2024-11-30 21:54:56.656 [info] [Info  - 9:54:56 PM] (13468) Assuming Python version 3.10.11.final.0
2024-11-30 21:54:56.938 [info] [Info  - 9:54:56 PM] (13468) Found 2 source files
2024-11-30 21:54:57.520 [info] [Info  - 9:54:57 PM] (13468) Background analysis(1) root directory: file:///c%3A/Users/username/.vscode/extensions/ms-python.vscode-pylance-2024.11.3/dist
2024-11-30 21:54:57.525 [info] [Info  - 9:54:57 PM] (13468) Background analysis(1) started
2024-11-30 21:54:57.800 [info] [Info  - 9:54:57 PM] (13468) Indexer background runner(2) root directory: file:///c%3A/Users/username/.vscode/extensions/ms-python.vscode-pylance-2024.11.3/dist (index)
2024-11-30 21:54:57.800 [info] [Info  - 9:54:57 PM] (13468) Indexing(2) started
2024-11-30 21:54:59.986 [info] [Info  - 9:54:59 PM] (13468) scanned(2) 390 files over 1 exec env
2024-11-30 21:55:06.656 [info] [Info  - 9:55:06 PM] (13468) [IDX(2)] Long operation: index execution environment file:///d%3A/to/workspace (6257ms)
2024-11-30 21:55:06.858 [info] [Info  - 9:55:06 PM] (13468) [IDX(2)] Long operation: index packages file:///d%3A/to/workspace (6499ms)
2024-11-30 21:55:06.858 [info] [Info  - 9:55:06 PM] (13468) indexed(2) 390 files over 1 exec env
2024-11-30 21:55:07.081 [info] [Info  - 9:55:07 PM] (13468) Indexing finished(2).

Addtional Info

Seems to be related to #6127 , but slightly different. The bugs in #6127 were fixed, but there are new ones here.
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Nov 30, 2024
@KacieKK KacieKK added bug Something isn't working docstrings and removed needs repro Issue has not been reproduced yet labels Dec 2, 2024
@KacieKK
Copy link
Contributor

KacieKK commented Dec 2, 2024

Thanks for posting this issue. I can reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docstrings
Projects
None yet
Development

No branches or pull requests

2 participants