Add a "copy as import" code action #2669
Replies: 3 comments
-
@ThiefMaster, is there a description of the behavior or a gif that shows the functionality? thanks! |
Beta Was this translation helpful? Give feedback.
-
Note that the way PyCharm copies it is not perfect since it cannot be used as-is in Python code or a REPL (I wrote my own ipython extension for this when I still used PyCharm). But the gif shows pretty well how it works. The format how it's copied could be made configurable (placeholders for the symbol itself and the module path to it), or it could be always a "Copy as import" action resulting in a |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
PyCharm has something like this, and it's incredibly useful when you want to import a function from your codebase e.g. in a Python REPL.
Let's say you have a file
mypackage/foo/bar.py
containing atest
function. Then this action would copyfrom mypackage.foo.bar import test
.PyCharm copies
mypackage.foo.bar.test
but I think an actual import statement is more useful.Originally posted by @ThiefMaster in https://github.com/microsoft/vscode-python/discussions/16412
Beta Was this translation helpful? Give feedback.
All reactions