Wrong import suggestions
Describe the Bug
When importing from another module, many objects that are not actually present in that module are suggested, making it quite hard to find what is really relevant and actually exists there.
This can be replicated in the initial Sandbox by simply trying to get intellisense to suggest an import, where the only suggestion should be format_number.
It also happens when using import (without from) and then triggering the completion.
You can use the keyboard shortcut (control + space on Mac) to trigger the completion, which will show all the names in the screenshot.
Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxAAQDqMUAxrgLYzUAuunAFuwAqkATjDBRS1AMoYcBADS8IcakuqpqxVAHMYAHXQ0A7nxHVSuAK7VGGaoaEQOMBXB6pTM6rHfo1eCxycpMQQ6FoqvoIcPLjohPqUCdQAEjAeHtaWxLDUYDCoHBYiyrhgispoWHj4iEkAtNQA4jCBIqhQdRwQbEHE7Ix8jADWoeF5MDiow-XUAKpw7CIAbvlQAPocwTAAFACUnNyhcH2MgaF5QiKYvfAzMPh9DmzogYaOPLzsAJIAIgCiuXyhWKvAKdnYcAsxGIuCEgW2MEIWkIagCuGYLGyLWc1C0uE6%2BMwolCjggsQUMRWQgULUYuxmtAcTjUWGoQgskVI0VimSJ1EwEBEp3EETMliE1GwQlwhgWQn0%2BjA0pYvVGKkxsMCACpFcrqAFoMpujC4dQFVhRJx4BxtjUIhxdrVfNQXSJgb4wLCWAU1ugLCxsGlbfT0EllqsNls7NAoBppZgLIx2OpNn1qGlpRLomCnFAoMpzFZouxUwJhKIRW44EkMcQAhNcrDPmyWkVfNtQuVrKgFi4OEIQ%2BH2pG%2BtsnHAbQAWABMuxDIDkIAN%2BZI5EQVDmXSgjgkYA5pzJ6GroYtZU9Qm9HF9-sDQltiHt%2BzqAD5qBOhE6Xa7W0IPboQAAcjeaQPsA%2BAAL7-voC4gGQIhiKQhBcCwUAUDQgjwSKlSyPgmToJAWhFAUh7xAYUgwOwPAcBwxBwIgAD09FwRWiGwlo9EwOg9GYOicD0cw%2BEQIRQjEbE9GNhKqBLKg0CoNgOQCQRRFdDyuDECpR6kWQ3LoHUVJwIe1AALxmiAADMhAAIzTlB6AgOBi5TF0KwAGLQDAFDYdUq72UAA
(Only applicable for extension issues) IDE Information
No response
I think this is coming from the implicit from builtins import * that is part of all modules.
We shouldn't include those.
Interestingly I'm having trouble reproducing this - for me, we don't pop up a suggestion at all until I type at least one character, and then I only get format_number and __file__, so this may require some more investigation of when exactly the bad suggestions are appearing
Oh, I should have made it clearer how I triggered the completion. The behavior is so automatic that I forgot it. I updated the first post with the instruction: I used the control + space keyboard shortcut (Mac) to trigger it, which I usually do to check exactly which objects are available and quickly get the exact name, if I don't recall how it starts.