如果您使用 PyQt4 类,在使用 python 扩展编写 Visual Studio 代码时弹出的智能感知建议需要花费太多时间(例如 20 秒)才会出现。我尝试在项目内部和外部使用不同的文件,得到相同的结果。
即使在 40 行 .py 中导入 from PyQt4 import QtGui
并有一个继承自 QtGui.QTableWidget
的简单类,建议永远需要时间,如果你按 ctrl+space 更糟糕,它根本不会加载。
注释导入并删除 PyQt4 类的继承,使 Intellisense 再次立即工作。
我不确定这是否证明 https://github.com/Microsoft/vscode-python 中的问题是合理的
也许我做错了什么?
为了完成,以下是我的用户设置:
{
"python.linting.enabled": true,
"editor.formatOnSave": true,
"python.linting.pylintArgs": [
"--disable=R,C",
"--extension-pkg-whitelist=PyQt4"
],
"git.confirmSync": false,
"git.autofetch": true,
"csv-preview.separator": ";",
"workbench.startupEditor": "newUntitledFile",
"python.formatting.autopep8Args": [
"--max-line-length=100"
]
}
更新:同样的项目,Intellisense 在 debian 下的 VS code 中运行速度要快得多。 (4-5 秒而不是 20 秒以上)
最佳答案
Jedi 在 PyQt 方面根本不快。这是一个已知问题,我们正在努力在不久的将来将分析引擎从 Visual Studio 迁移到 VS Code(关注我们的博客 https://aka.ms/pythonblog 以了解发布公告,了解它何时可用)。
关于python - vscode 智能感知与 PyQt4 配合使用太慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50298745/