prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.11k stars 717 forks source link

How to have autocompletion on = char #1778

Open vallsv opened 10 months ago

vallsv commented 10 months ago

Hi,

I would like to know how difficult would be to do an autocompletion based on attribute type, mostly for enums.

Suppose you have such code

class MyEnum(Enum):
    FOO = auto()
    BAR = auto()

class MyObj:
    foo: MyEnum = MyEnum.FOO

obj = MyObj()

Do you think it's easy to start the completion on the typing of = and provide the available enum values.

obj =

I have search on the web, but there is nothing related to that.

Any idea if such feature is already there, or very easy to implement? Thanks a lot.