Add setting to disable showing hidden/private modules in import statement completion list for 3rd party libraries #4518
Replies: 12 comments 12 replies
-
|
Thanks for the issue but I can't seem to reproduce the problem. I have a set of files like so: In the When I go to autocomplete the library I only see the stuff I exported from init: |
Beta Was this translation helpful? Give feedback.
-
|
If the That's controlled by what's exported from the |
Beta Was this translation helpful? Give feedback.
-
|
you're looking at the wrong autocomplete: the issue is specific to the
|
Beta Was this translation helpful? Give feedback.
-
|
Ah you mean this: Seems like a bug. I'm guessing import module completions don't exclude privates on purpose though as they are valid to be imported. Moving to triage to discuss. |
Beta Was this translation helpful? Give feedback.
-
|
This might be related to this bug. |
Beta Was this translation helpful? Give feedback.
-
|
Moving this issue to discussion as an enhancement request for comments and upvotes. Maybe we should add a setting to control this behavior -- should |
Beta Was this translation helpful? Give feedback.
-
|
I don't agree with making this a discussion. it's documented in Pyright how it should work especially since the behaviour is already correct in many places, just the specific |
Beta Was this translation helpful? Give feedback.
-
|
The pyright documentation describes what is public and what is private but mentions nothing about how import completions should work. We're worried about the case where somebody is writing a library with py.typed and they want to import private modules. I think at a minimum we'll make the private modules sort at the bottom. |
Beta Was this translation helpful? Give feedback.
-
|
Sounds good. Created an issue again. |
Beta Was this translation helpful? Give feedback.
-
|
A fix for this was submitted to Pyright. This should show up in the next prerelease version of Pylance. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
@rchiodo, To clarify... one of the things I wanted was affected by that setting and is behaving as expected now. But in the screenshot above where modules are listed during |
Beta Was this translation helpful? Give feedback.





Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Environment data
Code Snippet
Repro Steps
mytypedlib_py.typedfilepip install .py.typedfile after install (checking in site-packages)mytypedlibby starting to typefrom mytypedlib.Expected behavior
The completions should not include modules prefixed with
_should not show up, as per: https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface they should be considered private.Actual behavior
The autocompletion shows modules prefixed with
_Logs
i have not included trace logs as it would leak private information. I can provide them with some effort if others can't reproduce this.
Beta Was this translation helpful? Give feedback.
All reactions