omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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)

    Pythonista
    2
    9
    637
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Vent
      Vent last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Have you tried import typing at the top of your script?

        1 Reply Last reply Reply Quote 0
        • Vent
          Vent last edited by

          Now I tried, but the issue is still there...

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            Yeah unfortunately the Jedi version used for parsing is old. I'm not sure when Jedi added type hint support, but obviously later.

            1 Reply Last reply Reply Quote 0
            • Vent
              Vent last edited by

              Can I update Jedi?

              1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • JonB
                  JonB last edited by

                  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 )

                  1 Reply Last reply Reply Quote 0
                  • JonB
                    JonB last edited by

                    https://github.com/zrzka/blackmamba

                    As a starting point, look at
                    https://github.com/zrzka/blackmamba/blob/b298bc5d59e5aea9d494282910faf522c08ebba9/blackmamba/script/jump_to_definition.py

                    I'll have to look to see if I had a autocomplete swizzle.

                    1 Reply Last reply Reply Quote 0
                    • JonB
                      JonB last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors