Skip to content

[Hover][Docstring] Docstrings from .py on attributes when base type is from .pyi #1090

@kinto0

Description

@kinto0

Describe the Bug

pyrefly in the IDE generally prefers the .py for docstrings because typeshed and type stubs generally don't include docstrings. we have the ability to prefer .py files from direct imports from this issue, but attributes are harder since we have to "solve" the type with the checker in order to get attributes, and the solver currently prefers .pyi.

example:

import numpy as np
#          ^ hover here shows the docstring from .py


def foo(x: np.darray):
#               ^ hover here should work, showing docstring from .py
    method= returns_np_darray().all
   #   ^                         ^ hover here will not show docstring, only type

test here:

fn definition_on_attr_of_pyi() {

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions