Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Switch between completing everything and only names in __all__ in from imports #11

Closed
tek opened this Issue · 5 comments

2 participants

@tek

When completing here
from pkg.mod import <tab>
make it possible to only display names present in the module's __all__ list.
Realize this as a mapping, maybe only present when the popupmenu is open (toggle).

@tek

I'll try this myself if I find the time, just wanted to write down the idea :)

@davidhalter
Owner

First, the example you give is not correct, because __all__ only affects star imports: from pkg.mod import *. Because you didn't know this, some of the stuff below might not be intended for you to hear. It's just to gather my thoughts.

That said, it is important to note that star imports are not that important, actually I think you shouldn't use it at all (which you are not saying of course).

I once wanted to check for __all__, but then I noticed, that it is really difficult with numpy, because there are additions on add, etc. So I guess the chance that jedi misses some entries, because understanding array operations is pretty heavy, is just too big for me.
However, if anyone wants to add this feature, the condition is that numpy is still fully functional with jedi.

@tek

I'm well aware of how __all__ works ;)
The reason for this feature suggestion is that I want be able to filter out the names that aren't in the public interface, i.e. the names not in __all__. For example, I've got the variable __copyright__ in every file and all names imported into a module always appear in the completion menu. So I think it would be a nice side effect of defining __all__ despite the encouragement on * imports.

@davidhalter
Owner

Yeah, probably you're right. It could be an option in settings.py! I would probably make it the default. But to do this, numpy has to be taken care of. (It's not on my todo list at the moment, though.)

@davidhalter
Owner

I'm closing this because of no activity and the lack of interest in the community (I myself am not interest in this option anyway and think that it's hard to do with Jedi).

However if somebody wants to do that. Feel free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.