Skip to content

Docstrings confuse autocompletion #966

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

Closed
Andriamanitra opened this issue Aug 25, 2022 · 2 comments
Closed

Docstrings confuse autocompletion #966

Andriamanitra opened this issue Aug 25, 2022 · 2 comments
Labels
Milestone

Comments

@Andriamanitra
Copy link

I ran into an issue where the autocompletion starts thinking an example from the docstring of the function is the signature of the function.

The original code where I ran into this was a bit more complicated but I managed to create a somewhat minimal reproduction (the inheritance is significant, without inheriting it works correctly):

from collections.abc import Sequence


class C(Sequence):
    @classmethod
    def cmethod(cls, number: int, lst: list[int] = []):
        """
        Return a list of numbers

        Example:
        ========
        C.cmethod(1337, [1, 2]) # => [1, 2, 1337]
        """
        return lst + [number]

image

The autocompletion (and the documentation pop-up) seems to not realize that 1337 and [1 and 2 are literals rather than parameter names, and the cls parameter for a class method gets turned into obj for whatever reason.

@sebastinas sebastinas added the bug label Aug 25, 2022
sebastinas added a commit that referenced this issue Aug 25, 2022
@sebastinas
Copy link
Contributor

There are multiple issues as far as I can tell. First issue is that parsing of default values is broken in with type annotations.

@sebastinas
Copy link
Contributor

Indeed, fixlongargs is broken with type annotations.

sebastinas added a commit that referenced this issue Aug 29, 2022
sebastinas added a commit that referenced this issue Aug 29, 2022
This is another variant of the class from #966.
@sebastinas sebastinas added this to the release-0.23 milestone Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants