-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature request: auto-import as a code action #4263
Comments
This is a language service feature that is included in pylance, Microsoft's premium Python language server for VS Code. We don't have plans to port it to pyright. If you want this functionality, please switch to pylance. |
@erictraut What? What if someone does a PR? Will you reject it? |
Well, that's a mouthful. I'd direct anyone interested in an actual open language server for Python towards python-lsp/python-lsp-server. The requested feature is seemingly supported. |
I don't have any problem with any Microsoft software, as long as the software is free as in freedom. But they offend repeatedly, so fear touching any Microsoft software, even when its free (as in freedom). |
I think its better not to discuss these things here. Microsoft is probably going to lock this issue eventually. |
Pyright is a type checker and is focused on type checking. It includes some basic language server features, but we don't have plans to add or accept new language server features in pyright. We continually add new type checking features to pyright. Microsoft employs a dedicated team of engineers who work on pylance, and they are continually adding new language server features to it. It has hundreds of features and capabilities that build on pyright's core type checking functionality. There are other language servers that also build on pyright's type checking capabilities. If you're currently using pyright with an editor other than VS Code, then you're probably already making use of one of these LSP plug-ins. Some of these add additional language server features on top of pyright. For example, coc-pyright adds the auto-import feature that is requested here. If you have language server feature requests, I recommend directing those to the maintainers of the language server that you are using. |
Pylance is gratis (zero price), then how does Microsoft make enough revenue to employ the team? |
i've just released basedpyright 1.3.0 with code actions for import suggestions |
It's to direct people to vscode. once in vscode, microsoft will monetize it's userbase via telemetry and offering paid plugins like github copilot. |
@DetachHead I am using Basedpyright with Neovim and it works great, however I see the auto-import suggestions as code actions only work for built-in standard library modules and not for third party installed packages. Do we need to add the path to site-packages folder for project to |
probably the same issue as DetachHead/basedpyright#545, pyright doesn't know about the module if you haven't opened it yet. the reason it works for standard library modules is because of a recent change we made to make it always automatically load all the standard library modules (DetachHead/basedpyright#655). not sure how pylance handles this, i've been meaning to look into this further but haven't had the time |
I tried by setting extraPath to site-packages folder but even that didn't work. |
see if setting |
Is your feature request related to a problem? Please describe.
I like the auto-import from completion suggestions. But sometimes I like to copy-paste a ready function call. In that case it's awkward to re-trigger the completion just to get the auto-import.
Describe the solution you'd like
Add a code action to import the variable at point.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: