英文:
VS Code Python: unable to get auto import suggestions
问题
I'm using VS Code on Linux. Auto imports do not work for me.
Here is a screenshot:
However, if I import math
, VS Code is able to give suggestions when I type math.
. This is my user settings.json:
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": false,
"python.analysis.indexing": true,
"python.analysis.autoImportCompletions": true,
"python.testing.pytestArgs": [
"-vv"
],
"python.testing.pytestEnabled": true,
"window.zoomLevel": -2
}
I don't have anything in my workspace settings.json. I've installed the ms-python and ms-pyright extensions. Everything should be a relatively recent version. Any ideas?
英文:
I'm using VS Code on Linux. Auto imports do not work for me.
Here is a screenshot:
However, if I import math
, VS Code is able to give suggestions when I type math.
. This is my user settings.json:
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": false,
"python.analysis.indexing": true,
"python.analysis.autoImportCompletions": true,
"python.testing.pytestArgs": [
"-vv"
],
"python.testing.pytestEnabled": true,
"window.zoomLevel": -2
}
I don't have anything in my workspace settings.json. I've installed the ms-python and ms-pyright extensions. Everything should be a relatively recent version. Any ideas?
答案1
得分: 0
I actually was not using Pylance (despite thinking I was). -> 我其实并没有使用Pylance(尽管我以为我在使用)。
I manually installed a Pylance vsix file from the marketplace. -> 我手动安装了一个来自市场的Pylance vsix文件。
I thought I was using Pylance because the Python extension says it will automatically install Pylance and given I didn't change any default settings, I assumed it was on. This was incorrect (though I'm not sure why). -> 我以为我在使用Pylance,因为Python扩展说它会自动安装Pylance,并且因为我没有更改任何默认设置,所以我认为它已经启用了。这是不正确的(尽管我不确定为什么)。
英文:
I actually was not using Pylance (despite thinking I was). I manually installed a Pylance vsix file from the marketplace.
I thought I was using Pylance because the Python extension says it will automatically install Pylance and given I didn't change any default settings, I assumed it was on. This was incorrect (though I'm not sure why).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论