Skip to content

Completing parameter values from a list of strings #1355

Closed

Description

@timhoffm

Could jedi be made to complete string parameters inferred from numpydoc docstrings?

def f(a): 
    """ 
    A function. 

    Parameters 
    ---------- 
    a : {'foo', 'bar'} 
    """ 
    print(a) 

When I complete f(a= or f(a=' it would be really cool, if jedi could suggest 'foo' and 'bar'.

Would it be worth looking into this for a potential PR or are there fundamental road blocks?

Activity

  1. davidhalter commented on Jun 30, 2019

    @davidhalter
    Owner

    I would be kind of fine with this once #771 was in place. Before this it won't really work, because the infrastructure is not in place.

  2. timhoffm commented on Jun 30, 2019

    @timhoffm
    Author

    Thanks for the feedback!

  3. davidhalter commented on Dec 31, 2019

    @davidhalter
    Owner

    I fixed #771 and while this would be possible now, I'm very much against adding more complexity to the docstring parsers. It's just not really worth it for the little gain. There's a lot of issues with some of the numpy APIs IMO, so they should probably just use stubs.

    I'm happy to reconsider this, if there are stubs out there for numpy (or related libraries) that use a Union[Literal['foo'], Literal['bar']]. See also: https://www.python.org/dev/peps/pep-0586/.

    Annotations are the future, so using them makes only sense.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions