Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Autocomplete does not work when using Type Hint (intellisense, Typing)
-
I can’t see Autocomplete when using Type Hint.
class Foo(): def __init__(self): self.bar = 'a' foo = Foo() foo.# I can get Autocomplete
class Foo(): def __init__(self): self.bar: str = 'a' foo = Foo() foo.# There are No Autocomplete
Can I fix it immediately some way? Or Need update from omz?
-
Have you tried import typing at the top of your script?
-
Now I tried, but the issue is still there...
-
Yeah unfortunately the Jedi version used for parsing is old. I'm not sure when Jedi added type hint support, but obviously later.
-
Can I update Jedi?
-
While you can update Jedi, I don't think that pythonista will use it the updated jedi. But I could be wrong. It actually is possible to swizzle the autocomplete functions, but that might end up being slow. But I'm not sure. I think I had a thread about that a long time back.
I believe the Jedi version we have does support other comment based type definitions.
-
Blackmamba I think uses Jedi to allow a "jump to definition" keystroke. You might be able to modify it to have an alternate keystroke to do updated Jedi based completion.
(Blackmamba is on pypi or GitHub. It is basically improvements for using external kb with pythonista )
-
https://github.com/zrzka/blackmamba
As a starting point, look at
https://github.com/zrzka/blackmamba/blob/b298bc5d59e5aea9d494282910faf522c08ebba9/blackmamba/script/jump_to_definition.pyI'll have to look to see if I had a autocomplete swizzle.
-
https://github.com/jsbain/objc_hacks/blob/master/completer.py
This was an example of how to hook into the pythonista autocomplete system. You would replace the hard coded Suggestions with calls to Jedi.