Narrow completion suggestions to __all__ value #3709
Replies: 6 comments 5 replies
-
I don't think this matches the expectations of most users. The Since this isn't a core type checking issue, I'm going to transfer it to the pylance-release project and let the pylance team decide how to proceed. |
Beta Was this translation helpful? Give feedback.
-
@m-novikov, is the module part of a "py.typed" library? If so, then we could limit suggestions only to those symbols that are considered part of the public interface for the library. For modules that are not part of a "py.typed" library (or type stubs), we don't have a good way of knowing which symbols are meant to be public and which are not. Python doesn't have any keywords like |
Beta Was this translation helpful? Give feedback.
-
It's not a part of |
Beta Was this translation helpful? Give feedback.
-
Are there any updates on this? +1 for first showing all attributes defined in |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
As a library maintainer I find it useful to be able to control what shows up in tab completion to improve the user experience. For example, as a library grows I might want to avoid that the top level API becomes too cluttered by moving some top-level modules into sub-modules, but at the same time I don't want to break existing code. In JupyterLab, I am able to do this by modifying From reading the docs linked above, I see that I can make modules private, but I don't understand how to make individual classes and functions now show up in tab completion while still allowing them to be accessible from the top level if typed out. From this comment #2572 (comment) I see that I can use |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Some modules import a lot of symbols into their namespace.
Auto-completion on such modules lists own symbols as well as all imported ones, which can be inconvenient.
Let's say I have a module
a.py
containing followingCurrently autocomplete on
a.
gives mea.List
anda.foo
as possible options.Describe the solution you'd like
When triggering auto complete on such module I would like to see only names listed in
__all__
in suggestions + common module attributes such as__file__
,__doc__
Additional context
For modules that don't specify
__all__
all names should be listed as before.Beta Was this translation helpful? Give feedback.
All reactions