Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-import confuses package and class with same name and different case #97

Closed
syagev opened this issue Jul 12, 2020 · 3 comments
Closed
Assignees
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@syagev
Copy link

syagev commented Jul 12, 2020

Environment data

  • Language Server version: 2020.7.1
  • OS and version: 10 (18363)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6

Expected behaviour

Using PyLance "Quick Fix" feature on the following code should suggest to add from abc import ABC:

class myclass(ABC):
    pass

Actual behaviour

Suggested imports all reference package abc, if it is clicked, the written code is changed! (IMO an "auto-import" quick-fix should never modify the code from which it was activated, it's very confusing).

Code Snippet / Additional information

pylance_bad_auto_import

@judej judej added the bug Something isn't working label Jul 13, 2020
@judej judej added enhancement New feature or request and removed bug Something isn't working labels Jul 13, 2020
@jakebailey
Copy link
Member

jakebailey commented Jul 13, 2020

For clarity, Pylance is fuzzy in these quick fixes, showing instances where the case may not match in case you have misspelled a module or similar. It's doing the right thing in that it's offering you things and replacing them on selection; if you click on a quick fix it's going to fix the code.

The core issue is that the quick fix import abc is not the right fix for this code, from abc import ABC is, but we don't yet have support for fixes that involve variables inside of unimporteed modules (only module names themselves).

@heejaechang heejaechang added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Sep 2, 2020
@heejaechang
Copy link
Contributor

should work in next version.

@jakebailey jakebailey reopened this Sep 2, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.9.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202090-3-september-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants