PyCharm 自动导入和自动完成
我是第一次尝试 PyCharm。来自 Eclipse/PyDev 环境,我不得不说到目前为止一切进展顺利。
我缺少一个功能,但我似乎找不到,如下所示:
在 PyDev 的自动完成列表中,当输入文件范围内不存在的符号时,它将显示一个列表如果您选择该自动完成项,PyDev 不仅会为您完成符号,还会自动添加 import 语句来处理依赖关系。
PyCharm 中存在这个吗?
到目前为止,它似乎只是自动完成文档范围内已有的内容。
I am giving PyCharm a try for the first time. Coming from an Eclipse/PyDev environment I have to say so far things have been going well.
There is one feature I am missing that I can't seem to find though and that is as follows:
In the auto-complete list in PyDev, when typing a symbol that doesn't exist in the file's scope it will show a list of modules that it's in. If you select that autocomplete item not only will PyDev complete the symbol for you but it will automatically add the import statement to take care of the dependency as well.
Does this exist in PyCharm?
So far it only seems to autocomplete things already in the scope of the document.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅设置 | 编辑器 | 一般 | 自动导入。
See Settings | Editor | General | Auto Import.
我认为这绝对是一个bug或者功能不好
全新安装的pycharm 2021.3.3,在编写代码时,IDE本身会根据代码中的随机单词自动悄悄地放置一些包。
结果,环境被破坏了。
这是一个示例(来自 pycharm eventlog):
I think this is definitely a bug or bad functional
Fresh installation of pycharm 2021.3.3, when writing code, the IDE itself automatically quietly puts some packages according to random words from the code.
As a result, the environment was broken.
here is an example (that from pycharm eventlog):
这些变体已经存在,只是出于性能原因未包含在基本完成和完成自动弹出窗口中。为了看到它们,您需要在同一位置第二次调用完成或使用专用快捷方式(在键盘映射设置中搜索“第二次基本完成”)。
These variants are already there, they are just not included in the basic completion and completion auto-popup for performance reasons. In order to see them you need to invoke completion for the second time at the same place or use a dedicated shortcut (search for "Second Basic Completion" in the keymap settings).