Join GitHub today
Use CLASS information after `if isinstance(object, CLASS)` block #39
source = """\ import datetime if isinstance(obj, datetime.datetime): obj.""" script = jedi.Script(source, 3, 8, '') script.complete()
source = """\ import datetime if isinstance(obj, datetime.datetime): pass obj.""" script = jedi.Script(source, 4, 4, '') script.complete()
does not work.
I think having false-positive candidates in auto-completion is OK (better than nothing).
I fixed it for functions, but I won't add the functionality of your first example. This wouldn't be helpful, I think false positives are ok, but I don't think that this will help too much.
Clearly at the moment there are certain examples where this could work and it might help. But these are probably all examples where an experienced user could guess the type, looking at the code. So I really like to improve Jedi as an "experienced" user. And I still have enough ideas, just not enough time.
Another reason, why I reject your proposal is that I don't think that it fits into Jedi's architecture. All the stuff that involves Array handling is basically a hack and not as nice as the rest. The reason I don't like those hacks is pretty simple:
Thanks for the fix and answer. Rejecting my idea due to performance issue makes sense. It would be nice to be able to invoke Jedi optionally using my suggestion, to tell Jedi to "give me more candidates", though probably it complicate implementation. Knowing type of an object may be easy for experienced user but remembering attribute is hard. But anyway, it's just my opinion and I don't know the implementation difficulty :)