Skip to content

LSP: Docstring hover doesn't work for type aliases like TypeAliass #4499

Description

@dangotbanned

Related

I posted this on (#3661 (comment)) a couple weeks ago, but probably should've started with a new issue

Summary

A docstring that follows a TypeAlias is shown on hover

Image

But the docstring is lost when using a type statement

Image

And if you use TypeAliasType, you get multiple docs

Image

Repro

Playground

from typing import TypeAlias, Literal, TypeAliasType

A: TypeAlias = Literal["1", "2"]
"""I have a doc!"""

type B = Literal["1", "2"]
"""So do I, but you cannot see me."""

C = TypeAliasType("C", Literal["1", "2"])
"""I have two docs?"""

B1: TypeAlias = B
# No docs

B2 = TypeAliasType("B2", B)
# No docs

C1: TypeAlias = C
# This has 1 doc now?

C2 = TypeAliasType("C2", C)
# No docs


# ------------------------
# Hover over these guys

A

B

C

B1

B2

C1

C2

Version

ty 0.0.79 (b4cd792 2026-09-07)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghoverEditor hover cards, displayed type signatures, and rendering of attached documentationserverRelated to the LSP server

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions