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
Tab completion not working for class when it has property with typing.Literal annotated return value #14412
Comments
I can confirm that this does not work by default in 8.23.0 which looks like a jedi problem. @wenjuno can you confirm that your setup used the default completer and that disabling jedi with the config command as per above fixes it for you? |
Hi @krassowski Thanks for the reply. Sorry I'm not familiar with the IPython configuration, I'm not sure how to confirm my configuration. I tried the command but it raised exception:
I might have a different configuration? c.InteractiveShell.colors = 'Linux'
c.TerminalInteractiveShell.colors = 'Linux' I follow the instruction here (https://ipython.readthedocs.io/en/stable/config/intro.html) to create a new profile. In the So, should we report this to jedi instead? Thanks. |
@wenjuno whoops, sorry typo! I meant: |
Great to hear! |
Let's see: import jedi
code = """import typing
class A:
@property
def value(self) -> typing.Literal['a']:
return 'a'
def get(self) -> typing.Literal['a']:
return 'a'
a = A()
a."""
script = jedi.Script(code)
script.complete(line=len(code.splitlines()), column=2)
Well, this works with script what about import jedi
code = """import typing
class A:
@property
def value(self) -> typing.Literal['a']:
return 'a'
def get(self) -> typing.Literal['a']:
return 'a'
a = A()
a."""
script = jedi.Interpreter(code, [])
script.complete(line=len(code.splitlines()), column=2) Also works. Maybe this is an integration problem? |
that's an improper use of Interpreter. import jedi
import typing
class A:
@property
def value(self) -> typing.Literal["a"]:
return "a"
def get(self) -> typing.Literal["a"]:
return "a"
a = A()
interp = jedi.Interpreter("a.", [{"a": a}])
interp.complete(line=1, column=2) Raises with |
Here is an example class:
Now if I type
a.<Tab>
in IPython console, nothing will show up. If I put the same code in Python console, the second Tab will display the two methods.The text was updated successfully, but these errors were encountered: