-
Notifications
You must be signed in to change notification settings - Fork 766
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
Bring along imports when copy and pasting code across files #5119
Comments
Is this something that we could solve by implementing format on paste? #4342 |
by finding the required imports? or by remembering the imports? the first one might be trickier since there might be multiple module exporting the same "name" |
We just shipped this for JavaScript and TypeScript so I'd love to help get Python support too! The VS Code API for this is still proposed but I'm tentatively planning to finalize it in January. It's also been relatively stable recently so you should be able to prototype using it. One potential limitation is that this API is currently only implemented in VS Code and not in the LSP. I have a LSP proposal for this and have also implemented the feature in the markdown language server using custom requests Let me know if you have any questions about trying the API. Would be really helpful to hear feedback on the API and VS Code UX too Here are some relevant code references to get started:
|
Example:
if I copy this snippet or any line code that uses one some of the imports it would be nice to get the imports where we paste those lines.
There's the same request for TS here: microsoft/TypeScript#50187
The text was updated successfully, but these errors were encountered: